From 8b516d8712024af9380fe3f7559c336042d612f5 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Wed, 3 Nov 2021 12:05:43 +0100 Subject: 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 --- source/blender/editors/animation/anim_ipo_utils.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source/blender/editors') diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c index 6fe32699907..05837ed17b9 100644 --- a/source/blender/editors/animation/anim_ipo_utils.c +++ b/source/blender/editors/animation/anim_ipo_utils.c @@ -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 */ -- cgit v1.2.3