Nodes: show node labels (like image name) in material properties node view.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 19 Feb 2018 13:39:27 +0000 (14:39 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Sun, 6 May 2018 17:28:23 +0000 (19:28 +0200)
source/blender/editors/space_node/node_templates.c

index 173c919e38cbb8be4f40b9f7f58cae2a993f53a5..fcfde6f87bfe991d29408544cc4ead4331aedbc3 100644 (file)
@@ -386,20 +386,13 @@ static void ui_node_link(bContext *C, void *arg_p, void *event_p)
        ED_undo_push(C, "Node input modify");
 }
 
-static void ui_node_sock_name(bNodeSocket *sock, char name[UI_MAX_NAME_STR])
+static void ui_node_sock_name(bNodeTree *ntree, bNodeSocket *sock, char name[UI_MAX_NAME_STR])
 {
        if (sock->link && sock->link->fromnode) {
                bNode *node = sock->link->fromnode;
                char node_name[UI_MAX_NAME_STR];
 
-               if (node->type == NODE_GROUP) {
-                       if (node->id)
-                               BLI_strncpy(node_name, node->id->name + 2, UI_MAX_NAME_STR);
-                       else
-                               BLI_strncpy(node_name, N_(node->typeinfo->ui_name), UI_MAX_NAME_STR);
-               }
-               else
-                       BLI_strncpy(node_name, node->typeinfo->ui_name, UI_MAX_NAME_STR);
+               nodeLabel(ntree, node, node_name, sizeof(node_name));
 
                if (BLI_listbase_is_empty(&node->inputs) &&
                    node->outputs.first != node->outputs.last)
@@ -612,7 +605,7 @@ void uiTemplateNodeLink(uiLayout *layout, bNodeTree *ntree, bNode *node, bNodeSo
 
        if (sock->link || sock->type == SOCK_SHADER || (sock->flag & SOCK_HIDE_VALUE)) {
                char name[UI_MAX_NAME_STR];
-               ui_node_sock_name(sock, name);
+               ui_node_sock_name(ntree, sock, name);
                but = uiDefMenuBut(block, ui_template_node_link_menu, NULL, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, "");
        }
        else