From 3cdb5e0d1fff7a4d4b1dc1dcca4d024192df13d2 Mon Sep 17 00:00:00 2001 From: George Marques Date: Thu, 28 Jul 2016 21:23:05 -0300 Subject: [PATCH] Fix editor icons source file generation Also removes the unused make_icons.py file. --- tools/editor/icons/SCsub | 5 +--- tools/editor/icons/make_icons.py | 48 -------------------------------- 2 files changed, 1 insertion(+), 52 deletions(-) delete mode 100644 tools/editor/icons/make_icons.py diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub index f2f5dcca48d..bc104294cb6 100644 --- a/tools/editor/icons/SCsub +++ b/tools/editor/icons/SCsub @@ -37,12 +37,9 @@ def make_editor_icons_action(target, source, env): pngf.close(); var_str=os.path.basename(x)[:-4]+"_hidpi_png"; -#print("TRY OPEN: "+os.path.dirname(x)+"/2x/"+os.path.basename(x)+"\n") try: - pngf = open(os.path.dirname(x)+"/2x/"+os.path.basename(x)) - - #print(var_str) + pngf = open(os.path.dirname(x)+"/2x/"+os.path.basename(x), "rb") s.write("static const unsigned char "+ var_str +"[]={\n"); diff --git a/tools/editor/icons/make_icons.py b/tools/editor/icons/make_icons.py deleted file mode 100644 index e06cbac7208..00000000000 --- a/tools/editor/icons/make_icons.py +++ /dev/null @@ -1,48 +0,0 @@ - -import glob - -pixmaps = glob.glob("*.png") - -f = open("../editor_icons.cpp","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"; - - f.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))) - b=pngf.read(1); - if (len(b)==1): - f.write(",") - - f.write("\n};\n\n\n"); - pngf.close(); - -f.write("static Ref make_icon(const uint8_t* p_png) {\n") -f.write("\tRef 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") - -f.write("void editor_register_icons(Ref p_theme) {\n\n") - - -for x in pixmaps: - - type=x[5:-4].title().replace("_",""); - var_str=x[:-4]+"_png"; - f.write("\tp_theme->set_icon(\""+type+"\",\"EditorIcons\",make_icon("+var_str+"));\n"); - -f.write("\n\n}\n\n"); -f.close() - -