Commit: c2ca30ea24197a3d25e01f0025b2c57fa49804e9
Author: Jacques Lucke
Date:   Sun Dec 11 14:15:46 2022 +0100
Branches: master
https://developer.blender.org/rBc2ca30ea24197a3d25e01f0025b2c57fa49804e9

Cleanup: avoid calling generic node update functions from versioning code

This made it harder to change these functions in the future.

No functional changes are expected and the versioning worked correctly
in my test with a files created in Blender 2.69.

Adding the sockets in the function was not necessary in my test, because
those were already added before as part of `node_verify_sockets` in
`ntreeBlendReadLib`. I kept it in just to be on the safe side.

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

M       source/blender/blenloader/intern/versioning_270.c

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

diff --git a/source/blender/blenloader/intern/versioning_270.c 
b/source/blender/blenloader/intern/versioning_270.c
index 3885c23a422..5d966344717 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -276,13 +276,22 @@ static void do_version_hue_sat_node(bNodeTree *ntree, 
bNode *node)
     return;
   }
 
-  /* Make sure new sockets are properly created. */
-  node_verify_sockets(ntree, node, false);
   /* Convert value from old storage to new sockets. */
   NodeHueSat *nhs = node->storage;
-  bNodeSocket *hue = nodeFindSocket(node, SOCK_IN, "Hue"),
-              *saturation = nodeFindSocket(node, SOCK_IN, "Saturation"),
-              *value = nodeFindSocket(node, SOCK_IN, "Value");
+  bNodeSocket *hue = nodeFindSocket(node, SOCK_IN, "Hue");
+  bNodeSocket *saturation = nodeFindSocket(node, SOCK_IN, "Saturation");
+  bNodeSocket *value = nodeFindSocket(node, SOCK_IN, "Value");
+  if (hue == NULL) {
+    hue = nodeAddStaticSocket(ntree, node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, 
"Hue", "Hue");
+  }
+  if (saturation == NULL) {
+    saturation = nodeAddStaticSocket(
+        ntree, node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Saturation", 
"Saturation");
+  }
+  if (value == NULL) {
+    value = nodeAddStaticSocket(ntree, node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, 
"Value", "Value");
+  }
+
   ((bNodeSocketValueFloat *)hue->default_value)->value = nhs->hue;
   ((bNodeSocketValueFloat *)saturation->default_value)->value = nhs->sat;
   ((bNodeSocketValueFloat *)value->default_value)->value = nhs->val;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to