[Bf-blender-cvs] [fc45b007201] master: Cleanup: Define node tree icon in register function

Aaron Carlisle noreply at git.blender.org
Sat Dec 25 04:49:35 CET 2021


Commit: fc45b007201f920fb9a6c56dd7ea737626990a52
Author: Aaron Carlisle
Date:   Fri Dec 24 22:47:58 2021 -0500
Branches: master
https://developer.blender.org/rBfc45b007201f920fb9a6c56dd7ea737626990a52

Cleanup: Define node tree icon in register function

I suppose this was done to reduce then dependencies.
However, most nodes already depend on UI code so this isnt too useful.

===================================================================

M	source/blender/editors/space_node/drawnode.cc
M	source/blender/nodes/composite/node_composite_tree.cc
M	source/blender/nodes/geometry/node_geometry_tree.cc
M	source/blender/nodes/shader/CMakeLists.txt
M	source/blender/nodes/shader/node_shader_tree.c
M	source/blender/nodes/texture/node_texture_tree.c

===================================================================

diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc
index 90fd6e7d657..053f2d7e62c 100644
--- a/source/blender/editors/space_node/drawnode.cc
+++ b/source/blender/editors/space_node/drawnode.cc
@@ -1654,12 +1654,6 @@ void ED_node_init_butfuncs()
     node_template_properties_update(ntype);
   }
   NODE_TYPES_END;
-
-  /* tree type icons */
-  ntreeType_Composite->ui_icon = ICON_NODE_COMPOSITING;
-  ntreeType_Shader->ui_icon = ICON_NODE_MATERIAL;
-  ntreeType_Texture->ui_icon = ICON_NODE_TEXTURE;
-  ntreeType_Geometry->ui_icon = ICON_NODETREE;
 }
 
 void ED_init_custom_node_type(bNodeType *UNUSED(ntype))
diff --git a/source/blender/nodes/composite/node_composite_tree.cc b/source/blender/nodes/composite/node_composite_tree.cc
index d601c426319..96e6b699d8b 100644
--- a/source/blender/nodes/composite/node_composite_tree.cc
+++ b/source/blender/nodes/composite/node_composite_tree.cc
@@ -36,6 +36,8 @@
 #include "BKE_node_tree_update.h"
 #include "BKE_tracking.h"
 
+#include "UI_resources.h"
+
 #include "node_common.h"
 #include "node_util.h"
 
@@ -202,7 +204,7 @@ void register_node_tree_type_cmp()
   tt->type = NTREE_COMPOSIT;
   strcpy(tt->idname, "CompositorNodeTree");
   strcpy(tt->ui_name, N_("Compositor"));
-  tt->ui_icon = 0; /* Defined in `drawnode.c`. */
+  tt->ui_icon = ICON_NODE_COMPOSITING;
   strcpy(tt->ui_description, N_("Compositing nodes"));
 
   tt->free_cache = free_cache;
diff --git a/source/blender/nodes/geometry/node_geometry_tree.cc b/source/blender/nodes/geometry/node_geometry_tree.cc
index 89ab4d9961e..a6dec71ed06 100644
--- a/source/blender/nodes/geometry/node_geometry_tree.cc
+++ b/source/blender/nodes/geometry/node_geometry_tree.cc
@@ -32,6 +32,8 @@
 
 #include "RNA_access.h"
 
+#include "UI_resources.h"
+
 #include "node_common.h"
 
 bNodeTreeType *ntreeType_Geometry;
@@ -121,7 +123,7 @@ void register_node_tree_type_geo()
   tt->type = NTREE_GEOMETRY;
   strcpy(tt->idname, "GeometryNodeTree");
   strcpy(tt->ui_name, N_("Geometry Node Editor"));
-  tt->ui_icon = 0; /* Defined in `drawnode.c`. */
+  tt->ui_icon = ICON_NODETREE;
   strcpy(tt->ui_description, N_("Geometry nodes"));
   tt->rna_ext.srna = &RNA_GeometryNodeTree;
   tt->update = geometry_node_tree_update;
diff --git a/source/blender/nodes/shader/CMakeLists.txt b/source/blender/nodes/shader/CMakeLists.txt
index 311b7f75d00..be5e9506e22 100644
--- a/source/blender/nodes/shader/CMakeLists.txt
+++ b/source/blender/nodes/shader/CMakeLists.txt
@@ -26,6 +26,7 @@ set(INC
   ../../blenlib
   ../../blentranslation
   ../../depsgraph
+  ../../editors/include
   ../../functions
   ../../gpu
   ../../imbuf
diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c
index 8f4bffe5b30..32086bb100b 100644
--- a/source/blender/nodes/shader/node_shader_tree.c
+++ b/source/blender/nodes/shader/node_shader_tree.c
@@ -53,6 +53,8 @@
 
 #include "RE_texture.h"
 
+#include "UI_resources.h"
+
 #include "NOD_common.h"
 
 #include "node_common.h"
@@ -183,7 +185,7 @@ void register_node_tree_type_sh(void)
   tt->type = NTREE_SHADER;
   strcpy(tt->idname, "ShaderNodeTree");
   strcpy(tt->ui_name, N_("Shader Editor"));
-  tt->ui_icon = 0; /* Defined in `drawnode.c`. */
+  tt->ui_icon = ICON_NODE_MATERIAL;
   strcpy(tt->ui_description, N_("Shader nodes"));
 
   tt->foreach_nodeclass = foreach_nodeclass;
diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c
index 1125936aded..3d914d486c3 100644
--- a/source/blender/nodes/texture/node_texture_tree.c
+++ b/source/blender/nodes/texture/node_texture_tree.c
@@ -50,6 +50,8 @@
 
 #include "RE_texture.h"
 
+#include "UI_resources.h"
+
 static void texture_get_from_context(const bContext *C,
                                      bNodeTreeType *UNUSED(treetype),
                                      bNodeTree **r_ntree,
@@ -154,7 +156,7 @@ void register_node_tree_type_tex(void)
   tt->type = NTREE_TEXTURE;
   strcpy(tt->idname, "TextureNodeTree");
   strcpy(tt->ui_name, N_("Texture Node Editor"));
-  tt->ui_icon = 0; /* Defined in `drawnode.c`. */
+  tt->ui_icon = ICON_NODE_TEXTURE; /* Defined in `drawnode.c`. */
   strcpy(tt->ui_description, N_("Texture nodes"));
 
   tt->foreach_nodeclass = foreach_nodeclass;



More information about the Bf-blender-cvs mailing list