Include node name for socket animation channel UI

The channel names were often indistingushable in animation editors.
Now include the node _name_ (unfortunately, getting the _label_ could
result in bad performance in some circustances -- see previous version
of D13085).
Similar to what rB77744b581d08 did for some VSE strip properties.

ref. T91917

Maniphest Tasks: T91917

Differential Revision: https://developer.blender.org/D13085
This commit is contained in:
Philipp Oeser 2021-11-03 12:05:43 +01:00
parent 2a88343213
commit 8b516d8712
Notes: blender-bot 2023-02-14 11:29:52 +01:00
Referenced by issue #92979, keys on shader attributes get disconnected each time a Blender scene is closed.
Referenced by issue #91917, Animated Values in Node Trees and Geometry Nodes Modifier are not distinguishable
Referenced by issue #91917, Animated Values in Node Trees and Geometry Nodes Modifier are not distinguishable
1 changed files with 16 additions and 0 deletions

View File

@ -145,6 +145,22 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
}
}
}
/* For node sockets, it is useful to include the node name as well (multiple similar nodes
* are not distinguishable otherwise). Unfortunately, the node label cannot be retrieved
* from the rna path, for this to work access to the underlying node is needed (but finding
* the node iterates all nodes & sockets which would result in bad performance in some
* circumstances). */
if (RNA_struct_is_a(ptr.type, &RNA_NodeSocket)) {
char nodename[256];
if (BLI_str_quoted_substr(fcu->rna_path, "nodes[", nodename, sizeof(nodename))) {
const char *structname_all = BLI_sprintfN("%s : %s", nodename, structname);
if (free_structname) {
MEM_freeN((void *)structname);
}
structname = structname_all;
free_structname = 1;
}
}
}
/* Property Name is straightforward */