[Bf-blender-cvs] [ee9154fd289] studio-sprite-fright: Nodes: fix incorrect id socket update

Jacques Lucke noreply at git.blender.org
Tue Sep 7 12:31:59 CEST 2021


Commit: ee9154fd289c698d6c550cc854bc6c92abe5b318
Author: Jacques Lucke
Date:   Mon Sep 6 17:21:27 2021 +0200
Branches: studio-sprite-fright
https://developer.blender.org/rBee9154fd289c698d6c550cc854bc6c92abe5b318

Nodes: fix incorrect id socket update

The issue was that the entire socket was rebuild, even though
only its `SOCK_HIDE_LABEL` flag changed. This broke e.g.
Object sockets from old files.

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

M	source/blender/nodes/NOD_socket_declarations.hh

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

diff --git a/source/blender/nodes/NOD_socket_declarations.hh b/source/blender/nodes/NOD_socket_declarations.hh
index 639d2c12d73..1a5873c37b5 100644
--- a/source/blender/nodes/NOD_socket_declarations.hh
+++ b/source/blender/nodes/NOD_socket_declarations.hh
@@ -199,6 +199,20 @@ template<typename Subtype> class IDSocketDeclaration : public SocketDeclaration
   {
     return matches_id_socket(socket, data_, name_, identifier_);
   }
+
+  bNodeSocket &update_or_build(bNodeTree &ntree, bNode &node, bNodeSocket &socket) const override
+  {
+    if (StringRef(socket.idname) != data_.idname) {
+      return this->build(ntree, node, (eNodeSocketInOut)socket.in_out);
+    }
+    if (data_.hide_label) {
+      socket.flag |= SOCK_HIDE_LABEL;
+    }
+    else {
+      socket.flag &= ~SOCK_HIDE_LABEL;
+    }
+    return socket;
+  }
 };
 }  // namespace detail



More information about the Bf-blender-cvs mailing list