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.
This commit is contained in:
Jacques Lucke 2022-12-11 14:15:46 +01:00
parent f6b67f92a1
commit c2ca30ea24
1 changed files with 14 additions and 5 deletions

View File

@ -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;