diff options
Diffstat (limited to 'source/blender/editors/space_node/drawnode.c')
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 106 |
1 files changed, 98 insertions, 8 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index b4d89e1365d..4394b4b1920 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -95,6 +95,14 @@ static void node_sync_cb(bContext *UNUSED(C), void *snode_v, void *node_v) } } +static void node_socket_button_label(const bContext *UNUSED(C), uiBlock *block, + bNodeTree *UNUSED(ntree), bNode *UNUSED(node), bNodeSocket *sock, + const char *UNUSED(name), int x, int y, int width) +{ + uiDefBut(block, LABEL, 0, sock->name, x, y, width, NODE_DY, NULL, 0, 0, 0, 0, ""); +} + + static void node_socket_button_default(const bContext *C, uiBlock *block, bNodeTree *ntree, bNode *node, bNodeSocket *sock, const char *name, int x, int y, int width) @@ -938,28 +946,28 @@ static void node_shader_buts_material(uiLayout *layout, bContext *C, PointerRNA static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { + PointerRNA mappingptr = RNA_pointer_get(ptr, "mapping"); uiLayout *row; uiItemL(layout, "Location:", ICON_NONE); row= uiLayoutRow(layout, 1); - uiItemR(row, ptr, "location", 0, "", ICON_NONE); + uiItemR(row, &mappingptr, "location", 0, "", ICON_NONE); uiItemL(layout, "Rotation:", ICON_NONE); row= uiLayoutRow(layout, 1); - uiItemR(row, ptr, "rotation", 0, "", ICON_NONE); + uiItemR(row, &mappingptr, "rotation", 0, "", ICON_NONE); uiItemL(layout, "Scale:", ICON_NONE); row= uiLayoutRow(layout, 1); - uiItemR(row, ptr, "scale", 0, "", ICON_NONE); + uiItemR(row, &mappingptr, "scale", 0, "", ICON_NONE); row= uiLayoutRow(layout, 1); - uiItemR(row, ptr, "use_min", 0, "Min", ICON_NONE); - uiItemR(row, ptr, "min", 0, "", ICON_NONE); + uiItemR(row, &mappingptr, "use_min", 0, "Min", ICON_NONE); + uiItemR(row, &mappingptr, "min", 0, "", ICON_NONE); row= uiLayoutRow(layout, 1); - uiItemR(row, ptr, "use_max", 0, "Max", ICON_NONE); - uiItemR(row, ptr, "max", 0, "", ICON_NONE); - + uiItemR(row, &mappingptr, "use_max", 0, "Max", ICON_NONE); + uiItemR(row, &mappingptr, "max", 0, "", ICON_NONE); } static void node_shader_buts_vect_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -986,6 +994,54 @@ static void node_shader_buts_geometry(uiLayout *layout, bContext *C, PointerRNA } } +static void node_shader_buts_attribute(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "attribute_name", 0, "Name", ICON_NONE); +} + +static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + //uiItemR(layout, ptr, "image", 0, "", ICON_NONE); + uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL); + uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE); +} + +static void node_shader_buts_tex_sky(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "sun_direction", 0, "", ICON_NONE); + uiItemR(layout, ptr, "turbidity", 0, NULL, ICON_NONE); +} + +static void node_shader_buts_tex_gradient(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "gradient_type", 0, "", ICON_NONE); +} + +static void node_shader_buts_tex_magic(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "turbulence_depth", 0, NULL, ICON_NONE); +} + +static void node_shader_buts_tex_wave(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "wave_type", 0, "", ICON_NONE); +} + +static void node_shader_buts_tex_musgrave(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "musgrave_type", 0, "", ICON_NONE); +} + +static void node_shader_buts_tex_voronoi(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "coloring", 0, "", ICON_NONE); +} + +static void node_shader_buts_glossy(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "distribution", 0, "", ICON_NONE); +} + static void node_shader_buts_dynamic(uiLayout *layout, bContext *C, PointerRNA *ptr) { Main *bmain= CTX_data_main(C); @@ -1072,6 +1128,37 @@ static void node_shader_set_butfunc(bNodeType *ntype) case SH_NODE_GEOMETRY: ntype->uifunc= node_shader_buts_geometry; break; + case SH_NODE_ATTRIBUTE: + ntype->uifunc= node_shader_buts_attribute; + break; + case SH_NODE_TEX_SKY: + ntype->uifunc= node_shader_buts_tex_sky; + break; + case SH_NODE_TEX_IMAGE: + ntype->uifunc= node_shader_buts_tex_image; + break; + case SH_NODE_TEX_ENVIRONMENT: + ntype->uifunc= node_shader_buts_tex_image; + break; + case SH_NODE_TEX_GRADIENT: + ntype->uifunc= node_shader_buts_tex_gradient; + break; + case SH_NODE_TEX_MAGIC: + ntype->uifunc= node_shader_buts_tex_magic; + break; + case SH_NODE_TEX_WAVE: + ntype->uifunc= node_shader_buts_tex_wave; + break; + case SH_NODE_TEX_MUSGRAVE: + ntype->uifunc= node_shader_buts_tex_musgrave; + break; + case SH_NODE_TEX_VORONOI: + ntype->uifunc= node_shader_buts_tex_voronoi; + break; + case SH_NODE_BSDF_GLOSSY: + case SH_NODE_BSDF_GLASS: + ntype->uifunc= node_shader_buts_glossy; + break; case NODE_DYNAMIC: ntype->uifunc= node_shader_buts_dynamic; break; @@ -2089,6 +2176,9 @@ void ED_init_node_butfuncs(void) case SOCK_RGBA: stype->buttonfunc = node_socket_button_color; break; + case SOCK_SHADER: + stype->buttonfunc = node_socket_button_label; + break; default: stype->buttonfunc = NULL; } |