Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-04-01 15:36:44 +0300
committerJacques Lucke <jacques@blender.org>2021-04-01 15:39:12 +0300
commitb00727950c28c31563426ea3c8c745b2c67e042d (patch)
tree996da96008edf2bd7f38d2fad5ca48707b0274f0 /source/blender/editors/space_node/space_node.c
parent1bdceb813ccb9690e5746731038e7f0ce92ed134 (diff)
Nodes: separate node name and display name in bNodeTreePath
Previously, `node_name` was rarely actually a name of a node. It is set correctly as node name in `ED_node_tree_push`. However, later on it was overwritten by the name of an id data block in `node_draw_space`. Now, the node_name stays the name of the "parent" node. Whereas display_name is the name that will be displayed in the breadcrumbs. With this change, the `node_name` can be used to reconstruct the actual path from the root node tree to the currently visible tree. Differential Revision: https://developer.blender.org/D10874
Diffstat (limited to 'source/blender/editors/space_node/space_node.c')
-rw-r--r--source/blender/editors/space_node/space_node.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index 5d14919502e..f20a9409d90 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -74,7 +74,7 @@ void ED_node_tree_start(SpaceNode *snode, bNodeTree *ntree, ID *id, ID *from)
copy_v2_v2(path->view_center, ntree->view_center);
if (id) {
- BLI_strncpy(path->node_name, id->name + 2, sizeof(path->node_name));
+ BLI_strncpy(path->display_name, id->name + 2, sizeof(path->display_name));
}
BLI_addtail(&snode->treepath, path);
@@ -111,6 +111,7 @@ void ED_node_tree_push(SpaceNode *snode, bNodeTree *ntree, bNode *gnode)
}
BLI_strncpy(path->node_name, gnode->name, sizeof(path->node_name));
+ BLI_strncpy(path->display_name, gnode->name, sizeof(path->display_name));
}
else {
path->parent_key = NODE_INSTANCE_KEY_BASE;
@@ -175,7 +176,7 @@ int ED_node_tree_path_length(SpaceNode *snode)
int length = 0;
int i = 0;
LISTBASE_FOREACH_INDEX (bNodeTreePath *, path, &snode->treepath, i) {
- length += strlen(path->node_name);
+ length += strlen(path->display_name);
if (i > 0) {
length += 1; /* for separator char */
}
@@ -190,12 +191,12 @@ void ED_node_tree_path_get(SpaceNode *snode, char *value)
value[0] = '\0';
LISTBASE_FOREACH_INDEX (bNodeTreePath *, path, &snode->treepath, i) {
if (i == 0) {
- strcpy(value, path->node_name);
- value += strlen(path->node_name);
+ strcpy(value, path->display_name);
+ value += strlen(path->display_name);
}
else {
- sprintf(value, "/%s", path->node_name);
- value += strlen(path->node_name) + 1;
+ sprintf(value, "/%s", path->display_name);
+ value += strlen(path->display_name) + 1;
}
}
}
@@ -208,10 +209,10 @@ void ED_node_tree_path_get_fixedbuf(SpaceNode *snode, char *value, int max_lengt
int i = 0;
LISTBASE_FOREACH_INDEX (bNodeTreePath *, path, &snode->treepath, i) {
if (i == 0) {
- size = BLI_strncpy_rlen(value, path->node_name, max_length);
+ size = BLI_strncpy_rlen(value, path->display_name, max_length);
}
else {
- size = BLI_snprintf_rlen(value, max_length, "/%s", path->node_name);
+ size = BLI_snprintf_rlen(value, max_length, "/%s", path->display_name);
}
max_length -= size;
if (max_length <= 0) {