Commit b87a2326 by Rémi Verschelde

Reorder the folders in tools to prepare moving tools/editor

- `certs` and `editor_fonts` go to `thirdparty` - `dist` and `scripts` go to a new `misc` folder - `collada` and `doc` go to `tools/editor` The next step will be to rename `tools/editor` to `editor` directly, but this will be done at the right time to avoid breaking too many PRs.
parent b19c9bd1
......@@ -358,7 +358,7 @@ if selected_platform in platform_list:
SConscript("core/SCsub")
SConscript("servers/SCsub")
SConscript("scene/SCsub")
SConscript("tools/SCsub")
SConscript("tools/editor/SCsub")
SConscript("drivers/SCsub")
SConscript("modules/SCsub")
......@@ -374,7 +374,7 @@ if selected_platform in platform_list:
AddToVSProject(env.modules_sources)
AddToVSProject(env.scene_sources)
AddToVSProject(env.servers_sources)
AddToVSProject(env.tool_sources)
AddToVSProject(env.editor_sources)
# this env flag won't work, it needs to be set in env_base=Environment(MSVC_VERSION='9.0')
# Even then, SCons still seems to ignore it and builds with the latest MSVC...
......
......@@ -54,18 +54,14 @@
#include "scene/main/viewport.h"
#ifdef TOOLS_ENABLED
#include "tools/editor/doc/doc_data.h"
#include "tools/editor/editor_node.h"
#include "tools/editor/project_manager.h"
#endif
#include "io/file_access_network.h"
#include "tools/doc/doc_data.h"
#include "servers/physics_2d_server.h"
#include "core/io/stream_peer_tcp.h"
#include "core/os/thread.h"
#include "core/io/file_access_pack.h"
......
# Third party libraries
## certs
- Upstream: ?
TODO.
## enet
- Upstream: http://enet.bespin.org
......@@ -18,6 +25,13 @@ for all platforms (especially UWP). Check the diff with the 1.3.13 tarball
before the next update.
## fonts
- Upstream: ?
TODO.
## freetype
- Upstream: https://www.freetype.org
......
#!/usr/bin/env python
Import('env')
env.tool_sources = []
env.add_source_files(env.tool_sources, "*.cpp")
Export('env')
def make_translations_header(target, source, env):
dst = target[0].srcnode().abspath
g = open(dst, "wb")
""""
"""
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
g.write("#ifndef _EDITOR_TRANSLATIONS_H\n")
g.write("#define _EDITOR_TRANSLATIONS_H\n")
import zlib
import os.path
paths = [node.srcnode().abspath for node in source]
sorted_paths = sorted(paths, key=lambda path: os.path.splitext(os.path.basename(path))[0])
xl_names = []
for i in range(len(sorted_paths)):
print("Appending translation: " + sorted_paths[i])
f = open(sorted_paths[i], "rb")
buf = f.read()
decomp_size = len(buf)
buf = zlib.compress(buf)
name = os.path.splitext(os.path.basename(sorted_paths[i]))[0]
#g.write("static const int _translation_"+name+"_compressed_size="+str(len(buf))+";\n")
#g.write("static const int _translation_"+name+"_uncompressed_size="+str(decomp_size)+";\n")
g.write("static const unsigned char _translation_" + name + "_compressed[]={\n")
for i in range(len(buf)):
g.write(str(ord(buf[i])) + ",\n")
g.write("};\n")
xl_names.append([name, len(buf), str(decomp_size)])
g.write("struct EditorTranslationList {\n")
g.write("\tconst char* lang;\n")
g.write("\tint comp_size;\n")
g.write("\tint uncomp_size;\n")
g.write("\tconst unsigned char* data;\n")
g.write("};\n\n")
g.write("static EditorTranslationList _editor_translations[]={\n")
for x in xl_names:
g.write("\t{ \"" + x[0] + "\", " + str(x[1]) + ", " + str(x[2]) + ",_translation_" + x[0] + "_compressed},\n")
g.write("\t{NULL,0,0,NULL}\n")
g.write("};\n")
g.write("#endif")
def make_fonts_header(target, source, env):
dst = target[0].srcnode().abspath
g = open(dst, "wb")
""""
"""
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
g.write("#ifndef _EDITOR_FONTS_H\n")
g.write("#define _EDITOR_FONTS_H\n")
# saving uncompressed, since freetype will reference from memory pointer
xl_names = []
for i in range(len(source)):
print("Appending font: " + source[i].srcnode().abspath)
f = open(source[i].srcnode().abspath, "rb")
buf = f.read()
import os.path
name = os.path.splitext(os.path.basename(source[i].srcnode().abspath))[0]
g.write("static const int _font_" + name + "_size=" + str(len(buf)) + ";\n")
g.write("static const unsigned char _font_" + name + "[]={\n")
for i in range(len(buf)):
g.write(str(ord(buf[i])) + ",\n")
g.write("};\n")
g.write("#endif")
if (env["tools"] != "no"):
import glob
dir = env.Dir('.').abspath
tlist = glob.glob(dir + "/translations/*.po")
print("translations: ", tlist)
env.Depends('#tools/editor/translations.h', tlist)
env.Command('#tools/editor/translations.h', tlist, make_translations_header)
flist = glob.glob(dir + "/editor_fonts/*.ttf")
flist.append(glob.glob(dir + "/editor_fonts/*.otf"))
print("fonts: ", flist)
env.Depends('#tools/editor/builtin_fonts.h', flist)
env.Command('#tools/editor/builtin_fonts.h', flist, make_fonts_header)
SConscript('editor/SCsub')
SConscript('collada/SCsub')
SConscript('doc/SCsub')
lib = env.Library("tool", env.tool_sources)
env.Prepend(LIBS=[lib])
#!/usr/bin/env python
Import('env')
env.editor_sources = []
def make_doc_header(target, source, env):
def make_certs_header(target, source, env):
src = source[0].srcnode().abspath
dst = target[0].srcnode().abspath
......@@ -15,18 +16,18 @@ def make_doc_header(target, source, env):
buf = zlib.compress(buf)
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
g.write("#ifndef _DOC_DATA_RAW_H\n")
g.write("#define _DOC_DATA_RAW_H\n")
g.write("static const int _doc_data_compressed_size=" + str(len(buf)) + ";\n")
g.write("static const int _doc_data_uncompressed_size=" + str(decomp_size) + ";\n")
g.write("static const unsigned char _doc_data_compressed[]={\n")
g.write("#ifndef _CERTS_RAW_H\n")
g.write("#define _CERTS_RAW_H\n")
g.write("static const int _certs_compressed_size=" + str(len(buf)) + ";\n")
g.write("static const int _certs_uncompressed_size=" + str(decomp_size) + ";\n")
g.write("static const unsigned char _certs_compressed[]={\n")
for i in range(len(buf)):
g.write(str(ord(buf[i])) + ",\n")
g.write("};\n")
g.write("#endif")
def make_certs_header(target, source, env):
def make_doc_header(target, source, env):
src = source[0].srcnode().abspath
dst = target[0].srcnode().abspath
......@@ -38,23 +39,104 @@ def make_certs_header(target, source, env):
buf = zlib.compress(buf)
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
g.write("#ifndef _CERTS_RAW_H\n")
g.write("#define _CERTS_RAW_H\n")
g.write("static const int _certs_compressed_size=" + str(len(buf)) + ";\n")
g.write("static const int _certs_uncompressed_size=" + str(decomp_size) + ";\n")
g.write("static const unsigned char _certs_compressed[]={\n")
g.write("#ifndef _DOC_DATA_RAW_H\n")
g.write("#define _DOC_DATA_RAW_H\n")
g.write("static const int _doc_data_compressed_size=" + str(len(buf)) + ";\n")
g.write("static const int _doc_data_uncompressed_size=" + str(decomp_size) + ";\n")
g.write("static const unsigned char _doc_data_compressed[]={\n")
for i in range(len(buf)):
g.write(str(ord(buf[i])) + ",\n")
g.write("};\n")
g.write("#endif")
def make_fonts_header(target, source, env):
dst = target[0].srcnode().abspath
g = open(dst, "wb")
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
g.write("#ifndef _EDITOR_FONTS_H\n")
g.write("#define _EDITOR_FONTS_H\n")
# saving uncompressed, since freetype will reference from memory pointer
xl_names = []
for i in range(len(source)):
print("Appending font: " + source[i].srcnode().abspath)
f = open(source[i].srcnode().abspath, "rb")
buf = f.read()
import os.path
name = os.path.splitext(os.path.basename(source[i].srcnode().abspath))[0]
g.write("static const int _font_" + name + "_size=" + str(len(buf)) + ";\n")
g.write("static const unsigned char _font_" + name + "[]={\n")
for i in range(len(buf)):
g.write(str(ord(buf[i])) + ",\n")
g.write("};\n")
g.write("#endif")
def make_translations_header(target, source, env):
dst = target[0].srcnode().abspath
g = open(dst, "wb")
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
g.write("#ifndef _EDITOR_TRANSLATIONS_H\n")
g.write("#define _EDITOR_TRANSLATIONS_H\n")
import zlib
import os.path
paths = [node.srcnode().abspath for node in source]
sorted_paths = sorted(paths, key=lambda path: os.path.splitext(os.path.basename(path))[0])
xl_names = []
for i in range(len(sorted_paths)):
print("Appending translation: " + sorted_paths[i])
f = open(sorted_paths[i], "rb")
buf = f.read()
decomp_size = len(buf)
buf = zlib.compress(buf)
name = os.path.splitext(os.path.basename(sorted_paths[i]))[0]
#g.write("static const int _translation_"+name+"_compressed_size="+str(len(buf))+";\n")
#g.write("static const int _translation_"+name+"_uncompressed_size="+str(decomp_size)+";\n")
g.write("static const unsigned char _translation_" + name + "_compressed[]={\n")
for i in range(len(buf)):
g.write(str(ord(buf[i])) + ",\n")
g.write("};\n")
xl_names.append([name, len(buf), str(decomp_size)])
g.write("struct EditorTranslationList {\n")
g.write("\tconst char* lang;\n")
g.write("\tint comp_size;\n")
g.write("\tint uncomp_size;\n")
g.write("\tconst unsigned char* data;\n")
g.write("};\n\n")
g.write("static EditorTranslationList _editor_translations[]={\n")
for x in xl_names:
g.write("\t{ \"" + x[0] + "\", " + str(x[1]) + ", " + str(x[2]) + ",_translation_" + x[0] + "_compressed},\n")
g.write("\t{NULL,0,0,NULL}\n")
g.write("};\n")
g.write("#endif")
if (env["tools"] == "yes"):
# Register exporters
reg_exporters_inc = '#include "register_exporters.h"\n'
reg_exporters = 'void register_exporters() {\n'
for e in env.platform_exporters:
env.tool_sources.append("#platform/" + e + "/export/export.cpp")
env.editor_sources.append("#platform/" + e + "/export/export.cpp")
reg_exporters += '\t//register_' + e + '_exporter();\n'
reg_exporters_inc += '#include "platform/' + e + '/export/export.h"\n'
reg_exporters += '}\n'
......@@ -63,19 +145,42 @@ if (env["tools"] == "yes"):
f.write(reg_exporters)
f.close()
# API documentation
env.Depends("#tools/editor/doc_data_compressed.h", "#doc/base/classes.xml")
env.Command("#tools/editor/doc_data_compressed.h", "#doc/base/classes.xml", make_doc_header)
env.Depends("#tools/editor/certs_compressed.h", "#tools/certs/ca-certificates.crt")
env.Command("#tools/editor/certs_compressed.h", "#tools/certs/ca-certificates.crt", make_certs_header)
# Certificates
env.Depends("#tools/editor/certs_compressed.h", "#thirdparty/certs/ca-certificates.crt")
env.Command("#tools/editor/certs_compressed.h", "#thirdparty/certs/ca-certificates.crt", make_certs_header)
# make_doc_header(env.File("#tools/editor/doc_data_raw.h").srcnode().abspath,env.File("#doc/base/classes.xml").srcnode().abspath,env)
import glob
path = env.Dir('.').abspath
env.add_source_files(env.tool_sources, "*.cpp")
# Translations
tlist = glob.glob(path + "/translations/*.po")
print("translations: ", tlist)
env.Depends('#tools/editor/translations.h', tlist)
env.Command('#tools/editor/translations.h', tlist, make_translations_header)
Export('env')
SConscript('icons/SCsub')
SConscript('plugins/SCsub')
# Fonts
flist = glob.glob(path + "/../../thirdparty/fonts/*.ttf")
flist.append(glob.glob(path + "/../../thirdparty/fonts/*.otf"))
print("fonts: ", flist)
env.Depends('#tools/editor/builtin_fonts.h', flist)
env.Command('#tools/editor/builtin_fonts.h', flist, make_fonts_header)
env.add_source_files(env.editor_sources, "*.cpp")
SConscript('collada/SCsub')
SConscript('doc/SCsub')
SConscript('fileserver/SCsub')
SConscript('io_plugins/SCsub')
SConscript('icons/SCsub')
SConscript('import/SCsub')
SConscript('io_plugins/SCsub')
SConscript('plugins/SCsub')
lib = env.Library("editor", env.editor_sources)
env.Prepend(LIBS=[lib])
Export('env')
......@@ -2,6 +2,6 @@
Import('env')
env.add_source_files(env.tool_sources, "*.cpp")
env.add_source_files(env.editor_sources, "*.cpp")
Export('env')
......@@ -2,6 +2,6 @@
Import('env')
env.add_source_files(env.tool_sources, "*.cpp")
env.add_source_files(env.editor_sources, "*.cpp")
Export('env')
......@@ -40,7 +40,7 @@
#include "scene/main/timer.h"
#include "tools/editor/code_editor.h"
#include "tools/doc/doc_data.h"
#include "tools/editor/doc/doc_data.h"
class EditorNode;
......
......@@ -2,4 +2,4 @@
Import('env')
Export('env')
env.add_source_files(env.tool_sources, "*.cpp")
env.add_source_files(env.editor_sources, "*.cpp")
......@@ -92,5 +92,5 @@ make_editor_icons_builder = Builder(action=make_editor_icons_action,
env['BUILDERS']['MakeEditorIconsBuilder'] = make_editor_icons_builder
env.Alias('editor_icons', [env.MakeEditorIconsBuilder('#tools/editor/editor_icons.cpp', Glob("*.png"))])
env.tool_sources.append("#tools/editor/editor_icons.cpp")
env.editor_sources.append("#tools/editor/editor_icons.cpp")
Export('env')
......@@ -2,4 +2,4 @@
Import('env')
Export('env')
env.add_source_files(env.tool_sources, "*.cpp")
env.add_source_files(env.editor_sources, "*.cpp")
......@@ -29,7 +29,6 @@
#include "editor_import_collada.h"
#include "collada/collada.h"
#include "scene/3d/spatial.h"
#include "scene/3d/skeleton.h"
#include "scene/3d/path.h"
......@@ -40,6 +39,7 @@
#include "scene/resources/animation.h"
#include "scene/resources/packed_scene.h"
#include "os/os.h"
#include "tools/editor/collada/collada.h"
#include "tools/editor/editor_node.h"
#include <iostream>
......
......@@ -2,4 +2,4 @@
Import('env')
Export('env')
env.add_source_files(env.tool_sources, "*.cpp")
env.add_source_files(env.editor_sources, "*.cpp")
......@@ -2,4 +2,4 @@
Import('env')
Export('env')
env.add_source_files(env.tool_sources, "*.cpp")
env.add_source_files(env.editor_sources, "*.cpp")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment