diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_node.h | 5 | ||||
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 41 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_buttons.c | 4 |
3 files changed, 44 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index c86080aa21f..f0ed7a6f5c8 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -87,8 +87,9 @@ typedef struct bNodeType { void (*execfunc)(void *data, struct bNode *, struct bNodeStack **, struct bNodeStack **); /* this line is set on startup of blender */ - void (*uifunc)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr); - const char *(*labelfunc)(struct bNode *); + void (*uifunc)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr); + void (*uifuncbut)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr); + const char *(*labelfunc)(struct bNode *); void (*initfunc)(struct bNode *); void (*freestoragefunc)(struct bNode *); diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 17cfc7d8f95..be46642b47d 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -423,6 +423,7 @@ static void node_shader_buts_dynamic(uiLayout *layout, bContext *C, PointerRNA * /* only once called */ static void node_shader_set_butfunc(bNodeType *ntype) { + ntype->uifuncbut = NULL; switch(ntype->type) { /* case NODE_GROUP: note, typeinfo for group is generated... see "XXX ugly hack" */ @@ -472,6 +473,7 @@ static void node_shader_set_butfunc(bNodeType *ntype) default: ntype->uifunc= NULL; } + if (ntype->uifuncbut == NULL) ntype->uifuncbut = ntype->uifunc; } /* ****************** BUTTON CALLBACKS FOR COMPOSITE NODES ***************** */ @@ -1036,6 +1038,35 @@ static void node_composit_buts_colorbalance(uiLayout *layout, bContext *UNUSED(C } } +static void node_composit_buts_colorbalance_but(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "correction_method", 0, NULL, ICON_NONE); + + if (RNA_enum_get(ptr, "correction_method")== 0) { + + uiTemplateColorWheel(layout, ptr, "lift", 1, 1, 0, 1); + uiItemR(layout, ptr, "lift", 0, NULL, ICON_NONE); + + uiTemplateColorWheel(layout, ptr, "gamma", 1, 1, 1, 1); + uiItemR(layout, ptr, "gamma", 0, NULL, ICON_NONE); + + uiTemplateColorWheel(layout, ptr, "gain", 1, 1, 1, 1); + uiItemR(layout, ptr, "gain", 0, NULL, ICON_NONE); + + } else { + + uiTemplateColorWheel(layout, ptr, "offset", 1, 1, 0, 1); + uiItemR(layout, ptr, "offset", 0, NULL, ICON_NONE); + + uiTemplateColorWheel(layout, ptr, "power", 1, 1, 0, 1); + uiItemR(layout, ptr, "power", 0, NULL, ICON_NONE); + + uiTemplateColorWheel(layout, ptr, "slope", 1, 1, 0, 1); + uiItemR(layout, ptr, "slope", 0, NULL, ICON_NONE); + } + +} + static void node_composit_buts_huecorrect(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { @@ -1050,6 +1081,7 @@ static void node_composit_buts_ycc(uiLayout *layout, bContext *UNUSED(C), Pointe /* only once called */ static void node_composit_set_butfunc(bNodeType *ntype) { + ntype->uifuncbut = NULL; switch(ntype->type) { /* case NODE_GROUP: note, typeinfo for group is generated... see "XXX ugly hack" */ @@ -1183,8 +1215,9 @@ static void node_composit_set_butfunc(bNodeType *ntype) ntype->uifunc=node_composit_buts_view_levels; break; case CMP_NODE_COLORBALANCE: - ntype->uifunc=node_composit_buts_colorbalance; - break; + ntype->uifunc=node_composit_buts_colorbalance; + ntype->uifuncbut=node_composit_buts_colorbalance_but; + break; case CMP_NODE_HUECORRECT: ntype->uifunc=node_composit_buts_huecorrect; break; @@ -1198,6 +1231,8 @@ static void node_composit_set_butfunc(bNodeType *ntype) default: ntype->uifunc= NULL; } + if (ntype->uifuncbut == NULL) ntype->uifuncbut = ntype->uifunc; + } /* ****************** BUTTON CALLBACKS FOR TEXTURE NODES ***************** */ @@ -1308,6 +1343,7 @@ static void node_texture_buts_output(uiLayout *layout, bContext *UNUSED(C), Poin /* only once called */ static void node_texture_set_butfunc(bNodeType *ntype) { + ntype->uifuncbut = NULL; if( ntype->type >= TEX_NODE_PROC && ntype->type < TEX_NODE_PROC_MAX ) { ntype->uifunc = node_texture_buts_proc; } @@ -1352,6 +1388,7 @@ static void node_texture_set_butfunc(bNodeType *ntype) default: ntype->uifunc= NULL; } + if (ntype->uifuncbut == NULL) ntype->uifuncbut = ntype->uifunc; } /* ******* init draw callbacks for all tree types, only called in usiblender.c, once ************* */ diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c index 684961f2606..5d2ed700266 100644 --- a/source/blender/editors/space_node/node_buttons.c +++ b/source/blender/editors/space_node/node_buttons.c @@ -118,8 +118,8 @@ static void active_node_panel(const bContext *C, Panel *pa) uiItemS(layout); /* draw this node's settings */ - if (node->typeinfo && node->typeinfo->uifunc) - node->typeinfo->uifunc(layout, (bContext *)C, &ptr); + if (node->typeinfo && node->typeinfo->uifuncbut) + node->typeinfo->uifuncbut(layout, (bContext *)C, &ptr); } /* ******************* node buttons registration ************** */ |