[Bf-blender-cvs] [e736900e9a4] temp-enum-socket: Merge branch 'master' into temp-enum-socket

Jacques Lucke noreply at git.blender.org
Mon Nov 8 16:07:04 CET 2021


Commit: e736900e9a42b8225b8cd96964d269c996a894e4
Author: Jacques Lucke
Date:   Mon Nov 8 12:25:52 2021 +0100
Branches: temp-enum-socket
https://developer.blender.org/rBe736900e9a42b8225b8cd96964d269c996a894e4

Merge branch 'master' into temp-enum-socket

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



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

diff --cc source/blender/blenkernel/BKE_node.h
index 778cf45f184,645b4410623..eb079f54ef9
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@@ -741,8 -735,9 +741,10 @@@ void nodeSetSocketAvailability(struct b
  
  int nodeSocketLinkLimit(const struct bNodeSocket *sock);
  
- void nodeDeclarationEnsure(struct bNodeTree *ntree, struct bNode *node);
 +void nodeUpdateFromDeclaration(struct bNodeTree *ntree, struct bNode *node);
+ bool nodeDeclarationEnsure(struct bNodeTree *ntree, struct bNode *node);
+ bool nodeDeclarationEnsureOnOutdatedNode(struct bNodeTree *ntree, struct bNode *node);
+ void nodeSocketDeclarationsUpdate(struct bNode *node);
  
  /* Node Clipboard */
  void BKE_node_clipboard_init(const struct bNodeTree *ntree);
diff --cc source/blender/blenkernel/intern/node.cc
index 41253783a06,60a9ce48a0a..86b01991165
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@@ -695,11 -681,7 +695,11 @@@ static void direct_link_node_socket(Ble
    BLO_read_data_address(reader, &sock->default_value);
    sock->total_inputs = 0; /* Clear runtime data set before drawing. */
    sock->cache = nullptr;
- 
+   sock->declaration = nullptr;
 +  if (sock->type == SOCK_ENUM) {
 +    bNodeSocketValueEnum *socket_value = (bNodeSocketValueEnum *)sock->default_value;
 +    socket_value->items = nullptr;
 +  }
  }
  
  /* ntree itself has been read! */
@@@ -4080,18 -4061,22 +4100,32 @@@ bool nodeDeclarationEnsureOnOutdatedNod
      BLI_assert(node->typeinfo->fixed_declaration != nullptr);
      node->declaration = node->typeinfo->fixed_declaration;
    }
+   return true;
+ }
+ 
+ /**
+  * If the node implements a `declare` function, this function makes sure that `node->declaration`
+  * is up to date. It is expected that the sockets of the node are up to date already.
+  */
+ bool nodeDeclarationEnsure(bNodeTree *ntree, bNode *node)
+ {
+   if (nodeDeclarationEnsureOnOutdatedNode(ntree, node)) {
+     nodeSocketDeclarationsUpdate(node);
+     return true;
+   }
+   return false;
  }
  
 +void nodeUpdateFromDeclaration(bNodeTree *ntree, bNode *node)
 +{
 +  if (!node->typeinfo->declaration_is_dynamic) {
 +    return;
 +  }
 +  delete node->declaration;
 +  node->declaration = nullptr;
 +  node_verify_sockets(ntree, node, true);
 +}
 +
  /* ************** Node Clipboard *********** */
  
  #define USE_NODE_CB_VALIDATE



More information about the Bf-blender-cvs mailing list