Added an optional label string to nodes. As pointed out by Sebastian Koenig, some...
[blender.git] / source / blender / editors / space_node / node_draw.c
index c5221d4583750312568e0c4a4017eb31dfc7db26..920e670573d29c364e9acfc79b060a181b915c3c 100644 (file)
@@ -804,7 +804,9 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
        else
                UI_ThemeColor(TH_TEXT); */
        
-       if (node->typeinfo->labelfunc)
+       if (node->label[0]!='\0')
+               BLI_strncpy(showname, node->label, sizeof(showname));
+       else if (node->typeinfo->labelfunc)
                BLI_strncpy(showname, node->typeinfo->labelfunc(node), sizeof(showname));
        else
                BLI_strncpy(showname, node->typeinfo->name, sizeof(showname));
@@ -948,7 +950,9 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
                UI_ThemeColor(TH_TEXT);
        
        if(node->miniwidth>0.0f) {
-               if (node->typeinfo->labelfunc)
+               if (node->label[0]!='\0')
+                       BLI_strncpy(showname, node->label, sizeof(showname));
+               else if (node->typeinfo->labelfunc)
                        BLI_strncpy(showname, node->typeinfo->labelfunc(node), sizeof(showname));
                else
                        BLI_strncpy(showname, node->typeinfo->name, sizeof(showname));