Changeset View
Standalone View
source/blender/blenloader/intern/versioning_300.c
| Show First 20 Lines • Show All 1,272 Lines • ▼ Show 20 Lines | LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { | ||||
| if (node->type != GEO_NODE_SET_POSITION) { | if (node->type != GEO_NODE_SET_POSITION) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| bNodeSocket *old_offset_socket = BLI_findlink(&node->inputs, 3); | bNodeSocket *old_offset_socket = BLI_findlink(&node->inputs, 3); | ||||
| nodeRemoveSocket(ntree, node, old_offset_socket); | nodeRemoveSocket(ntree, node, old_offset_socket); | ||||
| } | } | ||||
| } | } | ||||
| static void version_geometry_nodes_link_fillet_curves_radius(bNodeTree *ntree) | |||||
| { | |||||
| LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { | |||||
| if (node->type != GEO_NODE_FILLET_CURVE) { | |||||
| continue; | |||||
| } | |||||
HooglyBoogly: It can be helpful to add a check like this so the versioning code doesn't do anything bad even… | |||||
| if (nodeFindSocket(node, SOCK_IN, "Selection") != NULL) { | |||||
Done Inline Actions/home/hans/Blender-Git/blender/source/blender/blenloader/intern/versioning_300.cc:1955:33: warning: unused variable ‘mode’ [-Wunused-variable]
1955 | GeometryNodeCurveFilletMode mode = GeometryNodeCurveFilletMode(storage.mode);
| ^~~~HooglyBoogly: ```
/home/hans/Blender-Git/blender/source/blender/blenloader/intern/versioning_300.cc:1955:33… | |||||
Done Inline ActionsOops thanks for catching it. Not sure why IDE didn't help me with that. Time to look into my IDE setup... :P yemount: Oops thanks for catching it. Not sure why IDE didn't help me with that. Time to look into my… | |||||
| // If the fillet curve node already has a Selection input socket, skip. | |||||
| continue; | |||||
| } | |||||
| // Wire the input of the radius socket (if one exists) to the selection socket. | |||||
HooglyBooglyUnsubmitted Not Done Inline ActionsComment formatting: https://wiki.blender.org/wiki/Style_Guide/C_Cpp#Comments HooglyBoogly: Comment formatting: https://wiki.blender.org/wiki/Style_Guide/C_Cpp#Comments | |||||
| bNodeSocket *old_radius_socket = nodeFindSocket(node, SOCK_IN, "Radius"); | |||||
| bNodeSocket *new_selection_socket = nodeAddSocket( | |||||
| ntree, node, SOCK_IN, nodeStaticSocketType(SOCK_BOOLEAN, PROP_NONE), | |||||
Done Inline ActionsI don't know how to test the versioning behavior, so not sure this is doing the right thing... Specifically,
yemount: I don't know how to test the versioning behavior, so not sure this is doing the right thing... | |||||
Done Inline ActionsGenerally I create a file with all of the inputs plugged into other nodes in an old version.
No, it doesn't the sockets are always there, just hidden. It's a bit weird.
Yes, definitely! I'd recommend nodeFindSocket. HooglyBoogly: Generally I create a file with all of the inputs plugged into other nodes in an old version. | |||||
Done Inline ActionsNiice thanks for the steps! Tried it out and seems to be working. The input to the radius socket in an older version now connects to radius and selection sockets. yemount: Niice thanks for the steps! Tried it out and seems to be working. The input to the radius… | |||||
| "Selection", "Selection"); | |||||
| if (old_radius_socket != NULL && old_radius_socket->link != NULL && | |||||
| old_radius_socket->link->fromnode != NULL && old_radius_socket->link->fromsock != NULL && | |||||
| new_selection_socket != NULL) { | |||||
| nodeAddLink(ntree, | |||||
| old_radius_socket->link->fromnode, | |||||
| old_radius_socket->link->fromsock, | |||||
| node, | |||||
| new_selection_socket); | |||||
| } | |||||
| } | |||||
| } | |||||
| static void version_node_tree_socket_id_delim(bNodeTree *ntree) | static void version_node_tree_socket_id_delim(bNodeTree *ntree) | ||||
| { | { | ||||
| LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { | LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { | ||||
| LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) { | LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) { | ||||
| version_node_socket_id_delim(socket); | version_node_socket_id_delim(socket); | ||||
| } | } | ||||
| LISTBASE_FOREACH (bNodeSocket *, socket, &node->outputs) { | LISTBASE_FOREACH (bNodeSocket *, socket, &node->outputs) { | ||||
| version_node_socket_id_delim(socket); | version_node_socket_id_delim(socket); | ||||
| ▲ Show 20 Lines • Show All 2,074 Lines • ▼ Show 20 Lines | */ | ||||
| /* Convert mix rgb node to new mix node and add storage. */ | /* Convert mix rgb node to new mix node and add storage. */ | ||||
| { | { | ||||
| FOREACH_NODETREE_BEGIN (bmain, ntree, id) { | FOREACH_NODETREE_BEGIN (bmain, ntree, id) { | ||||
| versioning_replace_legacy_mix_rgb_node(ntree); | versioning_replace_legacy_mix_rgb_node(ntree); | ||||
| } | } | ||||
| FOREACH_NODETREE_END; | FOREACH_NODETREE_END; | ||||
| } | } | ||||
| { | |||||
| /* Connect the radius input of older fillet curve nodes to the new selection input. */ | |||||
| FOREACH_NODETREE_BEGIN (bmain, ntree, id) { | |||||
| if (ntree->type == NTREE_GEOMETRY) { | |||||
| version_geometry_nodes_link_fillet_curves_radius(ntree); | |||||
| } | |||||
| } | |||||
| FOREACH_NODETREE_END; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
It can be helpful to add a check like this so the versioning code doesn't do anything bad even if it ends up running twice somehow.
if (nodeFindSocket(node, SOCK_IN, "Selection")) { continue; }