summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authormarynate <mary.w.nate@gmail.com>2014-05-14 10:47:17 +0800
committermarynate <mary.w.nate@gmail.com>2014-05-14 10:52:08 +0800
commitd2770ac8a669f567cf34b73c35734c4e9175647b (patch)
treee0e8386015e629d7aa7a57cc4ce199c93553deca /tools
parentf5421cdaf342ba15840a4041b4a9d9efb44fa4f0 (diff)
Add sCons dependency for editor_icons.cpp, so it's only re-generated when there're icon changes
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/SCsub6
-rw-r--r--tools/editor/icons/SCsub30
2 files changed, 24 insertions, 12 deletions
diff --git a/tools/editor/SCsub b/tools/editor/SCsub
index 281f560acb..73ec530177 100644
--- a/tools/editor/SCsub
+++ b/tools/editor/SCsub
@@ -48,11 +48,11 @@ if (env["tools"]=="yes"):
env.Command("#tools/editor/doc_data_compressed.h","#doc/base/classes.xml",make_doc_header)
#make_doc_header(env.File("#tools/editor/doc_data_raw.h").srcnode().abspath,env.File("#doc/base/classes.xml").srcnode().abspath,env)
-
- SConscript('icons/SCsub');
+
env.add_source_files(env.tool_sources,"*.cpp")
-
+
Export('env')
+ SConscript('icons/SCsub');
SConscript('plugins/SCsub');
SConscript('fileserver/SCsub');
SConscript('io_plugins/SCsub');
diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub
index edc4cc56ff..a7e550feac 100644
--- a/tools/editor/icons/SCsub
+++ b/tools/editor/icons/SCsub
@@ -1,18 +1,21 @@
Import('env')
-def make_editor_icons():
+def make_editor_icons_action(target, source, env):
- import glob
-
- pixmaps = glob.glob("*.png")
+ import os
+
+ dst = target[0].srcnode().abspath
+ pixmaps = source
- f = open("../editor_icons.cpp","wb")
+ f = open(dst,"wb")
f.write("#include \"editor_icons.h\"\n\n")
f.write("#include \"scene/resources/theme.h\"\n\n")
for x in pixmaps:
-
- var_str=x[:-4]+"_png";
+
+ x=str(x)
+ var_str=os.path.basename(x)[:-4]+"_png";
+ #print(var_str)
f.write("static const unsigned char "+ var_str +"[]={\n");
@@ -37,7 +40,8 @@ def make_editor_icons():
f.write("void editor_register_icons(Ref<Theme> p_theme) {\n\n")
for x in pixmaps:
-
+
+ x=os.path.basename(str(x))
type=x[5:-4].title().replace("_","");
var_str=x[:-4]+"_png";
f.write("\tp_theme->set_icon(\""+type+"\",\"EditorIcons\",make_icon("+var_str+"));\n");
@@ -45,4 +49,12 @@ def make_editor_icons():
f.write("\n\n}\n\n");
f.close()
-make_editor_icons()
+make_editor_icons_builder = Builder(action=make_editor_icons_action,
+ suffix = '.cpp',
+ src_suffix = '.png')
+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")
+Export('env')
+