[Bf-blender-cvs] [7fcf2ad5430] temp-geometry-nodes-expandable-geometry-socket-prototype: handle node rename
Jacques Lucke
noreply at git.blender.org
Wed Aug 4 17:10:49 CEST 2021
Commit: 7fcf2ad543030f6e86b4e8b2ea01764f8ba35042
Author: Jacques Lucke
Date: Wed Aug 4 17:09:20 2021 +0200
Branches: temp-geometry-nodes-expandable-geometry-socket-prototype
https://developer.blender.org/rB7fcf2ad543030f6e86b4e8b2ea01764f8ba35042
handle node rename
===================================================================
M source/blender/makesrna/intern/rna_nodetree.c
M source/blender/nodes/geometry/nodes/node_geo_geometry_expander.cc
===================================================================
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index ca972989413..82f6a77af77 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -2456,6 +2456,26 @@ static void rna_Node_name_set(PointerRNA *ptr, const char *value)
nodeUniqueName(ntree, node);
+ LISTBASE_FOREACH (bNode *, other_node, &ntree->nodes) {
+ if (other_node->type != GEO_NODE_GEOMETRY_EXPANDER) {
+ continue;
+ }
+ NodeGeometryGeometryExpander *storage = (NodeGeometryGeometryExpander *)other_node->storage;
+ LISTBASE_FOREACH (GeometryExpanderOutput *, expander_output, &storage->outputs) {
+ if (expander_output->type != GEOMETRY_EXPANDER_OUTPUT_TYPE_LOCAL) {
+ continue;
+ }
+ if (STREQ(expander_output->local_node_name, oldname)) {
+ STRNCPY(expander_output->local_node_name, node->name);
+ BLI_snprintf(expander_output->socket_name,
+ sizeof(expander_output->socket_name),
+ "%s ▶ %s",
+ node->name,
+ expander_output->local_socket_identifier);
+ }
+ }
+ }
+
/* fix all the animation data which may link to this */
BKE_animdata_fix_paths_rename_all(NULL, "nodes", oldname, node->name);
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_geometry_expander.cc b/source/blender/nodes/geometry/nodes/node_geo_geometry_expander.cc
index ad774f00825..5857c1d5ec0 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_geometry_expander.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_geometry_expander.cc
@@ -61,7 +61,7 @@ static bool geo_node_geometry_expander_socket_layout(const bContext *UNUSED(C),
uiLayout *row = uiLayoutRow(layout, true);
uiLayout *split = uiLayoutSplit(row, 0.7, false);
- uiItemL(split, socket->name, ICON_NONE);
+ uiItemL(split, expander_output->socket_name, ICON_NONE);
uiItemR(split, &expander_output_ptr, "domain", 0, "", ICON_NONE);
return true;
@@ -154,6 +154,9 @@ static void geo_node_geometry_expander_update(bNodeTree *ntree, bNode *node)
static void geo_node_geometry_expander_storage_free(bNode *node)
{
NodeGeometryGeometryExpander *storage = (NodeGeometryGeometryExpander *)node->storage;
+ LISTBASE_FOREACH_MUTABLE (GeometryExpanderOutput *, output, &storage->outputs) {
+ MEM_freeN(output);
+ }
MEM_freeN(storage);
}
More information about the Bf-blender-cvs
mailing list