summaryrefslogtreecommitdiff
path: root/tools/editor/icons/SCsub
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-06-11 10:41:43 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-06-11 10:41:43 -0300
commit64e83bfd1404ea593f0c79b478d196a3fcde42a8 (patch)
treec18c61da239443532a94fb9fa54df702df12a90b /tools/editor/icons/SCsub
parent9b8696d3dd92e2ed6f310ad0f0bf3c2182c9c6ae (diff)
parent5f5cd5e6d1508f85ac1bffa44e122b4dc0e2bb1d (diff)
Merge branch 'master' of https://github.com/okamstudio/godot
Diffstat (limited to 'tools/editor/icons/SCsub')
-rw-r--r--tools/editor/icons/SCsub36
1 files changed, 21 insertions, 15 deletions
diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub
index a7e550feac..aea053d22b 100644
--- a/tools/editor/icons/SCsub
+++ b/tools/editor/icons/SCsub
@@ -3,13 +3,15 @@ Import('env')
def make_editor_icons_action(target, source, env):
import os
+ import cStringIO
dst = target[0].srcnode().abspath
pixmaps = source
+
+ s = cStringIO.StringIO()
- f = open(dst,"wb")
- f.write("#include \"editor_icons.h\"\n\n")
- f.write("#include \"scene/resources/theme.h\"\n\n")
+ s.write("#include \"editor_icons.h\"\n\n")
+ s.write("#include \"scene/resources/theme.h\"\n\n")
for x in pixmaps:
@@ -17,37 +19,41 @@ def make_editor_icons_action(target, source, env):
var_str=os.path.basename(x)[:-4]+"_png";
#print(var_str)
- f.write("static const unsigned char "+ var_str +"[]={\n");
+ s.write("static const unsigned char "+ var_str +"[]={\n");
pngf=open(x,"rb");
b=pngf.read(1);
while(len(b)==1):
- f.write(hex(ord(b)))
+ s.write(hex(ord(b)))
b=pngf.read(1);
if (len(b)==1):
- f.write(",")
+ s.write(",")
- f.write("\n};\n\n\n");
+ s.write("\n};\n\n\n");
pngf.close();
- f.write("static Ref<ImageTexture> make_icon(const uint8_t* p_png) {\n")
- f.write("\tRef<ImageTexture> texture( memnew( ImageTexture ) );\n")
- f.write("\ttexture->create_from_image( Image(p_png),ImageTexture::FLAG_FILTER );\n")
- f.write("\treturn texture;\n")
- f.write("}\n\n")
+ s.write("static Ref<ImageTexture> make_icon(const uint8_t* p_png) {\n")
+ s.write("\tRef<ImageTexture> texture( memnew( ImageTexture ) );\n")
+ s.write("\ttexture->create_from_image( Image(p_png),ImageTexture::FLAG_FILTER );\n")
+ s.write("\treturn texture;\n")
+ s.write("}\n\n")
- f.write("void editor_register_icons(Ref<Theme> p_theme) {\n\n")
+ s.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");
+ s.write("\tp_theme->set_icon(\""+type+"\",\"EditorIcons\",make_icon("+var_str+"));\n");
- f.write("\n\n}\n\n");
+ s.write("\n\n}\n\n");
+
+ f = open(dst,"wb")
+ f.write(s.getvalue())
f.close()
+ s.close()
make_editor_icons_builder = Builder(action=make_editor_icons_action,
suffix = '.cpp',