From 7c11a1b162f9f1ac5ad8b8e2a879a200b22603d0 Mon Sep 17 00:00:00 2001 From: "Andrii Doroshenko (Xrayez)" Date: Fri, 28 Jun 2019 23:42:26 +0300 Subject: Add support for creating editor icons per module The functionality is similar to how `doc_classes` are retrieved per module. The build system will search for custom icons path defined per module via `get_icons_path()` method in `config.py` or default icons path. If such paths don't exist, only the editor's own icons will be built. Most module icons were moved from editor/icons to respective modules. --- SConstruct | 18 ++++++++++++++---- editor/icons/SCsub | 10 +++++++++- editor/icons/icon_c_s_g_box.svg | 6 ------ editor/icons/icon_c_s_g_capsule.svg | 6 ------ editor/icons/icon_c_s_g_combiner.svg | 8 -------- editor/icons/icon_c_s_g_cylinder.svg | 6 ------ editor/icons/icon_c_s_g_mesh.svg | 6 ------ editor/icons/icon_c_s_g_polygon.svg | 6 ------ editor/icons/icon_c_s_g_sphere.svg | 6 ------ editor/icons/icon_c_s_g_torus.svg | 6 ------ editor/icons/icon_g_d_native_library.svg | 5 ----- editor/icons/icon_g_d_script.svg | 5 ----- editor/icons/icon_grid_map.svg | 5 ----- editor/icons/icon_native_script.svg | 5 ----- editor/icons/icon_noise_texture.svg | 3 --- editor/icons/icon_visual_script.svg | 6 ------ modules/csg/icons/icon_c_s_g_box.svg | 6 ++++++ modules/csg/icons/icon_c_s_g_capsule.svg | 6 ++++++ modules/csg/icons/icon_c_s_g_combiner.svg | 8 ++++++++ modules/csg/icons/icon_c_s_g_cylinder.svg | 6 ++++++ modules/csg/icons/icon_c_s_g_mesh.svg | 6 ++++++ modules/csg/icons/icon_c_s_g_polygon.svg | 6 ++++++ modules/csg/icons/icon_c_s_g_sphere.svg | 6 ++++++ modules/csg/icons/icon_c_s_g_torus.svg | 6 ++++++ modules/gdnative/icons/icon_g_d_native_library.svg | 5 +++++ modules/gdnative/icons/icon_native_script.svg | 5 +++++ modules/gdscript/icons/icon_g_d_script.svg | 5 +++++ modules/gridmap/icons/icon_grid_map.svg | 5 +++++ modules/opensimplex/icons/icon_noise_texture.svg | 3 +++ modules/visual_script/icons/icon_visual_script.svg | 6 ++++++ 30 files changed, 102 insertions(+), 84 deletions(-) delete mode 100644 editor/icons/icon_c_s_g_box.svg delete mode 100644 editor/icons/icon_c_s_g_capsule.svg delete mode 100644 editor/icons/icon_c_s_g_combiner.svg delete mode 100644 editor/icons/icon_c_s_g_cylinder.svg delete mode 100644 editor/icons/icon_c_s_g_mesh.svg delete mode 100644 editor/icons/icon_c_s_g_polygon.svg delete mode 100644 editor/icons/icon_c_s_g_sphere.svg delete mode 100644 editor/icons/icon_c_s_g_torus.svg delete mode 100644 editor/icons/icon_g_d_native_library.svg delete mode 100644 editor/icons/icon_g_d_script.svg delete mode 100644 editor/icons/icon_grid_map.svg delete mode 100644 editor/icons/icon_native_script.svg delete mode 100644 editor/icons/icon_noise_texture.svg delete mode 100644 editor/icons/icon_visual_script.svg create mode 100644 modules/csg/icons/icon_c_s_g_box.svg create mode 100644 modules/csg/icons/icon_c_s_g_capsule.svg create mode 100644 modules/csg/icons/icon_c_s_g_combiner.svg create mode 100644 modules/csg/icons/icon_c_s_g_cylinder.svg create mode 100644 modules/csg/icons/icon_c_s_g_mesh.svg create mode 100644 modules/csg/icons/icon_c_s_g_polygon.svg create mode 100644 modules/csg/icons/icon_c_s_g_sphere.svg create mode 100644 modules/csg/icons/icon_c_s_g_torus.svg create mode 100644 modules/gdnative/icons/icon_g_d_native_library.svg create mode 100644 modules/gdnative/icons/icon_native_script.svg create mode 100644 modules/gdscript/icons/icon_g_d_script.svg create mode 100644 modules/gridmap/icons/icon_grid_map.svg create mode 100644 modules/opensimplex/icons/icon_noise_texture.svg create mode 100644 modules/visual_script/icons/icon_visual_script.svg diff --git a/SConstruct b/SConstruct index a619ea0797..c2524a4a4d 100644 --- a/SConstruct +++ b/SConstruct @@ -399,6 +399,7 @@ if selected_platform in platform_list: sys.modules.pop('detect') env.module_list = [] + env.module_icons_paths = [] env.doc_class_path = {} for x in module_list: @@ -421,13 +422,22 @@ if selected_platform in platform_list: if (can_build): config.configure(env) env.module_list.append(x) + + # Get doc classes paths (if present) try: - doc_classes = config.get_doc_classes() - doc_path = config.get_doc_path() - for c in doc_classes: - env.doc_class_path[c] = "modules/" + x + "/" + doc_path + doc_classes = config.get_doc_classes() + doc_path = config.get_doc_path() + for c in doc_classes: + env.doc_class_path[c] = "modules/" + x + "/" + doc_path except: pass + # Get icon paths (if present) + try: + icons_path = config.get_icons_path() + env.module_icons_paths.append("modules/" + x + "/" + icons_path) + except: + # Default path for module icons + env.module_icons_paths.append("modules/" + x + "/" + "icons") sys.path.remove(tmppath) sys.modules.pop('config') diff --git a/editor/icons/SCsub b/editor/icons/SCsub index 109e1aa83b..b39c74c66a 100644 --- a/editor/icons/SCsub +++ b/editor/icons/SCsub @@ -10,4 +10,12 @@ make_editor_icons_builder = Builder(action=run_in_subprocess(editor_icons_builde src_suffix='.svg') env['BUILDERS']['MakeEditorIconsBuilder'] = make_editor_icons_builder -env.Alias('editor_icons', [env.MakeEditorIconsBuilder('#editor/editor_icons.gen.h', Glob("*.svg"))]) + +# Editor's own icons +icon_sources = Glob("*.svg") + +# Module icons +for module_icons in env.module_icons_paths: + icon_sources += Glob('#' + module_icons + "/*.svg") + +env.Alias('editor_icons', [env.MakeEditorIconsBuilder('#editor/editor_icons.gen.h', icon_sources)]) diff --git a/editor/icons/icon_c_s_g_box.svg b/editor/icons/icon_c_s_g_box.svg deleted file mode 100644 index 67e34df444..0000000000 --- a/editor/icons/icon_c_s_g_box.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/editor/icons/icon_c_s_g_capsule.svg b/editor/icons/icon_c_s_g_capsule.svg deleted file mode 100644 index 92a7b5a870..0000000000 --- a/editor/icons/icon_c_s_g_capsule.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/editor/icons/icon_c_s_g_combiner.svg b/editor/icons/icon_c_s_g_combiner.svg deleted file mode 100644 index cce2902e24..0000000000 --- a/editor/icons/icon_c_s_g_combiner.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/editor/icons/icon_c_s_g_cylinder.svg b/editor/icons/icon_c_s_g_cylinder.svg deleted file mode 100644 index 645a74c79b..0000000000 --- a/editor/icons/icon_c_s_g_cylinder.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/editor/icons/icon_c_s_g_mesh.svg b/editor/icons/icon_c_s_g_mesh.svg deleted file mode 100644 index 6e940a4aa5..0000000000 --- a/editor/icons/icon_c_s_g_mesh.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/editor/icons/icon_c_s_g_polygon.svg b/editor/icons/icon_c_s_g_polygon.svg deleted file mode 100644 index 71b03cb8e6..0000000000 --- a/editor/icons/icon_c_s_g_polygon.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/editor/icons/icon_c_s_g_sphere.svg b/editor/icons/icon_c_s_g_sphere.svg deleted file mode 100644 index f81b566993..0000000000 --- a/editor/icons/icon_c_s_g_sphere.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/editor/icons/icon_c_s_g_torus.svg b/editor/icons/icon_c_s_g_torus.svg deleted file mode 100644 index 3d30aa47b2..0000000000 --- a/editor/icons/icon_c_s_g_torus.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/editor/icons/icon_g_d_native_library.svg b/editor/icons/icon_g_d_native_library.svg deleted file mode 100644 index b494c7af6e..0000000000 --- a/editor/icons/icon_g_d_native_library.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/editor/icons/icon_g_d_script.svg b/editor/icons/icon_g_d_script.svg deleted file mode 100644 index 953bb9ae9e..0000000000 --- a/editor/icons/icon_g_d_script.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/editor/icons/icon_grid_map.svg b/editor/icons/icon_grid_map.svg deleted file mode 100644 index eafe1211f2..0000000000 --- a/editor/icons/icon_grid_map.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/editor/icons/icon_native_script.svg b/editor/icons/icon_native_script.svg deleted file mode 100644 index fb9e135627..0000000000 --- a/editor/icons/icon_native_script.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/editor/icons/icon_noise_texture.svg b/editor/icons/icon_noise_texture.svg deleted file mode 100644 index 5908c2b2d4..0000000000 --- a/editor/icons/icon_noise_texture.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/editor/icons/icon_visual_script.svg b/editor/icons/icon_visual_script.svg deleted file mode 100644 index f6475d590e..0000000000 --- a/editor/icons/icon_visual_script.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/modules/csg/icons/icon_c_s_g_box.svg b/modules/csg/icons/icon_c_s_g_box.svg new file mode 100644 index 0000000000..67e34df444 --- /dev/null +++ b/modules/csg/icons/icon_c_s_g_box.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/modules/csg/icons/icon_c_s_g_capsule.svg b/modules/csg/icons/icon_c_s_g_capsule.svg new file mode 100644 index 0000000000..92a7b5a870 --- /dev/null +++ b/modules/csg/icons/icon_c_s_g_capsule.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/modules/csg/icons/icon_c_s_g_combiner.svg b/modules/csg/icons/icon_c_s_g_combiner.svg new file mode 100644 index 0000000000..cce2902e24 --- /dev/null +++ b/modules/csg/icons/icon_c_s_g_combiner.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/modules/csg/icons/icon_c_s_g_cylinder.svg b/modules/csg/icons/icon_c_s_g_cylinder.svg new file mode 100644 index 0000000000..645a74c79b --- /dev/null +++ b/modules/csg/icons/icon_c_s_g_cylinder.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/modules/csg/icons/icon_c_s_g_mesh.svg b/modules/csg/icons/icon_c_s_g_mesh.svg new file mode 100644 index 0000000000..6e940a4aa5 --- /dev/null +++ b/modules/csg/icons/icon_c_s_g_mesh.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/modules/csg/icons/icon_c_s_g_polygon.svg b/modules/csg/icons/icon_c_s_g_polygon.svg new file mode 100644 index 0000000000..71b03cb8e6 --- /dev/null +++ b/modules/csg/icons/icon_c_s_g_polygon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/modules/csg/icons/icon_c_s_g_sphere.svg b/modules/csg/icons/icon_c_s_g_sphere.svg new file mode 100644 index 0000000000..f81b566993 --- /dev/null +++ b/modules/csg/icons/icon_c_s_g_sphere.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/modules/csg/icons/icon_c_s_g_torus.svg b/modules/csg/icons/icon_c_s_g_torus.svg new file mode 100644 index 0000000000..3d30aa47b2 --- /dev/null +++ b/modules/csg/icons/icon_c_s_g_torus.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/modules/gdnative/icons/icon_g_d_native_library.svg b/modules/gdnative/icons/icon_g_d_native_library.svg new file mode 100644 index 0000000000..b494c7af6e --- /dev/null +++ b/modules/gdnative/icons/icon_g_d_native_library.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/modules/gdnative/icons/icon_native_script.svg b/modules/gdnative/icons/icon_native_script.svg new file mode 100644 index 0000000000..fb9e135627 --- /dev/null +++ b/modules/gdnative/icons/icon_native_script.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/modules/gdscript/icons/icon_g_d_script.svg b/modules/gdscript/icons/icon_g_d_script.svg new file mode 100644 index 0000000000..953bb9ae9e --- /dev/null +++ b/modules/gdscript/icons/icon_g_d_script.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/modules/gridmap/icons/icon_grid_map.svg b/modules/gridmap/icons/icon_grid_map.svg new file mode 100644 index 0000000000..eafe1211f2 --- /dev/null +++ b/modules/gridmap/icons/icon_grid_map.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/modules/opensimplex/icons/icon_noise_texture.svg b/modules/opensimplex/icons/icon_noise_texture.svg new file mode 100644 index 0000000000..5908c2b2d4 --- /dev/null +++ b/modules/opensimplex/icons/icon_noise_texture.svg @@ -0,0 +1,3 @@ + + + diff --git a/modules/visual_script/icons/icon_visual_script.svg b/modules/visual_script/icons/icon_visual_script.svg new file mode 100644 index 0000000000..f6475d590e --- /dev/null +++ b/modules/visual_script/icons/icon_visual_script.svg @@ -0,0 +1,6 @@ + + + + + + -- cgit v1.2.3