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:
-rw-r--r--source/blender/blenkernel/BKE_node.h2
-rw-r--r--source/blender/blenkernel/intern/node.c11
-rw-r--r--source/blender/editors/space_node/drawnode.c5
-rw-r--r--source/blender/editors/space_node/node_draw.c46
-rw-r--r--source/blender/editors/space_node/node_intern.h2
-rw-r--r--source/blender/makesdna/DNA_node_types.h2
-rw-r--r--source/blender/makesrna/RNA_enum_types.h5
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c121
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_filter.c1
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_math.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c1
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_math.c2
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c2
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c1
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_math.c1
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c2
-rw-r--r--source/blender/nodes/intern/node_util.c30
-rw-r--r--source/blender/nodes/intern/node_util.h5
18 files changed, 141 insertions, 100 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 32bf3d6e716..8428716ef1a 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -87,6 +87,7 @@ typedef struct bNodeType {
/* this line is set on startup of blender */
void (*uifunc)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr);
+ const char *(*labelfunc)(struct bNode *);
void (*initfunc)(struct bNode *);
void (*freestoragefunc)(struct bNode *);
@@ -218,6 +219,7 @@ void node_type_storage(struct bNodeType *ntype,
void (*copystoragefunc)(struct bNode *, struct bNode *));
void node_type_exec(struct bNodeType *ntype, void (*execfunc)(void *data, struct bNode *, struct bNodeStack **, struct bNodeStack **));
void node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out));
+void node_type_label(struct bNodeType *ntype, const char *(*labelfunc)(struct bNode *));
#define NODE_GROUP 2
#define NODE_GROUP_MENU 1000
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 16ea9856733..5a69d2a6ca3 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -268,10 +268,17 @@ void ntreeVerifyTypes(bNodeTree *ntree)
/* XXX group typeinfo struct is used directly in ntreeMakeOwnType, needs cleanup */
static bNodeType ntype_group;
+/* groups display their internal tree name as label */
+const char *group_label(bNode *node)
+{
+ return node->id->name+2;
+}
+
void register_node_type_group(ListBase *lb)
{
node_type_base(&ntype_group, NODE_GROUP, "Group", NODE_CLASS_GROUP, NODE_OPTIONS, NULL, NULL);
node_type_size(&ntype_group, 120, 60, 200);
+ node_type_label(&ntype_group, group_label);
nodeRegisterType(lb, &ntype_group);
}
@@ -3290,6 +3297,10 @@ void node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *m
ntype->gpufunc = gpufunc;
}
+void node_type_label(struct bNodeType *ntype, const char *(*labelfunc)(struct bNode *))
+{
+ ntype->labelfunc = labelfunc;
+}
static bNodeType *is_nodetype_registered(ListBase *typelist, int type, ID *id)
{
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index aea35e193b8..668a7f338f2 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -78,11 +78,6 @@
/* ****************** BUTTON CALLBACKS FOR ALL TREES ***************** */
-void node_buts_group(uiLayout *layout, bContext *C, PointerRNA *ptr)
-{
- uiTemplateIDBrowse(layout, C, ptr, "node_tree", NULL, NULL, "");
-}
-
static void node_buts_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
PointerRNA sockptr;
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index de0616f791e..10697f88173 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -45,6 +45,7 @@
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_main.h"
+#include "BKE_node.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
@@ -264,10 +265,6 @@ static void node_update(const bContext *C, bNodeTree *ntree, bNode *node)
BLI_unlock_thread(LOCK_PREVIEW);
}
- /* XXX ugly hack, typeinfo for group is generated */
- if(node->type == NODE_GROUP)
- node->typeinfo->uifunc= node_buts_group;
-
/* buttons rect? */
if((node->flag & NODE_OPTIONS) && node->typeinfo->uifunc) {
dy-= NODE_DYS/2;
@@ -721,11 +718,10 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
else
UI_ThemeColor(TH_TEXT); */
- if(node->flag & NODE_CUSTOM_NAME)
- BLI_strncpy(showname, node->name, sizeof(showname));
+ if (node->typeinfo->labelfunc)
+ BLI_strncpy(showname, node->typeinfo->labelfunc(node), sizeof(showname));
else
- /* todo: auto name display for node types */
- BLI_strncpy(showname, node->name, sizeof(showname));
+ BLI_strncpy(showname, node->typeinfo->name, sizeof(showname));
//if(node->flag & NODE_MUTED)
// sprintf(showname, "[%s]", showname);
@@ -894,14 +890,11 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
UI_ThemeColor(TH_TEXT);
if(node->miniwidth>0.0f) {
-
-
- if(node->flag & NODE_CUSTOM_NAME)
- BLI_strncpy(showname, node->name, sizeof(showname));
+ if (node->typeinfo->labelfunc)
+ BLI_strncpy(showname, node->typeinfo->labelfunc(node), sizeof(showname));
else
- /* todo: auto name display */
- BLI_strncpy(showname, node->name, sizeof(showname));
-
+ BLI_strncpy(showname, node->typeinfo->name, sizeof(showname));
+
//if(node->flag & NODE_MUTED)
// sprintf(showname, "[%s]", showname);
@@ -1012,18 +1005,19 @@ static void node_draw_group_links(View2D *v2d, SpaceNode *snode, bNode *gnode)
}
/* groups are, on creation, centered around 0,0 */
-static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bNode *gnode)
+static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *gnode)
{
bNodeTree *ngroup= (bNodeTree *)gnode->id;
bNodeSocket *sock;
rctf rect= gnode->totr;
- char showname[128];
+ uiLayout *layout;
+ PointerRNA ptr;
/* backdrop header */
glEnable(GL_BLEND);
uiSetRoundBox(3);
UI_ThemeColorShadeAlpha(TH_NODE_GROUP, 0, -70);
- uiDrawBox(GL_POLYGON, rect.xmin, rect.ymax, rect.xmax, rect.ymax+NODE_DY, BASIS_RAD);
+ uiDrawBox(GL_POLYGON, rect.xmin, rect.ymax, rect.xmax, rect.ymax+26, BASIS_RAD);
/* backdrop body */
UI_ThemeColorShadeAlpha(TH_BACK, -8, -70);
@@ -1034,21 +1028,19 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
uiSetRoundBox(15);
glColor4ub(200, 200, 200, 140);
glEnable( GL_LINE_SMOOTH );
- uiDrawBox(GL_LINE_LOOP, rect.xmin, rect.ymin, rect.xmax, rect.ymax+NODE_DY, BASIS_RAD);
+ uiDrawBox(GL_LINE_LOOP, rect.xmin, rect.ymin, rect.xmax, rect.ymax+26, BASIS_RAD);
glDisable( GL_LINE_SMOOTH );
glDisable(GL_BLEND);
/* backdrop title */
UI_ThemeColor(TH_TEXT_HI);
- if (gnode->flag & NODE_CUSTOM_NAME)
- BLI_strncpy(showname, gnode->name, sizeof(showname));
- else
- BLI_strncpy(showname, ngroup->id.name+2, sizeof(showname));
-
+ layout = uiBlockLayout(gnode->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, (short)(rect.xmin+15), (short)(rect.ymax+23),
+ MIN2((int)(rect.xmax - rect.xmin-18.0f), 140), 20, U.uistyles.first);
+ RNA_pointer_create(&ntree->id, &RNA_Node, gnode, &ptr);
+ uiTemplateIDBrowse(layout, (bContext*)C, &ptr, "node_tree", NULL, NULL, NULL);
+ uiBlockLayoutResolve(gnode->block, NULL, NULL);
- uiDefBut(gnode->block, LABEL, 0, showname, (short)(rect.xmin+15), (short)(rect.ymax),
- (int)(rect.xmax - rect.xmin-18.0f), NODE_DY, NULL, 0, 0, 0, 0, "");
uiEndBlock(C, gnode->block);
uiDrawBlock(C, gnode->block);
gnode->block= NULL;
@@ -1128,7 +1120,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
/* active group */
for(node= snode->nodetree->nodes.first; node; node= node->next) {
if(node->flag & NODE_GROUP_EDIT)
- node_draw_group(C, ar, snode, node);
+ node_draw_group(C, ar, snode, snode->nodetree, node);
}
}
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index 5d67eb77e28..831e157deef 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -73,8 +73,6 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa
void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage);
void draw_nodespace_color_info(ARegion *ar, int channels, int x, int y, char *cp, float *fp);
-void node_buts_group(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr);
-
/* node_edit.c */
void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *treetype);
void snode_notify(bContext *C, SpaceNode *snode);
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index fe422bfa689..0d7edbbce97 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -149,7 +149,7 @@ typedef struct bNode {
#define NODE_TEST 256
/* composite: don't do node but pass on buffer(s) */
#define NODE_MUTED 512
-#define NODE_CUSTOM_NAME 1024
+#define NODE_CUSTOM_NAME 1024 /* deprecated! */
typedef struct bNodeLink {
struct bNodeLink *next, *prev;
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index 70c63b99d71..722facf4ea8 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -96,6 +96,11 @@ extern EnumPropertyItem property_unit_items[];
extern EnumPropertyItem viewport_shade_items[];
+extern EnumPropertyItem node_blend_type_items[];
+extern EnumPropertyItem node_math_items[];
+extern EnumPropertyItem node_vec_math_items[];
+extern EnumPropertyItem node_filter_items[];
+
struct bContext;
struct PointerRNA;
EnumPropertyItem *rna_TransformOrientation_itemf(struct bContext *C, struct PointerRNA *ptr, int *free);
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 5c962145c55..8ce2489f286 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -47,6 +47,66 @@
#include "MEM_guardedalloc.h"
+EnumPropertyItem node_blend_type_items[] = {
+{ 0, "MIX", 0, "Mix", ""},
+{ 1, "ADD", 0, "Add", ""},
+{ 3, "SUBTRACT", 0, "Subtract", ""},
+{ 2, "MULTIPLY", 0, "Multiply", ""},
+{ 4, "SCREEN", 0, "Screen", ""},
+{ 9, "OVERLAY", 0, "Overlay", ""},
+{ 5, "DIVIDE", 0, "Divide", ""},
+{ 6, "DIFFERENCE", 0, "Difference", ""},
+{ 7, "DARKEN", 0, "Darken", ""},
+{ 8, "LIGHTEN", 0, "Lighten", ""},
+{10, "DODGE", 0, "Dodge", ""},
+{11, "BURN", 0, "Burn", ""},
+{15, "COLOR", 0, "Color", ""},
+{14, "VALUE", 0, "Value", ""},
+{13, "SATURATION", 0, "Saturation", ""},
+{12, "HUE", 0, "Hue", ""},
+{16, "SOFT_LIGHT", 0, "Soft Light", ""},
+{17, "LINEAR_LIGHT", 0, "Linear Light",""},
+{0, NULL, 0, NULL, NULL}};
+
+EnumPropertyItem node_math_items[] = {
+{ 0, "ADD", 0, "Add", ""},
+{ 1, "SUBTRACT", 0, "Subtract", ""},
+{ 2, "MULTIPLY", 0, "Multiply", ""},
+{ 3, "DIVIDE", 0, "Divide", ""},
+{ 4, "SINE", 0, "Sine", ""},
+{ 5, "COSINE", 0, "Cosine", ""},
+{ 6, "TANGENT", 0, "Tangent", ""},
+{ 7, "ARCSINE", 0, "Arcsine", ""},
+{ 8, "ARCCOSINE", 0, "Arccosine", ""},
+{ 9, "ARCTANGENT", 0, "Arctangent", ""},
+{10, "POWER", 0, "Power", ""},
+{11, "LOGARITHM", 0, "Logarithm", ""},
+{12, "MINIMUM", 0, "Minimum", ""},
+{13, "MAXIMUM", 0, "Maximum", ""},
+{14, "ROUND", 0, "Round", ""},
+{15, "LESS_THAN", 0, "Less Than", ""},
+{16, "GREATER_THAN", 0, "Greater Than", ""},
+{0, NULL, 0, NULL, NULL}};
+
+EnumPropertyItem node_vec_math_items[] = {
+{0, "ADD", 0, "Add", ""},
+{1, "SUBTRACT", 0, "Subtract", ""},
+{2, "AVERAGE", 0, "Average", ""},
+{3, "DOT_PRODUCT", 0, "Dot Product", ""},
+{4, "CROSS_PRODUCT", 0, "Cross Product", ""},
+{5, "NORMALIZE", 0, "Normalize", ""},
+{0, NULL, 0, NULL, NULL}};
+
+EnumPropertyItem node_filter_items[] = {
+{0, "SOFTEN", 0, "Soften", ""},
+{1, "SHARPEN", 0, "Sharpen", ""},
+{2, "LAPLACE", 0, "Laplace", ""},
+{3, "SOBEL", 0, "Sobel", ""},
+{4, "PREWITT", 0, "Prewitt", ""},
+{5, "KIRSCH", 0, "Kirsch", ""},
+{6, "SHADOW", 0, "Shadow", ""},
+{0, NULL, 0, NULL, NULL}};
+
#ifdef RNA_RUNTIME
#include "BLI_linklist.h"
@@ -230,7 +290,6 @@ static void rna_Node_name_set(PointerRNA *ptr, const char *value)
BLI_strncpy(node->name, value, sizeof(node->name));
nodeUniqueName(ntree, node);
- node->flag |= NODE_CUSTOM_NAME;
/* fix all the animation data which may link to this */
BKE_all_animdata_fix_paths_rename("nodes", oldname, node->name);
@@ -567,72 +626,12 @@ static EnumPropertyItem prop_tri_channel_items[] = {
{ 3, "B", 0, "B", ""},
{0, NULL, 0, NULL, NULL}};
-static EnumPropertyItem node_blend_type_items[] = {
-{ 0, "MIX", 0, "Mix", ""},
-{ 1, "ADD", 0, "Add", ""},
-{ 3, "SUBTRACT", 0, "Subtract", ""},
-{ 2, "MULTIPLY", 0, "Multiply", ""},
-{ 4, "SCREEN", 0, "Screen", ""},
-{ 9, "OVERLAY", 0, "Overlay", ""},
-{ 5, "DIVIDE", 0, "Divide", ""},
-{ 6, "DIFFERENCE", 0, "Difference", ""},
-{ 7, "DARKEN", 0, "Darken", ""},
-{ 8, "LIGHTEN", 0, "Lighten", ""},
-{10, "DODGE", 0, "Dodge", ""},
-{11, "BURN", 0, "Burn", ""},
-{15, "COLOR", 0, "Color", ""},
-{14, "VALUE", 0, "Value", ""},
-{13, "SATURATION", 0, "Saturation", ""},
-{12, "HUE", 0, "Hue", ""},
-{16, "SOFT_LIGHT", 0, "Soft Light", ""},
-{17, "LINEAR_LIGHT", 0, "Linear Light",""},
-{0, NULL, 0, NULL, NULL}};
-
static EnumPropertyItem node_flip_items[] = {
{0, "X", 0, "Flip X", ""},
{1, "Y", 0, "Flip Y", ""},
{2, "XY", 0, "Flip X & Y", ""},
{0, NULL, 0, NULL, NULL}};
-static EnumPropertyItem node_math_items[] = {
-{ 0, "ADD", 0, "Add", ""},
-{ 1, "SUBTRACT", 0, "Subtract", ""},
-{ 2, "MULTIPLY", 0, "Multiply", ""},
-{ 3, "DIVIDE", 0, "Divide", ""},
-{ 4, "SINE", 0, "Sine", ""},
-{ 5, "COSINE", 0, "Cosine", ""},
-{ 6, "TANGENT", 0, "Tangent", ""},
-{ 7, "ARCSINE", 0, "Arcsine", ""},
-{ 8, "ARCCOSINE", 0, "Arccosine", ""},
-{ 9, "ARCTANGENT", 0, "Arctangent", ""},
-{10, "POWER", 0, "Power", ""},
-{11, "LOGARITHM", 0, "Logarithm", ""},
-{12, "MINIMUM", 0, "Minimum", ""},
-{13, "MAXIMUM", 0, "Maximum", ""},
-{14, "ROUND", 0, "Round", ""},
-{15, "LESS_THAN", 0, "Less Than", ""},
-{16, "GREATER_THAN", 0, "Greater Than", ""},
-{0, NULL, 0, NULL, NULL}};
-
-static EnumPropertyItem node_vec_math_items[] = {
-{0, "ADD", 0, "Add", ""},
-{1, "SUBTRACT", 0, "Subtract", ""},
-{2, "AVERAGE", 0, "Average", ""},
-{3, "DOT_PRODUCT", 0, "Dot Product", ""},
-{4, "CROSS_PRODUCT", 0, "Cross Product", ""},
-{5, "NORMALIZE", 0, "Normalize", ""},
-{0, NULL, 0, NULL, NULL}};
-
-static EnumPropertyItem node_filter_items[] = {
-{0, "SOFTEN", 0, "Soften", ""},
-{1, "SHARPEN", 0, "Sharpen", ""},
-{2, "LAPLACE", 0, "Laplace", ""},
-{3, "SOBEL", 0, "Sobel", ""},
-{4, "PREWITT", 0, "Prewitt", ""},
-{5, "KIRSCH", 0, "Kirsch", ""},
-{6, "SHADOW", 0, "Shadow", ""},
-{0, NULL, 0, NULL, NULL}};
-
static EnumPropertyItem node_ycc_items[] = {
{ 0, "ITUBT601", 0, "ITU 601", ""},
{ 1, "ITUBT709", 0, "ITU 709", ""},
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_filter.c b/source/blender/nodes/intern/CMP_nodes/CMP_filter.c
index f960f44d64d..52b0fb008aa 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_filter.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_filter.c
@@ -224,6 +224,7 @@ void register_node_type_cmp_filter(ListBase *lb)
node_type_base(&ntype, CMP_NODE_FILTER, "Filter", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS,
cmp_node_filter_in, cmp_node_filter_out);
node_type_size(&ntype, 80, 40, 120);
+ node_type_label(&ntype, node_filter_label);
node_type_exec(&ntype, node_composit_exec_filter);
nodeRegisterType(lb, &ntype);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_math.c b/source/blender/nodes/intern/CMP_nodes/CMP_math.c
index 54ece02582d..7a8dadafb86 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_math.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_math.c
@@ -29,7 +29,6 @@
#include "../CMP_util.h"
-
/* **************** SCALAR MATH ******************** */
static bNodeSocketType cmp_node_math_in[]= {
{ SOCK_VALUE, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f},
@@ -188,6 +187,7 @@ void register_node_type_cmp_math(ListBase *lb)
node_type_base(&ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
cmp_node_math_in, cmp_node_math_out);
node_type_size(&ntype, 120, 110, 160);
+ node_type_label(&ntype, node_math_label);
node_type_exec(&ntype, node_composit_exec_math);
nodeRegisterType(lb, &ntype);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c
index b65296ffe10..91b8eb8b752 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c
@@ -86,6 +86,7 @@ void register_node_type_cmp_mix_rgb(ListBase *lb)
node_type_base(&ntype, CMP_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_PREVIEW|NODE_OPTIONS,
cmp_node_mix_rgb_in, cmp_node_mix_rgb_out);
node_type_size(&ntype, 110, 60, 120);
+ node_type_label(&ntype, node_blend_label);
node_type_exec(&ntype, node_composit_exec_mix_rgb);
nodeRegisterType(lb, &ntype);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_math.c b/source/blender/nodes/intern/SHD_nodes/SHD_math.c
index 98f345a1677..ba2ee6d066a 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_math.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_math.c
@@ -30,7 +30,6 @@
#include "../SHD_util.h"
-
/* **************** SCALAR MATH ******************** */
static bNodeSocketType sh_node_math_in[]= {
{ SOCK_VALUE, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f},
@@ -241,6 +240,7 @@ void register_node_type_sh_math(ListBase *lb)
node_type_base(&ntype, SH_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
sh_node_math_in, sh_node_math_out);
node_type_size(&ntype, 120, 110, 160);
+ node_type_label(&ntype, node_math_label);
node_type_storage(&ntype, "node_math", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_math);
node_type_gpu(&ntype, gpu_shader_math);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c
index a8dcf684400..eac3c60655a 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c
@@ -29,7 +29,6 @@
#include "../SHD_util.h"
-
/* **************** MIX RGB ******************** */
static bNodeSocketType sh_node_mix_rgb_in[]= {
{ SOCK_VALUE, 1, "Fac", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
@@ -78,6 +77,7 @@ void register_node_type_sh_mix_rgb(ListBase *lb)
node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
sh_node_mix_rgb_in, sh_node_mix_rgb_out);
node_type_size(&ntype, 100, 60, 150);
+ node_type_label(&ntype, node_blend_label);
node_type_exec(&ntype, node_shader_exec_mix_rgb);
node_type_gpu(&ntype, gpu_shader_mix_rgb);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c b/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c
index 43092d06630..a85022cffab 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c
@@ -134,6 +134,7 @@ void register_node_type_sh_vect_math(ListBase *lb)
node_type_base(&ntype, SH_NODE_VECT_MATH, "Vector Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
sh_node_vect_math_in, sh_node_vect_math_out);
node_type_size(&ntype, 80, 75, 140);
+ node_type_label(&ntype, node_vect_math_label);
node_type_storage(&ntype, "node_vect_math", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_vect_math);
node_type_gpu(&ntype, gpu_shader_vect_math);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_math.c b/source/blender/nodes/intern/TEX_nodes/TEX_math.c
index aee6fb663e5..7e1c54b6e47 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_math.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_math.c
@@ -181,6 +181,7 @@ void register_node_type_tex_math(ListBase *lb)
node_type_base(&ntype, TEX_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
inputs, outputs);
node_type_size(&ntype, 120, 110, 160);
+ node_type_label(&ntype, node_math_label);
node_type_storage(&ntype, "node_math", NULL, NULL);
node_type_exec(&ntype, exec);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c b/source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c
index 565ac68c5b7..152288fcac8 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c
@@ -28,7 +28,6 @@
#include "../TEX_util.h"
-
/* **************** MIX RGB ******************** */
static bNodeSocketType inputs[]= {
{ SOCK_VALUE, 1, "Factor", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
@@ -67,6 +66,7 @@ void register_node_type_tex_mix_rgb(ListBase *lb)
node_type_base(&ntype, TEX_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
inputs, outputs);
node_type_size(&ntype, 100, 60, 150);
+ node_type_label(&ntype, node_blend_label);
node_type_exec(&ntype, exec);
nodeRegisterType(lb, &ntype);
diff --git a/source/blender/nodes/intern/node_util.c b/source/blender/nodes/intern/node_util.c
index 746b8a37f5b..baf0fc17bf7 100644
--- a/source/blender/nodes/intern/node_util.c
+++ b/source/blender/nodes/intern/node_util.c
@@ -30,6 +30,9 @@
#include "CMP_util.h"
#include "SHD_util.h"
+#include "RNA_access.h"
+#include "RNA_enum_types.h"
+
void node_free_curves(bNode *node)
{
curvemapping_free(node->storage);
@@ -50,3 +53,30 @@ void node_copy_standard_storage(bNode *orig_node, bNode *new_node)
new_node->storage= MEM_dupallocN(orig_node->storage);
}
+const char *node_blend_label(bNode *node)
+{
+ const char *name;
+ RNA_enum_name(node_blend_type_items, node->custom1, &name);
+ return name;
+}
+
+const char *node_math_label(bNode *node)
+{
+ const char *name;
+ RNA_enum_name(node_math_items, node->custom1, &name);
+ return name;
+}
+
+const char *node_vect_math_label(bNode *node)
+{
+ const char *name;
+ RNA_enum_name(node_vec_math_items, node->custom1, &name);
+ return name;
+}
+
+const char *node_filter_label(bNode *node)
+{
+ const char *name;
+ RNA_enum_name(node_filter_items, node->custom1, &name);
+ return name;
+}
diff --git a/source/blender/nodes/intern/node_util.h b/source/blender/nodes/intern/node_util.h
index 0326459ac68..c41ce3025ba 100644
--- a/source/blender/nodes/intern/node_util.h
+++ b/source/blender/nodes/intern/node_util.h
@@ -38,6 +38,11 @@ extern void node_free_standard_storage(struct bNode *node);
extern void node_copy_curves(struct bNode *orig_node, struct bNode *new_node);
extern void node_copy_standard_storage(struct bNode *orig_node, struct bNode *new_node);
+const char *node_blend_label(struct bNode *node);
+const char *node_math_label(struct bNode *node);
+const char *node_vect_math_label(struct bNode *node);
+const char *node_filter_label(struct bNode *node);
+
#endif
// this is needed for inlining behaviour