[Bf-blender-cvs] [66e9ee1a2f3] master: Cleanup: Remove unused "init" node tree flag

Hans Goudey noreply at git.blender.org
Fri Feb 4 19:51:35 CET 2022


Commit: 66e9ee1a2f3daef4030b2b7d44fd6bea592e8b78
Author: Hans Goudey
Date:   Fri Feb 4 12:50:46 2022 -0600
Branches: master
https://developer.blender.org/rB66e9ee1a2f3daef4030b2b7d44fd6bea592e8b78

Cleanup: Remove unused "init" node tree flag

The value of this flag was set, but not used anywhere.

Differential Revision: https://developer.blender.org/D13519

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

M	source/blender/blenkernel/intern/node.cc
M	source/blender/makesdna/DNA_node_types.h

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

diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc
index 0677b1adb6d..a1c10a733ce 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -648,7 +648,6 @@ static void ntree_blend_write(BlendWriter *writer, ID *id, const void *id_addres
   bNodeTree *ntree = (bNodeTree *)id;
 
   /* Clean up, important in undo case to reduce false detection of changed datablocks. */
-  ntree->init = 0; /* to set callbacks and force setting types */
   ntree->is_updating = false;
   ntree->typeinfo = nullptr;
   ntree->interface_type = nullptr;
@@ -677,7 +676,6 @@ static void direct_link_node_socket(BlendDataReader *reader, bNodeSocket *sock)
 void ntreeBlendReadData(BlendDataReader *reader, bNodeTree *ntree)
 {
   /* NOTE: writing and reading goes in sync, for speed. */
-  ntree->init = 0; /* to set callbacks and force setting types */
   ntree->is_updating = false;
   ntree->typeinfo = nullptr;
   ntree->interface_type = nullptr;
@@ -1145,8 +1143,6 @@ static void ntree_set_typeinfo(bNodeTree *ntree, bNodeTreeType *typeinfo)
   }
   else {
     ntree->typeinfo = &NodeTreeTypeUndefined;
-
-    ntree->init &= ~NTREE_TYPE_INIT;
   }
 
   /* Deprecated integer type. */
@@ -1177,8 +1173,6 @@ static void node_set_typeinfo(const struct bContext *C,
   }
   else {
     node->typeinfo = &NodeTypeUndefined;
-
-    ntree->init &= ~NTREE_TYPE_INIT;
   }
 }
 
@@ -1199,8 +1193,6 @@ static void node_socket_set_typeinfo(bNodeTree *ntree,
   }
   else {
     sock->typeinfo = &NodeSocketTypeUndefined;
-
-    ntree->init &= ~NTREE_TYPE_INIT;
   }
   BKE_ntree_update_tag_socket_type(ntree, sock);
 }
@@ -1218,8 +1210,6 @@ static void update_typeinfo(Main *bmain,
   }
 
   FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
-    ntree->init |= NTREE_TYPE_INIT;
-
     if (treetype && STREQ(ntree->idname, treetype->idname)) {
       ntree_set_typeinfo(ntree, unregister ? nullptr : treetype);
     }
@@ -1260,8 +1250,6 @@ static void update_typeinfo(Main *bmain,
 
 void ntreeSetTypes(const struct bContext *C, bNodeTree *ntree)
 {
-  ntree->init |= NTREE_TYPE_INIT;
-
   ntree_set_typeinfo(ntree, ntreeTypeFind(ntree->idname));
 
   LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
@@ -2674,11 +2662,6 @@ bNodeTree *ntreeAddTree(Main *bmain, const char *name, const char *idname)
     ntree->id.flag |= LIB_EMBEDDED_DATA;
   }
 
-  /* Types are fully initialized at this point,
-   * if an undefined node is added later this will be reset.
-   */
-  ntree->init |= NTREE_TYPE_INIT;
-
   BLI_strncpy(ntree->idname, idname, sizeof(ntree->idname));
   ntree_set_typeinfo(ntree, ntreeTypeFind(idname));
 
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 2bfd2e71eb7..fd77e8b9f1d 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -514,8 +514,10 @@ typedef struct bNodeTree {
   /** Information about how inputs and outputs of the node group interact with fields. */
   FieldInferencingInterfaceHandle *field_inferencing_interface;
 
-  /** Set init on fileread. */
-  int type, init;
+  int type;
+
+  char _pad1[4];
+
   /**
    * Sockets in groups have unique identifiers, adding new sockets always
    * will increase this counter.
@@ -599,9 +601,6 @@ typedef struct bNodeTree {
 #define NTREE_TEXTURE 2
 #define NTREE_GEOMETRY 3
 
-/** #NodeTree.init, flag */
-#define NTREE_TYPE_INIT 1
-
 /** #NodeTree.flag */
 #define NTREE_DS_EXPAND (1 << 0)            /* for animation editors */
 #define NTREE_COM_OPENCL (1 << 1)           /* use opencl */



More information about the Bf-blender-cvs mailing list