From c1e901811811f10c90789784667ed9c0f708010f Mon Sep 17 00:00:00 2001 From: Robert Holcomb Date: Sun, 25 Mar 2007 23:54:39 +0000 Subject: All UI code reverted to drawnode.c --- source/blender/blenkernel/BKE_node.h | 18 +- source/blender/blenkernel/intern/node.c | 4 +- source/blender/include/BSE_node.h | 26 +- source/blender/nodes/CMP_node.h | 11 - source/blender/nodes/SHD_node.h | 4 - .../blender/nodes/intern/CMP_nodes/CMP_alphaOver.c | 15 +- source/blender/nodes/intern/CMP_nodes/CMP_blur.c | 37 +- .../nodes/intern/CMP_nodes/CMP_channelMatte.c | 59 +- .../nodes/intern/CMP_nodes/CMP_chromaMatte.c | 32 +- .../nodes/intern/CMP_nodes/CMP_colorSpill.c | 26 +- .../blender/nodes/intern/CMP_nodes/CMP_composite.c | 3 +- source/blender/nodes/intern/CMP_nodes/CMP_curves.c | 41 +- .../blender/nodes/intern/CMP_nodes/CMP_defocus.c | 58 +- .../blender/nodes/intern/CMP_nodes/CMP_diffMatte.c | 48 +- source/blender/nodes/intern/CMP_nodes/CMP_dilate.c | 13 +- .../blender/nodes/intern/CMP_nodes/CMP_displace.c | 5 +- source/blender/nodes/intern/CMP_nodes/CMP_filter.c | 16 +- source/blender/nodes/intern/CMP_nodes/CMP_flip.c | 17 +- .../blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c | 23 +- source/blender/nodes/intern/CMP_nodes/CMP_idMask.c | 13 +- source/blender/nodes/intern/CMP_nodes/CMP_image.c | 305 +----- .../nodes/intern/CMP_nodes/CMP_lummaMatte.c | 26 +- source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c | 13 +- .../blender/nodes/intern/CMP_nodes/CMP_mapValue.c | 26 +- source/blender/nodes/intern/CMP_nodes/CMP_math.c | 3 +- source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c | 3 +- source/blender/nodes/intern/CMP_nodes/CMP_normal.c | 3 +- .../nodes/intern/CMP_nodes/CMP_outputFile.c | 70 +- source/blender/nodes/intern/CMP_nodes/CMP_rgb.c | 3 +- source/blender/nodes/intern/CMP_nodes/CMP_rotate.c | 3 +- source/blender/nodes/intern/CMP_nodes/CMP_scale.c | 32 +- .../nodes/intern/CMP_nodes/CMP_sepcombHSVA.c | 6 +- .../nodes/intern/CMP_nodes/CMP_sepcombRGBA.c | 6 +- .../nodes/intern/CMP_nodes/CMP_sepcombYCCA.c | 6 +- .../nodes/intern/CMP_nodes/CMP_sepcombYUVA.c | 6 +- .../blender/nodes/intern/CMP_nodes/CMP_setalpha.c | 3 +- .../nodes/intern/CMP_nodes/CMP_splitViewer.c | 22 +- .../blender/nodes/intern/CMP_nodes/CMP_texture.c | 3 +- .../blender/nodes/intern/CMP_nodes/CMP_translate.c | 3 +- .../blender/nodes/intern/CMP_nodes/CMP_valToRgb.c | 8 +- source/blender/nodes/intern/CMP_nodes/CMP_value.c | 3 +- .../blender/nodes/intern/CMP_nodes/CMP_vecBlur.c | 4 +- source/blender/nodes/intern/CMP_nodes/CMP_viewer.c | 4 +- .../blender/nodes/intern/CMP_nodes/CMP_zcombine.c | 3 +- source/blender/nodes/intern/SHD_nodes/SHD_camera.c | 4 +- source/blender/nodes/intern/SHD_nodes/SHD_curves.c | 8 +- source/blender/nodes/intern/SHD_nodes/SHD_geom.c | 16 +- .../blender/nodes/intern/SHD_nodes/SHD_mapping.c | 52 +- .../blender/nodes/intern/SHD_nodes/SHD_material.c | 140 +-- source/blender/nodes/intern/SHD_nodes/SHD_math.c | 4 +- source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c | 4 +- source/blender/nodes/intern/SHD_nodes/SHD_normal.c | 4 +- source/blender/nodes/intern/SHD_nodes/SHD_output.c | 4 +- source/blender/nodes/intern/SHD_nodes/SHD_rgb.c | 4 +- .../blender/nodes/intern/SHD_nodes/SHD_squeeze.c | 4 +- .../blender/nodes/intern/SHD_nodes/SHD_texture.c | 4 +- .../blender/nodes/intern/SHD_nodes/SHD_valToRgb.c | 8 +- source/blender/nodes/intern/SHD_nodes/SHD_value.c | 4 +- .../blender/nodes/intern/SHD_nodes/SHD_vectMath.c | 15 +- source/blender/src/SConscript | 3 +- source/blender/src/drawnode.c | 1077 +++++++++++++++++++- source/blender/src/usiblender.c | 2 +- 62 files changed, 1205 insertions(+), 1185 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index d06e8625bf9..616bca078f5 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -190,7 +190,10 @@ struct ShadeResult; #define SH_NODE_SQUEEZE 117 - +/* custom defines options for Material node */ +#define SH_NODE_MAT_DIFF 1 +#define SH_NODE_MAT_SPEC 2 +#define SH_NODE_MAT_NEG 4 /* the type definitions array */ static bNodeType *node_all_shaders[]; @@ -275,6 +278,19 @@ void set_node_shader_lamp_loop(void (*lamp_loop_func)(struct ShadeInput *, str #define CMP_NODE_MATH 247 #define CMP_NODE_LUMA_MATTE 248 +/* filter types */ +#define CMP_FILT_SOFT 0 +#define CMP_FILT_SHARP 1 +#define CMP_FILT_LAPLACE 2 +#define CMP_FILT_SOBEL 3 +#define CMP_FILT_PREWITT 4 +#define CMP_FILT_KIRSCH 5 +#define CMP_FILT_SHADOW 6 + +/* scale node type, in custom1 */ +#define CMP_SCALE_RELATIVE 0 +#define CMP_SCALE_ABSOLUTE 1 + /* the type definitions array */ static bNodeType* node_all_composit[]; diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 2340e260d4f..84e88ee98f3 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -784,8 +784,8 @@ bNode *nodeAddNodeType(bNodeTree *ntree, int type, bNodeTree *ngroup) /* got it-bob*/ if(ntype->initfunc!=NULL) ntype->initfunc(node); - - return node; + + return node; } /* keep socket listorder identical, for copying links */ diff --git a/source/blender/include/BSE_node.h b/source/blender/include/BSE_node.h index 91c3dd95864..243cac56152 100644 --- a/source/blender/include/BSE_node.h +++ b/source/blender/include/BSE_node.h @@ -98,9 +98,9 @@ void node_draw_link(struct SpaceNode *snode, struct bNodeLink *link); void init_node_butfuncs(void); /* exported to CMP and SHD nodes */ -void node_ID_title_cb(void *node_v, void *unused_v); -void node_but_title_cb(void *node_v, void *but_v); -void node_texmap_cb(void *texmap_v, void *unused_v); +//void node_ID_title_cb(void *node_v, void *unused_v); +//void node_but_title_cb(void *node_v, void *but_v); +//void node_texmap_cb(void *texmap_v, void *unused_v); //void node_new_mat_cb(void *ntree_v, void *node_v); //void node_browse_mat_cb(void *ntree_v, void *node_v); //void node_mat_alone_cb(void *node_v, void *unused); @@ -117,16 +117,16 @@ void node_texmap_cb(void *texmap_v, void *unused_v); //void node_browse_scene_cb(void *ntree_v, void *node_v); -int node_buts_curvevec(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr); -int node_buts_curvecol(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr); -int node_buts_rgb(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr); -int node_buts_texture(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr); -int node_buts_valtorgb(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr); -int node_buts_value(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr); -int node_buts_mix_rgb(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr); -int node_buts_group(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr); -int node_buts_normal(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr); -int node_buts_math(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr) ; +//int node_buts_curvevec(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr); +//int node_buts_curvecol(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr); +//int node_buts_rgb(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr); +//int node_buts_texture(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr); +//int node_buts_valtorgb(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr); +//int node_buts_value(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr); +//int node_buts_mix_rgb(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr); +//int node_buts_group(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr); +//int node_buts_normal(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr); +//int node_buts_math(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr) ; /* ************* Shader nodes ***************** */ diff --git a/source/blender/nodes/CMP_node.h b/source/blender/nodes/CMP_node.h index 2317d427694..b35c2cba18f 100644 --- a/source/blender/nodes/CMP_node.h +++ b/source/blender/nodes/CMP_node.h @@ -35,17 +35,6 @@ #include "BKE_node.h" -#define CMP_FILT_SOFT 0 -#define CMP_FILT_SHARP 1 -#define CMP_FILT_LAPLACE 2 -#define CMP_FILT_SOBEL 3 -#define CMP_FILT_PREWITT 4 -#define CMP_FILT_KIRSCH 5 -#define CMP_FILT_SHADOW 6 - -/* scale node type, in custom1 */ -#define CMP_SCALE_RELATIVE 0 -#define CMP_SCALE_ABSOLUTE 1 /* ****************** types array for all composite nodes ****************** */ diff --git a/source/blender/nodes/SHD_node.h b/source/blender/nodes/SHD_node.h index 345a92f2f72..9c4a3421e5e 100644 --- a/source/blender/nodes/SHD_node.h +++ b/source/blender/nodes/SHD_node.h @@ -35,10 +35,6 @@ #include "BKE_node.h" -/* custom defines options for Material node */ -#define SH_NODE_MAT_DIFF 1 -#define SH_NODE_MAT_SPEC 2 -#define SH_NODE_MAT_NEG 4 /* the type definitions array */ /* ****************** types array for all shaders ****************** */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c b/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c index c12f61f76ca..0ef0f096e89 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c @@ -107,18 +107,6 @@ static void node_composit_exec_alphaover(void *data, bNode *node, bNodeStack **i } } -static int node_composit_buts_alphaover(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - - /* alpha type */ - uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "ConvertPremul", - butr->xmin, butr->ymin, butr->xmax-butr->xmin, 19, - &node->custom1, 0, 0, 0, 0, ""); - } - return 19; -} - bNodeType cmp_node_alphaover= { /* type code */ CMP_NODE_ALPHAOVER, /* name */ "AlphaOver", @@ -128,7 +116,8 @@ bNodeType cmp_node_alphaover= { /* output sock */ cmp_node_alphaover_out, /* storage */ "", /* execfunc */ node_composit_exec_alphaover, - /* butfunc */ node_composit_buts_alphaover + /* butfunc */ NULL, + /*initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c index 64ac956c917..460f2b6b527 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c @@ -611,39 +611,6 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN free_compbuf(img); } -static int node_composit_buts_blur(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - NodeBlurData *nbd= node->storage; - uiBut *bt; - short dy= butr->ymin+38; - short dx= (butr->xmax-butr->xmin)/2; - char str[256]; - - uiBlockBeginAlign(block); - sprintf(str, "Filter Type%%t|Flat %%x%d|Tent %%x%d|Quad %%x%d|Cubic %%x%d|Gauss %%x%d|CatRom %%x%d|Mitch %%x%d", R_FILTER_BOX, R_FILTER_TENT, R_FILTER_QUAD, R_FILTER_CUBIC, R_FILTER_GAUSS, R_FILTER_CATROM, R_FILTER_MITCH); - uiDefButS(block, MENU, B_NODE_EXEC+node->nr,str, - butr->xmin, dy, dx*2, 19, - &nbd->filtertype, 0, 0, 0, 0, "Set sampling filter for blur"); - dy-=19; - uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Bokeh", - butr->xmin, dy, dx, 19, - &nbd->bokeh, 0, 0, 0, 0, "Uses circular filter, warning it's slow!"); - uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Gamma", - butr->xmin+dx, dy, dx, 19, - &nbd->gamma, 0, 0, 0, 0, "Applies filter on gamma corrected values"); - - dy-=19; - bt=uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "X:", - butr->xmin, dy, dx, 19, - &nbd->sizex, 0, 256, 0, 0, ""); - bt=uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Y:", - butr->xmin+dx, dy, dx, 19, - &nbd->sizey, 0, 256, 0, 0, ""); - } - return 57; -} - static void node_composit_init_blur(bNode* node) { node->storage= MEM_callocN(sizeof(NodeBlurData), "node blur data"); @@ -658,8 +625,8 @@ bNodeType cmp_node_blur= { /* output sock */ cmp_node_blur_out, /* storage */ "NodeBlurData", /* execfunc */ node_composit_exec_blur, - /* butfunc */ node_composit_buts_blur, - node_composit_init_blur + /* butfunc */ NULL, + /*initfunc */ node_composit_init_blur }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c index 4f74f31f906..b659ad0bc87 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c @@ -176,63 +176,6 @@ static void node_composit_exec_channel_matte(void *data, bNode *node, bNodeStack } -static int node_composit_buts_channel_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - short sx= (butr->xmax-butr->xmin)/4; - short cx= (butr->xmax-butr->xmin)/3; - NodeChroma *c=node->storage; - char *c1, *c2, *c3; - - /*color space selectors*/ - uiBlockBeginAlign(block); - uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"RGB", - butr->xmin,butr->ymin+60,sx,20,&node->custom1,1,1, 0, 0, "RGB Color Space"); - uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"HSV", - butr->xmin+sx,butr->ymin+60,sx,20,&node->custom1,1,2, 0, 0, "HSV Color Space"); - uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"YUV", - butr->xmin+2*sx,butr->ymin+60,sx,20,&node->custom1,1,3, 0, 0, "YUV Color Space"); - uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"YCC", - butr->xmin+3*sx,butr->ymin+60,sx,20,&node->custom1,1,4, 0, 0, "YCbCr Color Space"); - - if (node->custom1==1) { - c1="R"; c2="G"; c3="B"; - } - else if(node->custom1==2){ - c1="H"; c2="S"; c3="V"; - } - else if(node->custom1==3){ - c1="Y"; c2="U"; c3="V"; - } - else { // if(node->custom1==4){ - c1="Y"; c2="Cb"; c3="Cr"; - } - - /*channel selector */ - uiDefButS(block, ROW, B_NODE_EXEC+node->nr, c1, - butr->xmin,butr->ymin+40,cx,20,&node->custom2,1, 1, 0, 0, "Channel 1"); - uiDefButS(block, ROW, B_NODE_EXEC+node->nr, c2, - butr->xmin+cx,butr->ymin+40,cx,20,&node->custom2,1, 2, 0, 0, "Channel 2"); - uiDefButS(block, ROW, B_NODE_EXEC+node->nr, c3, - butr->xmin+cx+cx,butr->ymin+40,cx,20,&node->custom2, 1, 3, 0, 0, "Channel 3"); - - /*tolerance sliders */ - uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "High ", - butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20, - &c->t1, 0.0f, 1.0f, 100, 0, "Values higher than this setting are 100% opaque"); - uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Low ", - butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, - &c->t2, 0.0f, 1.0f, 100, 0, "Values lower than this setting are 100% keyed"); - uiBlockEndAlign(block); - - /*keep t2 (low) less than t1 (high) */ - if(c->t2 > c->t1) { - c->t2=c->t1; - } - } - return 80; -} - static void node_composit_init_channel_matte(bNode *node) { NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma"); @@ -255,6 +198,6 @@ bNodeType cmp_node_channel_matte={ /* output sock */ cmp_node_channel_matte_out, /* storage */ "NodeChroma", /* execfunc */ node_composit_exec_channel_matte, - /* butfunc */ node_composit_buts_channel_matte, + /* butfunc */ NULL, node_composit_init_channel_matte }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c index 7109b8733d5..6080d9782b6 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c @@ -160,36 +160,6 @@ static void node_composit_exec_chroma_matte(void *data, bNode *node, bNodeStack free_compbuf(cbuf); }; -static int node_composit_buts_chroma_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - short dx=(butr->xmax-butr->xmin)/2; - NodeChroma *c= node->storage; - uiBlockBeginAlign(block); - - uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Acceptance ", - butr->xmin, butr->ymin+60, butr->xmax-butr->xmin, 20, - &c->t1, 1.0f, 80.0f, 100, 0, "Tolerance for colors to be considered a keying color"); - uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Cutoff ", - butr->xmin, butr->ymin+40, butr->xmax-butr->xmin, 20, - &c->t2, 0.0f, 30.0f, 100, 0, "Colors below this will be considered as exact matches for keying color"); - - uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Lift ", - butr->xmin, butr->ymin+20, dx, 20, - &c->fsize, 0.0f, 1.0f, 100, 0, "Alpha Lift"); - uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Gain ", - butr->xmin+dx, butr->ymin+20, dx, 20, - &c->fstrength, 0.0f, 1.0f, 100, 0, "Alpha Gain"); - - uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Shadow Adjust ", - butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, - &c->t3, 0.0f, 1.0f, 100, 0, "Adjusts the brightness of any shadows captured"); - - if(c->t2 > c->t1) - c->t2=c->t1; - } - return 80; -} static void node_composit_init_chroma_matte(bNode *node) { @@ -211,7 +181,7 @@ bNodeType cmp_node_chroma={ /* output sock */ cmp_node_chroma_out, /* storage */ "NodeChroma", /* execfunc */ node_composit_exec_chroma_matte, - /* butfunc */ node_composit_buts_chroma_matte, + /* butfunc */ NULL, node_composit_init_chroma_matte }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c index b82b4afe5e8..44dd6f8b640 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c @@ -113,30 +113,6 @@ static void node_composit_exec_color_spill(void *data, bNode *node, bNodeStack * free_compbuf(cbuf); } -static int node_composit_buts_color_spill(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - short dx= (butr->xmax-butr->xmin)/3; - - NodeChroma *c=node->storage; - uiBlockBeginAlign(block); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Enhance: ", - butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20, - &c->t1, 0.0f, 0.5f, 100, 2, "Adjusts how much selected channel is affected by color spill algorithm"); - uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "R", - butr->xmin,butr->ymin,dx,20, - &node->custom1,1,1, 0, 0, "Red Spill Suppression"); - uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "G", - butr->xmin+dx,butr->ymin,dx,20, - &node->custom1,1,2, 0, 0, "Green Spill Suppression"); - uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "B", - butr->xmin+2*dx,butr->ymin,dx,20, - &node->custom1, 1, 3, 0, 0, "Blue Spill Suppression"); - uiBlockEndAlign(block); - } - return 60; -} - static void node_composit_init_color_spill(bNode *node) { NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma"); @@ -158,7 +134,7 @@ bNodeType cmp_node_color_spill={ /* output sock */ cmp_node_color_spill_out, /* storage */ "NodeChroma", /* execfunc */ node_composit_exec_color_spill, - /* butfunc */ node_composit_buts_color_spill, + /* butfunc */ NULL, node_composit_init_color_spill }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_composite.c b/source/blender/nodes/intern/CMP_nodes/CMP_composite.c index 1ea75652d59..fe0491a8734 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_composite.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_composite.c @@ -96,5 +96,6 @@ bNodeType cmp_node_composite= { /* output sock */ NULL, /* storage */ "", /* execfunc */ node_composit_exec_composite, - /* butfunc */ NULL + /* butfunc */ NULL, + /*initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c b/source/blender/nodes/intern/CMP_nodes/CMP_curves.c index 23da03d60a1..a7b81d425aa 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_curves.c @@ -51,35 +51,6 @@ static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack * } -static int node_composit_buts_curves_time(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - CurveMapping *cumap= node->storage; - short dx= (butr->xmax-butr->xmin)/2; - rctf *curvebutr; - - memcpy(&curvebutr, &butr, sizeof(rctf)); - curvebutr->ymin += 26; - - curvemap_buttons(block, node->storage, 's', B_NODE_EXEC+node->nr, B_REDR, curvebutr); - - cumap->flag |= CUMA_DRAW_CFRA; - if(node->custom1custom2) - cumap->black[0]= (float)(CFRA - node->custom1)/(float)(node->custom2-node->custom1); - - uiBlockBeginAlign(block); - uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Sta:", - butr->xmin, butr->ymin-22, dx, 19, - &node->custom1, 1.0, 20000.0, 0, 0, "Start frame"); - uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "End:", - butr->xmin+dx, butr->ymin-22, dx, 19, - &node->custom2, 1.0, 20000.0, 0, 0, "End frame"); - - } - - return node->width-NODE_DY; -}; - static void node_composit_init_curves_time(bNode* node) { node->custom1= G.scene->r.sfra; @@ -96,8 +67,8 @@ bNodeType cmp_node_curve_time= { /* output sock */ cmp_node_time_out, /* storage */ "CurveMapping", /* execfunc */ node_composit_exec_curves_time, - /* butfunc */ node_composit_buts_curves_time, - node_composit_init_curves_time + /* butfunc */ NULL, + /* initfunc */ node_composit_init_curves_time }; @@ -135,8 +106,8 @@ bNodeType cmp_node_curve_vec= { /* output sock */ cmp_node_curve_vec_out, /* storage */ "CurveMapping", /* execfunc */ node_composit_exec_curve_vec, - /* butfunc */ node_buts_curvevec, - node_composit_init_curve_vec + /* butfunc */ NULL, + /* initfunc */ node_composit_init_curve_vec }; @@ -217,7 +188,7 @@ bNodeType cmp_node_curve_rgb= { /* output sock */ cmp_node_curve_rgb_out, /* storage */ "CurveMapping", /* execfunc */ node_composit_exec_curve_rgb, - /* butfunc */ node_buts_curvecol, - node_composit_init_curve_rgb + /* butfunc */ NULL, + /* initfunc */ node_composit_init_curve_rgb }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c index 157b84a6d6a..2c705acbab1 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c @@ -788,60 +788,6 @@ static void node_composit_exec_defocus(void *data, bNode *node, bNodeStack **in, if (zbuf_use && (zbuf_use != zbuf)) free_compbuf(zbuf_use); } -/* qdn: defocus node */ -static int node_composit_buts_defocus(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - NodeDefocus *nqd = node->storage; - short dy = butr->ymin + 209; - short dx = butr->xmax - butr->xmin; - char* mstr1 = "Bokeh Type%t|Octagon %x8|Heptagon %x7|Hexagon %x6|Pentagon %x5|Square %x4|Triangle %x3|Disk %x0"; - - uiDefBut(block, LABEL, B_NOP, "Bokeh Type", butr->xmin, dy, dx, 19, NULL, 0, 0, 0, 0, ""); - uiDefButC(block, MENU, B_NODE_EXEC+node->nr, mstr1, - butr->xmin, dy-19, dx, 19, - &nqd->bktype, 0, 0, 0, 0, "Bokeh type"); - if (nqd->bktype) { /* for some reason rotating a disk doesn't seem to work... ;) */ - uiDefButC(block, NUM, B_NODE_EXEC+node->nr, "Rotate:", - butr->xmin, dy-38, dx, 19, - &nqd->rotation, 0, 90, 0, 0, "Bokeh shape rotation offset in degrees"); - } - uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Gamma Correct", - butr->xmin, dy-57, dx, 19, - &nqd->gamco, 0, 0, 0, 0, "Enable gamma correction before and after main process"); - if (nqd->no_zbuf==0) { - // only needed for zbuffer input - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "fStop:", - butr->xmin, dy-76, dx, 19, - &nqd->fstop, 0.5, 128, 10, 0, "Amount of focal blur, 128=infinity=perfect focus, half the value doubles the blur radius"); - } - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Maxblur:", - butr->xmin, dy-95, dx, 19, - &nqd->maxblur, 0, 10000, 1000, 0, "blur limit, maximum CoC radius, 0=no limit"); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "BThreshold:", - butr->xmin, dy-114, dx, 19, - &nqd->bthresh, 0, 100, 100, 0, "CoC radius threshold, prevents background bleed on in-focus midground, 0=off"); - uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Preview", - butr->xmin, dy-142, dx, 19, - &nqd->preview, 0, 0, 0, 0, "Enable sampling mode, useful for preview when using low samplecounts"); - if (nqd->preview) { - /* only visible when sampling mode enabled */ - uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Samples:", - butr->xmin, dy-161, dx, 19, - &nqd->samples, 16, 256, 0, 0, "Number of samples (16=grainy, higher=less noise)"); - } - uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "No zbuffer", - butr->xmin, dy-190, dx, 19, - &nqd->no_zbuf, 0, 0, 0, 0, "Enable when using an image as input instead of actual zbuffer (auto enabled if node not image based, eg. time node)"); - if (nqd->no_zbuf) { - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Zscale:", - butr->xmin, dy-209, dx, 19, - &nqd->scale, 0, 1000, 100, 0, "Scales the Z input when not using a zbuffer, controls maximum blur designated by the color white or input value 1"); - } - } - return 228; -} - static void node_composit_init_defocus(bNode* node) { /* qdn: defocus node */ @@ -868,8 +814,8 @@ bNodeType cmp_node_defocus = { /* output sock */ cmp_node_defocus_out, /* storage */ "NodeDefocus", /* execfunc */ node_composit_exec_defocus, - /* butfunc */ node_composit_buts_defocus, - node_composit_init_defocus + /* butfunc */ NULL, + /* initfunc */ node_composit_init_defocus }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c index 7276245e7a3..d476ac215b5 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c @@ -185,50 +185,6 @@ static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack ** free_compbuf(inbuf); } -static int node_composit_buts_diff_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - short sx= (butr->xmax-butr->xmin)/4; - short dx= (butr->xmax-butr->xmin)/3; - NodeChroma *c= node->storage; - - uiBlockBeginAlign(block); - /*color space selectors*/ - uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"RGB", - butr->xmin,butr->ymin+60,sx,20, - &node->custom1,1,1, 0, 0, "RGB Color Space"); - uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"HSV", - butr->xmin+sx,butr->ymin+60,sx,20, - &node->custom1,1,2, 0, 0, "HSV Color Space"); - uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"YUV", - butr->xmin+2*sx,butr->ymin+60,sx,20, - &node->custom1,1,3, 0, 0, "YUV Color Space"); - uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"YCC", - butr->xmin+3*sx,butr->ymin+60,sx,20, - &node->custom1,1,4, 0, 0, "YCbCr Color Space"); - /*channel tolorences*/ - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, " ", - butr->xmin, butr->ymin+40, dx, 20, - &c->t1, 0.0f, 1.0f, 100, 0, "Channel 1 Tolerance"); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, " ", - butr->xmin+dx, butr->ymin+40, dx, 20, - &c->t2, 0.0f, 1.0f, 100, 0, "Channel 2 Tolorence"); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, " ", - butr->xmin+2*dx, butr->ymin+40, dx, 20, - &c->t3, 0.0f, 1.0f, 100, 0, "Channel 3 Tolorence"); - /*falloff parameters*/ - /* - uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Falloff Size ", - butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20, - &c->fsize, 0.0f, 1.0f, 100, 0, ""); - */ - uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Falloff: ", - butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20, - &c->fstrength, 0.0f, 1.0f, 100, 0, ""); - } - return 80; -} - static void node_composit_init_diff_matte(bNode *node) { NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma"); @@ -250,8 +206,8 @@ bNodeType cmp_node_diff_matte={ /* output sock */ cmp_node_diff_matte_out, /* storage */ "NodeChroma", /* execfunc */ node_composit_exec_diff_matte, - /* butfunc */ node_composit_buts_diff_matte, - node_composit_init_diff_matte + /* butfunc */ NULL, + /* initfunc */ node_composit_init_diff_matte }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c b/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c index 8abf5ade9dd..b4902fe395e 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c @@ -143,16 +143,6 @@ static void node_composit_exec_dilateerode(void *data, bNode *node, bNodeStack * } } -static int node_composit_buts_dilateerode(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Distance:", - butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, - &node->custom2, -100, 100, 0, 0, "Distance to grow/shrink (number of iterations)"); - } - return 20; -} - bNodeType cmp_node_dilateerode= { /* type code */ CMP_NODE_DILATEERODE, /* name */ "Dilate/Erode", @@ -162,7 +152,8 @@ bNodeType cmp_node_dilateerode= { /* output sock */ cmp_node_dilateerode_out, /* storage */ "", /* execfunc */ node_composit_exec_dilateerode, - /* butfunc */ node_composit_buts_dilateerode + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c b/source/blender/nodes/intern/CMP_nodes/CMP_displace.c index 371f978ef1a..760d1107d4c 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_displace.c @@ -152,7 +152,8 @@ bNodeType cmp_node_displace= { /* input sock */ cmp_node_displace_in, /* output sock */ cmp_node_displace_out, /* storage */ "", - /* execfunc */ node_composit_exec_displace, - /* butfunc */ NULL + /* execfunc */ node_composit_exec_displace, + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_filter.c b/source/blender/nodes/intern/CMP_nodes/CMP_filter.c index d5fb6c3d3da..408420a399c 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_filter.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_filter.c @@ -213,19 +213,6 @@ static void node_composit_exec_filter(void *data, bNode *node, bNodeStack **in, } } -static int node_composit_buts_filter(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - uiBut *bt; - - /* blend type */ - bt=uiDefButS(block, MENU, B_NODE_EXEC+node->nr, "Soften %x0|Sharpen %x1|Laplace %x2|Sobel %x3|Prewitt %x4|Kirsch %x5|Shadow %x6", - butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, - &node->custom1, 0, 0, 0, 0, ""); - uiButSetFunc(bt, node_but_title_cb, node, bt); - } - return 20; -} bNodeType cmp_node_filter= { /* type code */ CMP_NODE_FILTER, @@ -236,7 +223,8 @@ bNodeType cmp_node_filter= { /* output sock */ cmp_node_filter_out, /* storage */ "", /* execfunc */ node_composit_exec_filter, - /* butfunc */ node_composit_buts_filter + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_flip.c b/source/blender/nodes/intern/CMP_nodes/CMP_flip.c index d9f752158db..119f7542f2c 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_flip.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_flip.c @@ -85,20 +85,6 @@ static void node_composit_exec_flip(void *data, bNode *node, bNodeStack **in, bN } } -static int node_composit_buts_flip(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - uiBut *bt; - - /* flip x\y */ - bt=uiDefButS(block, MENU, B_NODE_EXEC+node->nr, "Flip X %x0|Flip Y %x1|Flip X & Y %x2", - butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, - &node->custom1, 0, 0, 0, 0, ""); - uiButSetFunc(bt, node_but_title_cb, node, bt); - } - return 20; -} - bNodeType cmp_node_flip= { /* type code */ CMP_NODE_FLIP, /* name */ "Flip", @@ -108,7 +94,8 @@ bNodeType cmp_node_flip= { /* output sock */ cmp_node_flip_out, /* storage */ "", /* execfunc */ node_composit_exec_flip, - /* butfunc */ node_composit_buts_flip + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c b/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c index f833b13d12d..fc4b0b13561 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c @@ -92,25 +92,6 @@ static void node_composit_exec_hue_sat(void *data, bNode *node, bNodeStack **in, } } -static int node_composit_buts_hue_sat(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - NodeHueSat *nhs= node->storage; - - uiBlockBeginAlign(block); - uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Hue: ", - butr->xmin, butr->ymin+40.0f, butr->xmax-butr->xmin, 20, - &nhs->hue, 0.0f, 1.0f, 100, 0, ""); - uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Sat: ", - butr->xmin, butr->ymin+20.0f, butr->xmax-butr->xmin, 20, - &nhs->sat, 0.0f, 2.0f, 100, 0, ""); - uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Val: ", - butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, - &nhs->val, 0.0f, 2.0f, 100, 0, ""); - } - return 60; -} - static void node_composit_init_hue_sat(bNode* node) { NodeHueSat *nhs= MEM_callocN(sizeof(NodeHueSat), "node hue sat"); @@ -129,8 +110,8 @@ bNodeType cmp_node_hue_sat= { /* output sock */ cmp_node_hue_sat_out, /* storage */ "NodeHueSat", /* execfunc */ node_composit_exec_hue_sat, - /* butfunc */ node_composit_buts_hue_sat, - node_composit_init_hue_sat + /* butfunc */ NULL, + /* initfunc */ node_composit_init_hue_sat }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c b/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c index 312b32a577b..79d11907bd3 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c @@ -84,16 +84,6 @@ static void node_composit_exec_idmask(void *data, bNode *node, bNodeStack **in, } -static int node_composit_buts_id_mask(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "ID:", - butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, - &node->custom1, 0, 10000, 0, 0, "Pass Index number to convert to Alpha"); - } - return 20; -} - bNodeType cmp_node_idmask= { /* type code */ CMP_NODE_ID_MASK, /* name */ "ID Mask", @@ -103,7 +93,8 @@ bNodeType cmp_node_idmask= { /* output sock */ cmp_node_idmask_out, /* storage */ "", /* execfunc */ node_composit_exec_idmask, - /* butfunc */ node_composit_buts_id_mask + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_image.c b/source/blender/nodes/intern/CMP_nodes/CMP_image.c index e96fe6479a2..b9ae376992d 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_image.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_image.c @@ -201,193 +201,6 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **in, b } }; -static void node_browse_image_cb(void *ntree_v, void *node_v) -{ - bNodeTree *ntree= ntree_v; - bNode *node= node_v; - - nodeSetActive(ntree, node); - - if(node->menunr<1) return; - if(node->menunr==32767) { /* code for Load New */ - addqueue(curarea->win, UI_BUT_EVENT, B_NODE_LOADIMAGE); - } - else { - if(node->id) node->id->us--; - node->id= BLI_findlink(&G.main->image, node->menunr-1); - id_us_plus(node->id); - - BLI_strncpy(node->name, node->id->name+2, 21); - - NodeTagChanged(ntree, node); - BKE_image_signal((Image *)node->id, node->storage, IMA_SIGNAL_USER_NEW_IMAGE); - addqueue(curarea->win, UI_BUT_EVENT, B_NODE_EXEC+node->nr); - } - node->menunr= 0; -}; - -static void node_active_cb(void *ntree_v, void *node_v) -{ - nodeSetActive(ntree_v, node_v); -}; - -static void node_image_type_cb(void *node_v, void *unused) -{ - - allqueue(REDRAWNODE, 1); -}; - -static char *node_image_type_pup(void) -{ - char *str= MEM_mallocN(256, "image type pup"); - int a; - - str[0]= 0; - - a= sprintf(str, "Image Type %%t|"); - a+= sprintf(str+a, " Image %%x%d %%i%d|", IMA_SRC_FILE, ICON_IMAGE_DEHLT); - a+= sprintf(str+a, " Movie %%x%d %%i%d|", IMA_SRC_MOVIE, ICON_SEQUENCE); - a+= sprintf(str+a, " Sequence %%x%d %%i%d|", IMA_SRC_SEQUENCE, ICON_IMAGE_COL); - a+= sprintf(str+a, " Generated %%x%d %%i%d", IMA_SRC_GENERATED, ICON_BLANK1); - - return str; -}; - -/* copy from buttons_shading.c */ -static char *layer_menu(RenderResult *rr) -{ - RenderLayer *rl; - int len= 40 + 40*BLI_countlist(&rr->layers); - short a, nr; - char *str= MEM_callocN(len, "menu layers"); - - strcpy(str, "Layer %t"); - a= strlen(str); - for(nr=0, rl= rr->layers.first; rl; rl= rl->next, nr++) { - a+= sprintf(str+a, "|%s %%x%d", rl->name, nr); - } - - return str; -}; - -static void image_layer_cb(void *ima_v, void *iuser_v) -{ - - ntreeCompositForceHidden(G.scene->nodetree); - BKE_image_multilayer_index(ima_v, iuser_v); - allqueue(REDRAWNODE, 0); -}; - -static int node_composit_buts_image(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - ImageUser *iuser= node->storage; - - if(block) { - uiBut *bt; - short dy= (short)butr->ymax-19; - char *strp; - - uiBlockBeginAlign(block); - uiBlockSetCol(block, TH_BUT_SETTING2); - - /* browse button */ - IMAnames_to_pupstring(&strp, NULL, "LOAD NEW %x32767", &(G.main->image), NULL, NULL); - node->menunr= 0; - bt= uiDefButS(block, MENU, B_NOP, strp, - butr->xmin, dy, 19, 19, - &node->menunr, 0, 0, 0, 0, "Browses existing choices"); - uiButSetFunc(bt, node_browse_image_cb, ntree, node); - if(strp) MEM_freeN(strp); - - /* Add New button */ - if(node->id==NULL) { - bt= uiDefBut(block, BUT, B_NODE_LOADIMAGE, "Load New", - butr->xmin+19, dy, (short)(butr->xmax-butr->xmin-19.0f), 19, - NULL, 0.0, 0.0, 0, 0, "Add new Image"); - uiButSetFunc(bt, node_active_cb, ntree, node); - uiBlockSetCol(block, TH_AUTO); - } - else { - /* name button + type */ - Image *ima= (Image *)node->id; - short xmin= (short)butr->xmin, xmax= (short)butr->xmax; - short width= xmax - xmin - 45; - short icon= ICON_IMAGE_DEHLT; - - if(ima->source==IMA_SRC_MOVIE) icon= ICON_SEQUENCE; - else if(ima->source==IMA_SRC_SEQUENCE) icon= ICON_IMAGE_COL; - else if(ima->source==IMA_SRC_GENERATED) icon= ICON_BLANK1; - - bt= uiDefBut(block, TEX, B_NOP, "IM:", - xmin+19, dy, width, 19, - node->id->name+2, 0.0, 19.0, 0, 0, "Image name"); - uiButSetFunc(bt, node_ID_title_cb, node, NULL); - - /* buffer type option */ - strp= node_image_type_pup(); - bt= uiDefIconTextButS(block, MENU, B_NOP, icon, strp, - xmax-26, dy, 26, 19, - &ima->source, 0.0, 19.0, 0, 0, "Image type"); - uiButSetFunc(bt, node_image_type_cb, node, ima); - MEM_freeN(strp); - - if( ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE) ) { - width= (xmax-xmin)/2; - - dy-= 19; - uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "Frs:", - xmin, dy, width, 19, - &iuser->frames, 0.0, 10000.0, 0, 0, "Amount of images used in animation"); - uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "SFra:", - xmin+width, dy, width, 19, - &iuser->sfra, 1.0, 10000.0, 0, 0, "Start frame of animation"); - dy-= 19; - uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "Offs:", - xmin, dy, width, 19, - &iuser->offset, 0.0, 10000.0, 0, 0, "Offsets the number of the frame to use in the animation"); - uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "Cycl", - xmin+width, dy, width-20, 19, - &iuser->cycl, 0.0, 0.0, 0, 0, "Make animation go cyclic"); - uiDefIconButBitS(block, TOG, IMA_ANIM_ALWAYS, B_NODE_EXEC+node->nr, ICON_AUTO, - xmax-20, dy, 20, 19, - &iuser->flag, 0.0, 0.0, 0, 0, "Always refresh Image on frame changes"); - } - if( ima->type==IMA_TYPE_MULTILAYER && ima->rr) { - RenderLayer *rl= BLI_findlink(&ima->rr->layers, iuser->layer); - if(rl) { - width= (xmax-xmin); - dy-= 19; - strp= layer_menu(ima->rr); - bt= uiDefButS(block, MENU, B_NODE_EXEC+node->nr, strp, - xmin, dy, width, 19, - &iuser->layer, 0.0, 10000.0, 0, 0, "Layer"); - uiButSetFunc(bt, image_layer_cb, ima, node->storage); - MEM_freeN(strp); - } - } - } - - } - if(node->id) { - Image *ima= (Image *)node->id; - int retval= 19; - - /* for each draw we test for anim refresh event */ - if(iuser->flag & IMA_ANIM_REFRESHED) { - iuser->flag &= ~IMA_ANIM_REFRESHED; - addqueue(curarea->win, UI_BUT_EVENT, B_NODE_EXEC+node->nr); - } - - if( ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE) ) - retval+= 38; - if( ima->type==IMA_TYPE_MULTILAYER) - retval+= 19; - return retval; - } - else - return 19; -}; - static void node_composit_init_image(bNode* node) { ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user"); @@ -406,8 +219,8 @@ bNodeType cmp_node_image= { /* output sock */ cmp_node_rlayers_out, /* storage */ "ImageUser", /* execfunc */ node_composit_exec_image, - /* butfunc */ node_composit_buts_image, - node_composit_init_image + /* butfunc */ NULL, + /* initfunc */ node_composit_init_image }; /* **************** RENDER RESULT ******************** */ @@ -513,116 +326,6 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **in, } }; -/* if we use render layers from other scene, we make a nice title */ -static void set_render_layers_title(void *node_v, void *unused) -{ - bNode *node= node_v; - Scene *sce; - SceneRenderLayer *srl; - char str[64]; - - if(node->id) { - BLI_strncpy(str, node->id->name+2, 21); - strcat(str, "|"); - sce= (Scene *)node->id; - } - else { - str[0]= 0; - sce= G.scene; - } - srl= BLI_findlink(&sce->r.layers, node->custom1); - if(srl==NULL) { - node->custom1= 0; - srl= sce->r.layers.first; - } - - strcat(str, srl->name); - BLI_strncpy(node->name, str, 32); -}; - -static char *scene_layer_menu(Scene *sce) -{ - SceneRenderLayer *srl; - int len= 40 + 40*BLI_countlist(&sce->r.layers); - short a, nr; - char *str= MEM_callocN(len, "menu layers"); - - strcpy(str, "Active Layer %t"); - a= strlen(str); - for(nr=0, srl= sce->r.layers.first; srl; srl= srl->next, nr++) { - a+= sprintf(str+a, "|%s %%x%d", srl->name, nr); - } - - return str; -}; - -static void node_browse_scene_cb(void *ntree_v, void *node_v) -{ - bNodeTree *ntree= ntree_v; - bNode *node= node_v; - Scene *sce; - - if(node->menunr<1) return; - - if(node->id) { - node->id->us--; - node->id= NULL; - } - sce= BLI_findlink(&G.main->scene, node->menunr-1); - if(sce!=G.scene) { - node->id= &sce->id; - id_us_plus(node->id); - } - - set_render_layers_title(node, NULL); - nodeSetActive(ntree, node); - - allqueue(REDRAWBUTSSHADING, 0); - allqueue(REDRAWNODE, 0); - NodeTagChanged(ntree, node); - - node->menunr= 0; -}; - -static int node_composit_buts_renderlayers(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - uiBut *bt; - char *strp; - - /* browse button scene */ - uiBlockBeginAlign(block); - IDnames_to_pupstring(&strp, NULL, "", &(G.main->scene), NULL, NULL); - node->menunr= 0; - bt= uiDefButS(block, MENU, B_NOP, strp, - butr->xmin, butr->ymin, 20, 19, - &node->menunr, 0, 0, 0, 0, "Browse Scene to use RenderLayer from"); - uiButSetFunc(bt, node_browse_scene_cb, ntree, node); - if(strp) MEM_freeN(strp); - - /* browse button layer */ - strp= scene_layer_menu(node->id?(Scene *)node->id:G.scene); - if(node->id) - bt= uiDefIconTextButS(block, MENU, B_NODE_EXEC+node->nr, ICON_SCENE_DEHLT, strp, - butr->xmin+20, butr->ymin, (butr->xmax-butr->xmin)-40, 19, - &node->custom1, 0, 0, 0, 0, "Choose Render Layer"); - else - bt= uiDefButS(block, MENU, B_NODE_EXEC+node->nr, strp, - butr->xmin+20, butr->ymin, (butr->xmax-butr->xmin)-40, 19, - &node->custom1, 0, 0, 0, 0, "Choose Render Layer"); - uiButSetFunc(bt, set_render_layers_title, node, NULL); - MEM_freeN(strp); - - /* re-render */ - /* uses custom2, not the best implementation of the world... but we need it to work now :) */ - bt= uiDefIconButS(block, TOG, B_NODE_EXEC+node->nr, ICON_SCENE, - butr->xmax-20, butr->ymin, 20, 19, - &node->custom2, 0, 0, 0, 0, "Re-render this Layer"); - - } - return 19; -}; - bNodeType cmp_node_rlayers= { /* type code */ CMP_NODE_R_LAYERS, @@ -633,8 +336,8 @@ bNodeType cmp_node_rlayers= { /* output sock */ cmp_node_rlayers_out, /* storage */ "", /* execfunc */ node_composit_exec_rlayers, - /* butfunc */ node_composit_buts_renderlayers, - NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c index f010cbf368c..0a69f2e9056 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c @@ -95,28 +95,6 @@ static void node_composit_exec_luma_matte(void *data, bNode *node, bNodeStack ** free_compbuf(cbuf); } -static int node_composit_buts_luma_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - NodeChroma *c=node->storage; - - /*tolerance sliders */ - uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "High ", - butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20, - &c->t1, 0.0f, 1.0f, 100, 0, "Values higher than this setting are 100% opaque"); - uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Low ", - butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, - &c->t2, 0.0f, 1.0f, 100, 0, "Values lower than this setting are 100% keyed"); - uiBlockEndAlign(block); - - /*keep t2 (low) less than t1 (high) */ - if(c->t2 > c->t1) { - c->t2=c->t1; - } - } - return 40; -} - static void node_composit_init_luma_matte(bNode *node) { NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma"); @@ -134,7 +112,7 @@ bNodeType cmp_node_luma_matte={ /* output sock */ cmp_node_luma_matte_out, /* storage */ "NodeChroma", /* execfunc */ node_composit_exec_luma_matte, - /* butfunc */ node_composit_buts_luma_matte, - node_composit_init_luma_matte + /* butfunc */ NULL, + /* initfunc */ node_composit_init_luma_matte }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c b/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c index a0b35ab5260..172df387dbd 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c @@ -129,16 +129,6 @@ static void node_composit_exec_mapuv(void *data, bNode *node, bNodeStack **in, b } } -static int node_composit_buts_map_uv(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Alpha:", - butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, - &node->custom1, 0, 100, 0, 0, "Conversion percentage of UV differences to Alpha"); - } - return 20; -} - bNodeType cmp_node_mapuv= { /* type code */ CMP_NODE_MAP_UV, /* name */ "Map UV", @@ -148,7 +138,8 @@ bNodeType cmp_node_mapuv= { /* output sock */ cmp_node_mapuv_out, /* storage */ "", /* execfunc */ node_composit_exec_mapuv, - /* butfunc */ node_composit_buts_map_uv + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c b/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c index 412f3b64abf..427aa01ab0a 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c @@ -73,28 +73,6 @@ static void node_composit_exec_map_value(void *data, bNode *node, bNodeStack **i } } -static int node_composit_buts_map_value(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - TexMapping *texmap= node->storage; - short xstart= (short)butr->xmin; - short dy= (short)(butr->ymax-19.0f); - short dx= (short)(butr->xmax-butr->xmin)/2; - - uiBlockBeginAlign(block); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Offs:", xstart, dy, 2*dx, 19, texmap->loc, -1000.0f, 1000.0f, 10, 2, ""); - dy-= 19; - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Size:", xstart, dy, 2*dx, 19, texmap->size, -1000.0f, 1000.0f, 10, 3, ""); - dy-= 23; - uiBlockBeginAlign(block); - uiDefButBitI(block, TOG, TEXMAP_CLIP_MIN, B_NODE_EXEC+node->nr, "Min", xstart, dy, dx, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, ""); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", xstart+dx, dy, dx, 19, texmap->min, -1000.0f, 1000.0f, 10, 2, ""); - dy-= 19; - uiDefButBitI(block, TOG, TEXMAP_CLIP_MAX, B_NODE_EXEC+node->nr, "Max", xstart, dy, dx, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, ""); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", xstart+dx, dy, dx, 19, texmap->max, -1000.0f, 1000.0f, 10, 2, ""); - } - return 80; -}; static void node_composit_init_map_value(bNode* node) { @@ -110,8 +88,8 @@ bNodeType cmp_node_map_value= { /* output sock */ cmp_node_map_value_out, /* storage */ "TexMapping", /* execfunc */ node_composit_exec_map_value, - /* butfunc */ node_composit_buts_map_value, - node_composit_init_map_value + /* butfunc */ NULL, + /* initfunc */ node_composit_init_map_value }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_math.c b/source/blender/nodes/intern/CMP_nodes/CMP_math.c index d867143d3ab..d8bb1cebbaa 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_math.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_math.c @@ -167,7 +167,8 @@ bNodeType cmp_node_math= { /* output sock */ cmp_node_math_out, /* storage */ "", /* execfunc */ node_composit_exec_math, - /* butfunc */ node_buts_math + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c index f02a73da4c0..662b8390e18 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 @@ bNodeType cmp_node_mix_rgb= { /* output sock */ cmp_node_mix_rgb_out, /* storage */ "", /* execfunc */ node_composit_exec_mix_rgb, - /* butfunc */ node_buts_mix_rgb + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_normal.c b/source/blender/nodes/intern/CMP_nodes/CMP_normal.c index 201dfcfa64f..bf103f34dee 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_normal.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_normal.c @@ -86,7 +86,8 @@ bNodeType cmp_node_normal= { /* output sock */ cmp_node_normal_out, /* storage */ "", /* execfunc */ node_composit_exec_normal, - /* butfunc */ node_buts_normal + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c index 65d3653e36d..0bec7e27211 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c @@ -79,72 +79,6 @@ static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack * } } - - -/* allocate sufficient! */ -static void node_imagetype_string(char *str) -{ - str += sprintf(str, "Save Image as: %%t|"); - str += sprintf(str, "Targa %%x%d|", R_TARGA); - str += sprintf(str, "Targa Raw %%x%d|", R_RAWTGA); - str += sprintf(str, "PNG %%x%d|", R_PNG); - str += sprintf(str, "BMP %%x%d|", R_BMP); - str += sprintf(str, "Jpeg %%x%d|", R_JPEG90); - str += sprintf(str, "Iris %%x%d|", R_IRIS); - str += sprintf(str, "Radiance HDR %%x%d|", R_RADHDR); - str += sprintf(str, "Cineon %%x%d|", R_CINEON); - str += sprintf(str, "DPX %%x%d|", R_DPX); - str += sprintf(str, "OpenEXR %%x%d", R_OPENEXR); -} - -static int node_composit_buts_output_file(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - NodeImageFile *nif= node->storage; - short x= (short)butr->xmin; - short y= (short)butr->ymin; - short w= (short)butr->xmax-butr->xmin; - char str[320]; - - node_imagetype_string(str); - - uiBlockBeginAlign(block); - - uiDefBut(block, TEX, B_NOP, "", - x, y+60, w, 20, - nif->name, 0.0f, 240.0f, 0, 0, ""); - - uiDefButS(block, MENU, B_NOP, str, - x, y+40, w, 20, - &nif->imtype, 0.0f, 1.0f, 0, 0, ""); - - if(nif->imtype==R_OPENEXR) { - uiDefButBitS(block, TOG, R_OPENEXR_HALF, B_REDR, "Half", - x, y+20, w/2, 20, - &nif->subimtype, 0, 0, 0, 0, ""); - - uiDefButS(block, MENU,B_NOP, "Codec %t|None %x0|Pxr24 (lossy) %x1|ZIP (lossless) %x2|PIZ (lossless) %x3|RLE (lossless) %x4", - x+w/2, y+20, w/2, 20, - &nif->codec, 0, 0, 0, 0, ""); - } - else { - uiDefButS(block, NUM, B_NOP, "Quality: ", - x, y+20, w, 20, - &nif->quality, 10.0f, 100.0f, 10, 0, ""); - } - - /* start frame, end frame */ - uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "SFra: ", - x, y, w/2, 20, - &nif->sfra, 1, MAXFRAMEF, 10, 0, ""); - uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "EFra: ", - x+w/2, y, w/2, 20, - &nif->efra, 1, MAXFRAMEF, 10, 0, ""); - - } - return 80; -} - static void node_composit_init_output_file(bNode *node) { NodeImageFile *nif= MEM_callocN(sizeof(NodeImageFile), "node image file"); @@ -166,8 +100,8 @@ bNodeType cmp_node_output_file= { /* output sock */ NULL, /* storage */ "NodeImageFile", /* execfunc */ node_composit_exec_output_file, - /* butfunc */ node_composit_buts_output_file, - node_composit_init_output_file + /* butfunc */ NULL, + /* initfunc */ node_composit_init_output_file }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c index d36d79b17d3..f2766d9224c 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c @@ -52,7 +52,8 @@ bNodeType cmp_node_rgb= { /* output sock */ cmp_node_rgb_out, /* storage */ "", /* execfunc */ node_composit_exec_rgb, - /* butfunc */ node_buts_rgb + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c index d2291d4d0e2..a3576a01445 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c @@ -141,5 +141,6 @@ bNodeType cmp_node_rotate= { /* output sock */ cmp_node_rotate_out, /* storage */ "", /* execfunc */ node_composit_exec_rotate, - /* butfunc */ NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_scale.c b/source/blender/nodes/intern/CMP_nodes/CMP_scale.c index 709cd5571fb..99f5eb458ce 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_scale.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_scale.c @@ -101,35 +101,6 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b } }; -static void node_scale_cb(void *node_v, void *unused_v) -{ - bNode *node= node_v; - bNodeSocket *nsock; - - /* check the 2 inputs, and set them to reasonable values */ - for(nsock= node->inputs.first; nsock; nsock= nsock->next) { - if(node->custom1==CMP_SCALE_RELATIVE) - nsock->ns.vec[0]= 1.0; - else { - if(nsock->next==NULL) - nsock->ns.vec[0]= (float)G.scene->r.ysch; - else - nsock->ns.vec[0]= (float)G.scene->r.xsch; - } - } -} - -static int node_composit_buts_scale(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - uiBut *bt= uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "Absolute", - butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, - &node->custom1, 0, 0, 0, 0, ""); - uiButSetFunc(bt, node_scale_cb, node, NULL); - } - return 20; -}; - bNodeType cmp_node_scale= { /* type code */ CMP_NODE_SCALE, /* name */ "Scale", @@ -139,7 +110,8 @@ bNodeType cmp_node_scale= { /* output sock */ cmp_node_scale_out, /* storage */ "", /* execfunc */ node_composit_exec_scale, - /* butfunc */ node_composit_buts_scale + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c index df485917a26..b3cf20f5a43 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c @@ -105,7 +105,8 @@ bNodeType cmp_node_sephsva= { /* output sock */ cmp_node_sephsva_out, /* storage */ "", /* execfunc */ node_composit_exec_sephsva, - /* butfunc */ NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; @@ -175,7 +176,8 @@ bNodeType cmp_node_combhsva= { /* output sock */ cmp_node_combhsva_out, /* storage */ "", /* execfunc */ node_composit_exec_combhsva, - /* butfunc */ NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c index 8816fabe6e2..7a323b503f0 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c @@ -83,7 +83,8 @@ bNodeType cmp_node_seprgba= { /* output sock */ cmp_node_seprgba_out, /* storage */ "", /* execfunc */ node_composit_exec_seprgba, - /* butfunc */ NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; @@ -151,7 +152,8 @@ bNodeType cmp_node_combrgba= { /* output sock */ cmp_node_combrgba_out, /* storage */ "", /* execfunc */ node_composit_exec_combrgba, - /* butfunc */ NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c index 3a1a9183ba9..108042a16b8 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c @@ -104,7 +104,8 @@ bNodeType cmp_node_sepycca= { /* output sock */ cmp_node_sepycca_out, /* storage */ "", /* execfunc */ node_composit_exec_sepycca, - /* butfunc */ NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; @@ -181,7 +182,8 @@ bNodeType cmp_node_combycca= { /* output sock */ cmp_node_combycca_out, /* storage */ "", /* execfunc */ node_composit_exec_combycca, - /* butfunc */ NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c index 6813ffd31a0..48a42d16a94 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c @@ -105,7 +105,8 @@ bNodeType cmp_node_sepyuva= { /* output sock */ cmp_node_sepyuva_out, /* storage */ "", /* execfunc */ node_composit_exec_sepyuva, - /* butfunc */ NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; @@ -175,6 +176,7 @@ bNodeType cmp_node_combyuva= { /* output sock */ cmp_node_combyuva_out, /* storage */ "", /* execfunc */ node_composit_exec_combyuva, - /* butfunc */ NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c b/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c index e46d53d528d..ecc3fb99f41 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c @@ -79,6 +79,7 @@ bNodeType cmp_node_setalpha= { /* output sock */ cmp_node_setalpha_out, /* storage */ "", /* execfunc */ node_composit_exec_setalpha, - /* butfunc */ NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c b/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c index 39b7af840b4..3e6142a6534 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c @@ -132,24 +132,6 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack * } } -static int node_composit_buts_splitviewer(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - uiBlockBeginAlign(block); - - uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "X", - butr->xmin, butr->ymin+19, (butr->xmax-butr->xmin)/2, 20, - &node->custom2, 0.0, 0.0, 0, 0, ""); - uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Y", - butr->xmin+(butr->xmax-butr->xmin)/2, butr->ymin+19, (butr->xmax-butr->xmin)/2, 20, - &node->custom2, 0.0, 1.0, 0, 0, ""); - - uiDefButS(block, NUMSLI, B_NODE_EXEC+node->nr, "Split %: ", - butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, &node->custom1, 0, 100, 10, 0, ""); - } - return 40; -} - static void node_composit_init_splitviewer(bNode* node) { ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user"); @@ -169,8 +151,8 @@ bNodeType cmp_node_splitviewer= { /* output sock */ NULL, /* storage */ "ImageUser", /* execfunc */ node_composit_exec_splitviewer, - /* butfunc */ node_composit_buts_splitviewer, - node_composit_init_splitviewer + /* butfunc */ NULL, + /* initfunc */ node_composit_init_splitviewer }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_texture.c b/source/blender/nodes/intern/CMP_nodes/CMP_texture.c index 20d428aa102..551da1e480b 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_texture.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_texture.c @@ -126,7 +126,8 @@ bNodeType cmp_node_texture= { /* output sock */ cmp_node_texture_out, /* storage */ "", /* execfunc */ node_composit_exec_texture, - /* butfunc */ node_buts_texture + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_translate.c b/source/blender/nodes/intern/CMP_nodes/CMP_translate.c index d9faa6253c9..2ea91b603d8 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_translate.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_translate.c @@ -65,6 +65,7 @@ bNodeType cmp_node_translate= { /* output sock */ cmp_node_translate_out, /* storage */ "", /* execfunc */ node_composit_exec_translate, - /* butfunc */ NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c index 75313b8a683..d30bf42d478 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c @@ -89,8 +89,8 @@ bNodeType cmp_node_valtorgb= { /* output sock */ cmp_node_valtorgb_out, /* storage */ "ColorBand", /* execfunc */ node_composit_exec_valtorgb, - /* butfunc */ node_buts_valtorgb, - node_composit_init_valtorgb + /* butfunc */ NULL, + /* initfunc */ node_composit_init_valtorgb }; @@ -142,8 +142,8 @@ bNodeType cmp_node_rgbtobw= { /* output sock */ cmp_node_rgbtobw_out, /* storage */ "", /* execfunc */ node_composit_exec_rgbtobw, - /* butfunc */ NULL, - NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_value.c b/source/blender/nodes/intern/CMP_nodes/CMP_value.c index d9dc23f35a8..578a07c91ae 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_value.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_value.c @@ -51,6 +51,7 @@ bNodeType cmp_node_value= { /* output sock */ cmp_node_value_out, /* storage */ "", /* execfunc */ node_composit_exec_value, - /* butsfunc */ node_buts_value + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c b/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c index b2658619d50..ebaf4d70915 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c @@ -125,6 +125,6 @@ bNodeType cmp_node_vecblur= { /* output sock */ cmp_node_vecblur_out, /* storage */ "NodeBlurData", /* execfunc */ node_composit_exec_vecblur, - /* butfunc */ node_composit_buts_vecblur, - node_composit_init_vecblur + /* butfunc */ NULL, + /* initfunc */ node_composit_init_vecblur }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c b/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c index 3ad6bde4c0c..1a01bb3a6a7 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c @@ -133,8 +133,8 @@ bNodeType cmp_node_viewer= { /* output sock */ NULL, /* storage */ "ImageUser", /* execfunc */ node_composit_exec_viewer, - /* butfunc */ NULL, - node_composit_init_viewer + /* butfunc */ NULL, + /* initfunc */ node_composit_init_viewer }; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c b/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c index 4391a57ebfc..716f447f3df 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c @@ -145,6 +145,7 @@ bNodeType cmp_node_zcombine= { /* output sock */ cmp_node_zcombine_out, /* storage */ "", /* execfunc */ node_composit_exec_zcombine, - /* butfunc */ NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_camera.c b/source/blender/nodes/intern/SHD_nodes/SHD_camera.c index 5f547b346e6..5134f720b9e 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_camera.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_camera.c @@ -58,7 +58,7 @@ bNodeType sh_node_camera= { /* output sock */ sh_node_camera_out, /* storage */ "node_camera", /* execfunc */ node_shader_exec_camera, - /* butfunc */ NULL, - NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_curves.c b/source/blender/nodes/intern/SHD_nodes/SHD_curves.c index 85897d42f13..39787486004 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_curves.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_curves.c @@ -65,8 +65,8 @@ bNodeType sh_node_curve_vec= { /* output sock */ sh_node_curve_vec_out, /* storage */ "CurveMapping", /* execfunc */ node_shader_exec_curve_vec, - /* butfunc */ node_buts_curvevec, - /* initfunc */ node_shader_init_curve_vec + /* butfunc */ NULL, + /* initfunc */ node_shader_init_curve_vec }; @@ -105,7 +105,7 @@ bNodeType sh_node_curve_rgb= { /* output sock */ sh_node_curve_rgb_out, /* storage */ "CurveMapping", /* execfunc */ node_shader_exec_curve_rgb, - /* butfunc */ node_buts_curvecol, - /* initfunc */ node_shader_init_curve_rgb + /* butfunc */ NULL, + /* initfunc */ node_shader_init_curve_rgb }; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_geom.c b/source/blender/nodes/intern/SHD_nodes/SHD_geom.c index ce959b5d7e6..2be1f0ddfe8 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_geom.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_geom.c @@ -108,18 +108,6 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **in, bNod } } -static int node_shader_buts_geometry(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - NodeGeometry *ngeo= (NodeGeometry*)node->storage; - - uiDefBut(block, TEX, B_NODE_EXEC+node->nr, "UV:", butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20, ngeo->uvname, 0, 31, 0, 0, "Set name of UV layer to use, default is active UV layer"); - uiDefBut(block, TEX, B_NODE_EXEC+node->nr, "Col:", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, ngeo->colname, 0, 31, 0, 0, "Set name of vertex color layer to use, default is active vertex color layer"); - } - - return 40; -} - static void node_shader_init_geometry(bNode *node) { node->storage= MEM_callocN(sizeof(NodeGeometry), "NodeGeometry"); @@ -135,7 +123,7 @@ bNodeType sh_node_geom= { /* output sock */ sh_node_geom_out, /* storage */ "NodeGeometry", /* execfunc */ node_shader_exec_geom, - /* butfunc */ node_shader_buts_geometry, - /* initfunc */ node_shader_init_geometry + /* butfunc */ NULL, + /* initfunc */ node_shader_init_geometry }; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c b/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c index 37ee7a9aac4..3a6e89cc0a1 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c @@ -63,54 +63,6 @@ static void node_shader_exec_mapping(void *data, bNode *node, bNodeStack **in, b } } -static int node_shader_buts_mapping(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - TexMapping *texmap= node->storage; - short dx= (short)((butr->xmax-butr->xmin)/7.0f); - short dy= (short)(butr->ymax-19); - - uiBlockSetFunc(block, node_texmap_cb, texmap, NULL); /* all buttons get this */ - - uiBlockBeginAlign(block); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+dx, dy, 2*dx, 19, texmap->loc, -1000.0f, 1000.0f, 10, 2, ""); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->loc+1, -1000.0f, 1000.0f, 10, 2, ""); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->loc+2, -1000.0f, 1000.0f, 10, 2, ""); - dy-= 19; - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+dx, dy, 2*dx, 19, texmap->rot, -1000.0f, 1000.0f, 1000, 1, ""); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->rot+1, -1000.0f, 1000.0f, 1000, 1, ""); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->rot+2, -1000.0f, 1000.0f, 1000, 1, ""); - dy-= 19; - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+dx, dy, 2*dx, 19, texmap->size, -1000.0f, 1000.0f, 10, 2, ""); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->size+1, -1000.0f, 1000.0f, 10, 2, ""); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->size+2, -1000.0f, 1000.0f, 10, 2, ""); - dy-= 25; - uiBlockBeginAlign(block); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+dx, dy, 2*dx, 19, texmap->min, -10.0f, 10.0f, 100, 2, ""); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->min+1, -10.0f, 10.0f, 100, 2, ""); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->min+2, -10.0f, 10.0f, 100, 2, ""); - dy-= 19; - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+dx, dy, 2*dx, 19, texmap->max, -10.0f, 10.0f, 10, 2, ""); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->max+1, -10.0f, 10.0f, 10, 2, ""); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->max+2, -10.0f, 10.0f, 10, 2, ""); - uiBlockEndAlign(block); - - /* labels/options */ - - dy= (short)(butr->ymax-19); - uiDefBut(block, LABEL, B_NOP, "Loc", butr->xmin, dy, dx, 19, NULL, 0.0f, 0.0f, 0, 0, ""); - dy-= 19; - uiDefBut(block, LABEL, B_NOP, "Rot", butr->xmin, dy, dx, 19, NULL, 0.0f, 0.0f, 0, 0, ""); - dy-= 19; - uiDefBut(block, LABEL, B_NOP, "Size", butr->xmin, dy, dx, 19, NULL, 0.0f, 0.0f, 0, 0, ""); - dy-= 25; - uiDefButBitI(block, TOG, TEXMAP_CLIP_MIN, B_NODE_EXEC+node->nr, "Min", butr->xmin, dy, dx-4, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, ""); - dy-= 19; - uiDefButBitI(block, TOG, TEXMAP_CLIP_MAX, B_NODE_EXEC+node->nr, "Max", butr->xmin, dy, dx-4, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, ""); - - } - return 5*19 + 6; -} static void node_shader_init_mapping(bNode *node) { @@ -126,8 +78,8 @@ bNodeType sh_node_mapping= { /* output sock */ sh_node_mapping_out, /* storage */ "TexMapping", /* execfunc */ node_shader_exec_mapping, - /* butfunc */ node_shader_buts_mapping, - /* initfunc */ node_shader_init_mapping + /* butfunc */ NULL, + /* initfunc */ node_shader_init_mapping }; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_material.c b/source/blender/nodes/intern/SHD_nodes/SHD_material.c index 2640f2979fd..1d87d294dbe 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_material.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_material.c @@ -128,142 +128,6 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in, } } -static void node_mat_alone_cb(void *node_v, void *unused) -{ - bNode *node= node_v; - - node->id= (ID *)copy_material((Material *)node->id); - - BIF_undo_push("Single user material"); - allqueue(REDRAWBUTSSHADING, 0); - allqueue(REDRAWNODE, 0); - allqueue(REDRAWOOPS, 0); -} - -static void node_browse_mat_cb(void *ntree_v, void *node_v) -{ - bNodeTree *ntree= ntree_v; - bNode *node= node_v; - - if(node->menunr<1) return; - - if(node->menunr==32767) { /* code for Add New */ - if(node->id) { - /* make copy, but make sure it doesnt have the node tag nor nodes */ - Material *ma= (Material *)node->id; - ma->id.us--; - ma= copy_material(ma); - ma->use_nodes= 0; - if(ma->nodetree) { - ntreeFreeTree(ma->nodetree); - MEM_freeN(ma->nodetree); - } - ma->nodetree= NULL; - node->id= (ID *)ma; - } - else node->id= (ID *)add_material("MatNode"); - } - else { - if(node->id) node->id->us--; - node->id= BLI_findlink(&G.main->mat, node->menunr-1); - id_us_plus(node->id); - } - BLI_strncpy(node->name, node->id->name+2, 21); - - nodeSetActive(ntree, node); - - allqueue(REDRAWBUTSSHADING, 0); - allqueue(REDRAWNODE, 0); - BIF_preview_changed(ID_MA); - - node->menunr= 0; -} - -static void node_new_mat_cb(void *ntree_v, void *node_v) -{ - bNodeTree *ntree= ntree_v; - bNode *node= node_v; - - node->id= (ID *)add_material("MatNode"); - BLI_strncpy(node->name, node->id->name+2, 21); - - nodeSetActive(ntree, node); - - allqueue(REDRAWBUTSSHADING, 0); - allqueue(REDRAWNODE, 0); - BIF_preview_changed(ID_MA); - -} -static int node_shader_buts_material(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - uiBut *bt; - short dx= (short)((butr->xmax-butr->xmin)/3.0f), has_us= (node->id && node->id->us>1); - short dy= (short)butr->ymin; - char *strp; - - /* WATCH IT: we use this callback in material buttons, but then only want first row */ - if(butr->ymax-butr->ymin > 21.0f) dy+= 19; - - uiBlockBeginAlign(block); - if(node->id==NULL) uiBlockSetCol(block, TH_REDALERT); - else if(has_us) uiBlockSetCol(block, TH_BUT_SETTING1); - else uiBlockSetCol(block, TH_BUT_SETTING2); - - /* browse button */ - IDnames_to_pupstring(&strp, NULL, "ADD NEW %x32767", &(G.main->mat), NULL, NULL); - node->menunr= 0; - bt= uiDefButS(block, MENU, B_NOP, strp, - butr->xmin, dy, 19, 19, - &node->menunr, 0, 0, 0, 0, "Browses existing choices or adds NEW"); - uiButSetFunc(bt, node_browse_mat_cb, ntree, node); - if(strp) MEM_freeN(strp); - - /* Add New button */ - if(node->id==NULL) { - bt= uiDefBut(block, BUT, B_NOP, "Add New", - butr->xmin+19, dy, (short)(butr->xmax-butr->xmin-19.0f), 19, - NULL, 0.0, 0.0, 0, 0, "Add new Material"); - uiButSetFunc(bt, node_new_mat_cb, ntree, node); - uiBlockSetCol(block, TH_AUTO); - } - else { - /* name button */ - short width= (short)(butr->xmax-butr->xmin-19.0f - (has_us?19.0f:0.0f)); - bt= uiDefBut(block, TEX, B_NOP, "MA:", - butr->xmin+19, dy, width, 19, - node->id->name+2, 0.0, 19.0, 0, 0, "Material name"); - uiButSetFunc(bt, node_ID_title_cb, node, NULL); - - /* user amount */ - if(has_us) { - char str1[32]; - sprintf(str1, "%d", node->id->us); - bt= uiDefBut(block, BUT, B_NOP, str1, - butr->xmax-19, dy, 19, 19, - NULL, 0, 0, 0, 0, "Displays number of users. Click to make a single-user copy."); - uiButSetFunc(bt, node_mat_alone_cb, node, NULL); - } - - /* WATCH IT: we use this callback in material buttons, but then only want first row */ - if(butr->ymax-butr->ymin > 21.0f) { - /* node options */ - uiBlockSetCol(block, TH_AUTO); - uiDefButBitS(block, TOG, SH_NODE_MAT_DIFF, B_NODE_EXEC+node->nr, "Diff", - butr->xmin, butr->ymin, dx, 19, - &node->custom1, 0, 0, 0, 0, "Material Node outputs Diffuse"); - uiDefButBitS(block, TOG, SH_NODE_MAT_SPEC, B_NODE_EXEC+node->nr, "Spec", - butr->xmin+dx, butr->ymin, dx, 19, - &node->custom1, 0, 0, 0, 0, "Material Node outputs Specular"); - uiDefButBitS(block, TOG, SH_NODE_MAT_NEG, B_NODE_EXEC+node->nr, "Neg Normal", - butr->xmax-dx, butr->ymin, dx, 19, - &node->custom1, 0, 0, 0, 0, "Material Node uses inverted Normal"); - } - } - uiBlockEndAlign(block); - } - return 38; -} static void node_shader_init_material(bNode* node) { @@ -280,8 +144,8 @@ bNodeType sh_node_material= { /* output sock */ sh_node_material_out, /* storage */ "", /* execfunc */ node_shader_exec_material, - /* butfunc */ node_shader_buts_material, - /* initfunc */ node_shader_init_material + /* butfunc */ NULL, + /* initfunc */ node_shader_init_material }; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_math.c b/source/blender/nodes/intern/SHD_nodes/SHD_math.c index 89a7f58c147..3a08c3b117c 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_math.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_math.c @@ -187,7 +187,7 @@ bNodeType sh_node_math= { /* output sock */ sh_node_math_out, /* storage */ "node_math", /* execfunc */ node_shader_exec_math, - /* butfunc */ node_buts_math, - NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c index 182daa746b0..555a8d27ab9 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c @@ -69,7 +69,7 @@ bNodeType sh_node_mix_rgb= { /* output sock */ sh_node_mix_rgb_out, /* storage */ "", /* execfunc */ node_shader_exec_mix_rgb, - /* butfunc */ node_buts_mix_rgb, - NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_normal.c b/source/blender/nodes/intern/SHD_nodes/SHD_normal.c index e92069917fc..4433e62cb25 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_normal.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_normal.c @@ -66,7 +66,7 @@ bNodeType sh_node_normal= { /* output sock */ sh_node_normal_out, /* storage */ "", /* execfunc */ node_shader_exec_normal, - /* butfunc */ node_buts_normal, - NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_output.c b/source/blender/nodes/intern/SHD_nodes/SHD_output.c index 84d72a04bde..c53d662fac7 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_output.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_output.c @@ -71,8 +71,8 @@ bNodeType sh_node_output= { /* output sock */ NULL, /* storage */ "", /* execfunc */ node_shader_exec_output, - /* butfunc */ NULL, - NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c index c4195bd60d1..21b6f4640c2 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c @@ -51,7 +51,7 @@ bNodeType sh_node_rgb= { /* output sock */ sh_node_rgb_out, /* storage */ "", /* execfunc */ node_shader_exec_rgb, - /* butfunc */ node_buts_rgb, - NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c b/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c index 341945aa523..fa9cf3a3de0 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c @@ -63,7 +63,7 @@ bNodeType sh_node_squeeze= { /* output sock */ sh_node_squeeze_out, /* storage */ "node_squeeze", /* execfunc */ node_shader_exec_squeeze, - /* butfunc */ NULL, - NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_texture.c b/source/blender/nodes/intern/SHD_nodes/SHD_texture.c index 5ea7a87af40..3da2b5cae71 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_texture.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_texture.c @@ -119,8 +119,8 @@ bNodeType sh_node_texture= { /* output sock */ sh_node_texture_out, /* storage */ "", /* execfunc */ node_shader_exec_texture, - /* butfunc */ node_buts_texture, - NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c index a8e1449ee2e..223f8fc4af8 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c @@ -68,8 +68,8 @@ bNodeType sh_node_valtorgb= { /* output sock */ sh_node_valtorgb_out, /* storage */ "ColorBand", /* execfunc */ node_shader_exec_valtorgb, - /* butfunc */ node_buts_valtorgb, - /* initfunc */ node_shader_init_valtorgb + /* butfunc */ NULL, + /* initfunc */ node_shader_init_valtorgb }; @@ -101,8 +101,8 @@ bNodeType sh_node_rgbtobw= { /* output sock */ sh_node_rgbtobw_out, /* storage */ "", /* execfunc */ node_shader_exec_rgbtobw, - /* butfunc */ NULL, - /* initfunc */ NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_value.c b/source/blender/nodes/intern/SHD_nodes/SHD_value.c index 1437f3b6b86..aeeda4734b5 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_value.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_value.c @@ -53,8 +53,8 @@ bNodeType sh_node_value= { /* output sock */ sh_node_value_out, /* storage */ "", /* execfunc */ node_shader_exec_value, - /* butfunc */ node_buts_value, - NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c b/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c index 1a21f08ee55..1d1f36b9fa5 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c @@ -99,17 +99,6 @@ static void node_shader_exec_vect_math(void *data, bNode *node, bNodeStack **in, } -static int node_shader_buts_vect_math(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) -{ - if(block) { - uiBut *bt; - - bt=uiDefButS(block, MENU, B_NODE_EXEC, "Add %x0|Subtract %x1|Average %x2|Dot Product %x3 |Cross Product %x4|Normalize %x5", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, &node->custom1, 0, 0, 0, 0, ""); - uiButSetFunc(bt, node_but_title_cb, node, bt); - } - return 20; -} - bNodeType sh_node_vect_math= { /* type code */ SH_NODE_VECT_MATH, /* name */ "Vector Math", @@ -119,7 +108,7 @@ bNodeType sh_node_vect_math= { /* output sock */ sh_node_vect_math_out, /* storage */ "node_vect_math", /* execfunc */ node_shader_exec_vect_math, - /* butfunc */ node_shader_buts_vect_math, - NULL + /* butfunc */ NULL, + /* initfunc */ NULL }; diff --git a/source/blender/src/SConscript b/source/blender/src/SConscript index 58aa3ddad88..215b0b2977a 100644 --- a/source/blender/src/SConscript +++ b/source/blender/src/SConscript @@ -22,10 +22,11 @@ incs += ' ../blenlib ../makesdna ../blenkernel' incs += ' ../include #/intern/bmfont ../imbuf ../render/extern/include' incs += ' #/intern/bsp/extern ../radiosity/extern/include' incs += ' #/intern/decimation/extern ../blenloader ../python' -incs += ' ../../kernel/gen_system #/intern/SoundSystem ../readstreamglue' +incs += ' ../../kernel/gen_system #/intern/SoundSystem ../readstreamglue ../nodes' incs += ' ../quicktime #/intern/elbeem/extern' incs += ' #/intern/ghost #/intern/opennl/extern' + incs += ' ' + env['BF_PYTHON_INC'] incs += ' ' + env['BF_SDL_INC'] incs += ' ' + env['BF_OPENGL_INC'] diff --git a/source/blender/src/drawnode.c b/source/blender/src/drawnode.c index 3e60f05eea8..7978640039f 100644 --- a/source/blender/src/drawnode.c +++ b/source/blender/src/drawnode.c @@ -58,6 +58,9 @@ #include "BKE_texture.h" #include "BKE_utildefines.h" +#include "CMP_node.h" +#include "SHD_node.h" + #include "BIF_gl.h" #include "BIF_glutil.h" #include "BIF_interface.h" @@ -86,7 +89,6 @@ #include "mydevice.h" - static void snode_drawstring(SpaceNode *snode, char *str, int okwidth) { char drawstr[NODE_MAXSTR]; @@ -174,7 +176,7 @@ static void node_sync_cb(void *snode_v, void *node_v) /* ****************** GENERAL CALLBACKS FOR NODES ***************** */ -void node_ID_title_cb(void *node_v, void *unused_v) +static void node_ID_title_cb(void *node_v, void *unused_v) { bNode *node= node_v; @@ -189,7 +191,7 @@ void node_ID_title_cb(void *node_v, void *unused_v) } -void node_but_title_cb(void *node_v, void *but_v) +static void node_but_title_cb(void *node_v, void *but_v) { bNode *node= node_v; uiBut *bt= but_v; @@ -201,7 +203,7 @@ void node_but_title_cb(void *node_v, void *but_v) /* ****************** BUTTON CALLBACKS FOR ALL TREES ***************** */ -int node_buts_group(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +static int node_buts_group(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) { if(block && node->id) { uiBut *bt; @@ -231,7 +233,7 @@ int node_buts_group(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) return 19; } -int node_buts_value(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +static int node_buts_value(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) { if(block) { bNodeSocket *sock= node->outputs.first; /* first socket stores value */ @@ -244,7 +246,7 @@ int node_buts_value(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) return 20; } -int node_buts_rgb(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +static int node_buts_rgb(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) { if(block) { bNodeSocket *sock= node->outputs.first; /* first socket stores value */ @@ -269,7 +271,7 @@ int node_buts_rgb(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) return 30 + (int)(node->width-NODE_DY); } -int node_buts_mix_rgb(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +static int node_buts_mix_rgb(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) { if(block) { uiBut *bt; @@ -290,7 +292,7 @@ int node_buts_mix_rgb(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) return 20; } -int node_buts_valtorgb(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +static int node_buts_valtorgb(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) { if(block) { if(node->storage) { @@ -300,7 +302,7 @@ int node_buts_valtorgb(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr return 40; } -int node_buts_curvevec(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +static int node_buts_curvevec(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) { if(block) { curvemap_buttons(block, node->storage, 'v', B_NODE_EXEC+node->nr, B_REDR, butr); @@ -308,7 +310,7 @@ int node_buts_curvevec(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr return (int)(node->width-NODE_DY); } -int node_buts_curvecol(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +static int node_buts_curvecol(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) { if(block) { curvemap_buttons(block, node->storage, 'c', B_NODE_EXEC+node->nr, B_REDR, butr); @@ -316,7 +318,7 @@ int node_buts_curvecol(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr return (int)(node->width-NODE_DY); } -int node_buts_normal(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +static int node_buts_normal(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) { if(block) { bNodeSocket *sock= node->outputs.first; /* first socket stores normal */ @@ -329,7 +331,7 @@ int node_buts_normal(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) return (int)(node->width-NODE_DY); } -void node_browse_tex_cb(void *ntree_v, void *node_v) +static void node_browse_tex_cb(void *ntree_v, void *node_v) { bNodeTree *ntree= ntree_v; bNode *node= node_v; @@ -356,7 +358,7 @@ void node_browse_tex_cb(void *ntree_v, void *node_v) node->menunr= 0; } -int node_buts_texture(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +static int node_buts_texture(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) { if(block) { uiBut *bt; @@ -383,7 +385,7 @@ int node_buts_texture(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) return 19; } -int node_buts_math(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +static int node_buts_math(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) { if(block) { uiBut *bt; @@ -398,7 +400,7 @@ int node_buts_math(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) /* ****************** BUTTON CALLBACKS FOR SHADER NODES ***************** */ -void node_mat_alone_cb(void *node_v, void *unused) +static void node_mat_alone_cb(void *node_v, void *unused) { bNode *node= node_v; @@ -410,7 +412,7 @@ void node_mat_alone_cb(void *node_v, void *unused) allqueue(REDRAWOOPS, 0); } -void node_browse_mat_cb(void *ntree_v, void *node_v) +static void node_browse_mat_cb(void *ntree_v, void *node_v) { bNodeTree *ntree= ntree_v; bNode *node= node_v; @@ -449,7 +451,7 @@ void node_browse_mat_cb(void *ntree_v, void *node_v) node->menunr= 0; } -void node_new_mat_cb(void *ntree_v, void *node_v) +static void node_new_mat_cb(void *ntree_v, void *node_v) { bNodeTree *ntree= ntree_v; bNode *node= node_v; @@ -465,14 +467,210 @@ void node_new_mat_cb(void *ntree_v, void *node_v) } -void node_texmap_cb(void *texmap_v, void *unused_v) +static void node_texmap_cb(void *texmap_v, void *unused_v) { init_mapping(texmap_v); } +static int node_shader_buts_material(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + uiBut *bt; + short dx= (short)((butr->xmax-butr->xmin)/3.0f), has_us= (node->id && node->id->us>1); + short dy= (short)butr->ymin; + char *strp; + + /* WATCH IT: we use this callback in material buttons, but then only want first row */ + if(butr->ymax-butr->ymin > 21.0f) dy+= 19; + + uiBlockBeginAlign(block); + if(node->id==NULL) uiBlockSetCol(block, TH_REDALERT); + else if(has_us) uiBlockSetCol(block, TH_BUT_SETTING1); + else uiBlockSetCol(block, TH_BUT_SETTING2); + + /* browse button */ + IDnames_to_pupstring(&strp, NULL, "ADD NEW %x32767", &(G.main->mat), NULL, NULL); + node->menunr= 0; + bt= uiDefButS(block, MENU, B_NOP, strp, + butr->xmin, dy, 19, 19, + &node->menunr, 0, 0, 0, 0, "Browses existing choices or adds NEW"); + uiButSetFunc(bt, node_browse_mat_cb, ntree, node); + if(strp) MEM_freeN(strp); + + /* Add New button */ + if(node->id==NULL) { + bt= uiDefBut(block, BUT, B_NOP, "Add New", + butr->xmin+19, dy, (short)(butr->xmax-butr->xmin-19.0f), 19, + NULL, 0.0, 0.0, 0, 0, "Add new Material"); + uiButSetFunc(bt, node_new_mat_cb, ntree, node); + uiBlockSetCol(block, TH_AUTO); + } + else { + /* name button */ + short width= (short)(butr->xmax-butr->xmin-19.0f - (has_us?19.0f:0.0f)); + bt= uiDefBut(block, TEX, B_NOP, "MA:", + butr->xmin+19, dy, width, 19, + node->id->name+2, 0.0, 19.0, 0, 0, "Material name"); + uiButSetFunc(bt, node_ID_title_cb, node, NULL); + + /* user amount */ + if(has_us) { + char str1[32]; + sprintf(str1, "%d", node->id->us); + bt= uiDefBut(block, BUT, B_NOP, str1, + butr->xmax-19, dy, 19, 19, + NULL, 0, 0, 0, 0, "Displays number of users. Click to make a single-user copy."); + uiButSetFunc(bt, node_mat_alone_cb, node, NULL); + } + + /* WATCH IT: we use this callback in material buttons, but then only want first row */ + if(butr->ymax-butr->ymin > 21.0f) { + /* node options */ + uiBlockSetCol(block, TH_AUTO); + uiDefButBitS(block, TOG, SH_NODE_MAT_DIFF, B_NODE_EXEC+node->nr, "Diff", + butr->xmin, butr->ymin, dx, 19, + &node->custom1, 0, 0, 0, 0, "Material Node outputs Diffuse"); + uiDefButBitS(block, TOG, SH_NODE_MAT_SPEC, B_NODE_EXEC+node->nr, "Spec", + butr->xmin+dx, butr->ymin, dx, 19, + &node->custom1, 0, 0, 0, 0, "Material Node outputs Specular"); + uiDefButBitS(block, TOG, SH_NODE_MAT_NEG, B_NODE_EXEC+node->nr, "Neg Normal", + butr->xmax-dx, butr->ymin, dx, 19, + &node->custom1, 0, 0, 0, 0, "Material Node uses inverted Normal"); + } + } + uiBlockEndAlign(block); + } + return 38; +} + +static int node_shader_buts_mapping(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + TexMapping *texmap= node->storage; + short dx= (short)((butr->xmax-butr->xmin)/7.0f); + short dy= (short)(butr->ymax-19); + + uiBlockSetFunc(block, node_texmap_cb, texmap, NULL); /* all buttons get this */ + + uiBlockBeginAlign(block); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+dx, dy, 2*dx, 19, texmap->loc, -1000.0f, 1000.0f, 10, 2, ""); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->loc+1, -1000.0f, 1000.0f, 10, 2, ""); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->loc+2, -1000.0f, 1000.0f, 10, 2, ""); + dy-= 19; + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+dx, dy, 2*dx, 19, texmap->rot, -1000.0f, 1000.0f, 1000, 1, ""); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->rot+1, -1000.0f, 1000.0f, 1000, 1, ""); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->rot+2, -1000.0f, 1000.0f, 1000, 1, ""); + dy-= 19; + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+dx, dy, 2*dx, 19, texmap->size, -1000.0f, 1000.0f, 10, 2, ""); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->size+1, -1000.0f, 1000.0f, 10, 2, ""); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->size+2, -1000.0f, 1000.0f, 10, 2, ""); + dy-= 25; + uiBlockBeginAlign(block); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+dx, dy, 2*dx, 19, texmap->min, -10.0f, 10.0f, 100, 2, ""); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->min+1, -10.0f, 10.0f, 100, 2, ""); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->min+2, -10.0f, 10.0f, 100, 2, ""); + dy-= 19; + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+dx, dy, 2*dx, 19, texmap->max, -10.0f, 10.0f, 10, 2, ""); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->max+1, -10.0f, 10.0f, 10, 2, ""); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->max+2, -10.0f, 10.0f, 10, 2, ""); + uiBlockEndAlign(block); + + /* labels/options */ + + dy= (short)(butr->ymax-19); + uiDefBut(block, LABEL, B_NOP, "Loc", butr->xmin, dy, dx, 19, NULL, 0.0f, 0.0f, 0, 0, ""); + dy-= 19; + uiDefBut(block, LABEL, B_NOP, "Rot", butr->xmin, dy, dx, 19, NULL, 0.0f, 0.0f, 0, 0, ""); + dy-= 19; + uiDefBut(block, LABEL, B_NOP, "Size", butr->xmin, dy, dx, 19, NULL, 0.0f, 0.0f, 0, 0, ""); + dy-= 25; + uiDefButBitI(block, TOG, TEXMAP_CLIP_MIN, B_NODE_EXEC+node->nr, "Min", butr->xmin, dy, dx-4, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, ""); + dy-= 19; + uiDefButBitI(block, TOG, TEXMAP_CLIP_MAX, B_NODE_EXEC+node->nr, "Max", butr->xmin, dy, dx-4, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, ""); + + } + return 5*19 + 6; +} + +static int node_shader_buts_vect_math(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + uiBut *bt; + + bt=uiDefButS(block, MENU, B_NODE_EXEC, "Add %x0|Subtract %x1|Average %x2|Dot Product %x3 |Cross Product %x4|Normalize %x5", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, &node->custom1, 0, 0, 0, 0, ""); + uiButSetFunc(bt, node_but_title_cb, node, bt); + } + return 20; +} + +static int node_shader_buts_geometry(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + NodeGeometry *ngeo= (NodeGeometry*)node->storage; + + uiDefBut(block, TEX, B_NODE_EXEC+node->nr, "UV:", butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20, ngeo->uvname, 0, 31, 0, 0, "Set name of UV layer to use, default is active UV layer"); + uiDefBut(block, TEX, B_NODE_EXEC+node->nr, "Col:", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, ngeo->colname, 0, 31, 0, 0, "Set name of vertex color layer to use, default is active vertex color layer"); + } + + return 40; +} + +/* only once called */ +static void node_shader_set_butfunc(bNodeType *ntype) +{ + switch(ntype->type) { + case NODE_GROUP: /* note, generic type, but put here because we call this function anyway */ + ntype->butfunc= node_buts_group; + break; + case SH_NODE_MATERIAL: + ntype->butfunc= node_shader_buts_material; + break; + case SH_NODE_TEXTURE: + ntype->butfunc= node_buts_texture; + break; + case SH_NODE_NORMAL: + ntype->butfunc= node_buts_normal; + break; + case SH_NODE_CURVE_VEC: + ntype->butfunc= node_buts_curvevec; + break; + case SH_NODE_CURVE_RGB: + ntype->butfunc= node_buts_curvecol; + break; + case SH_NODE_MAPPING: + ntype->butfunc= node_shader_buts_mapping; + break; + case SH_NODE_VALUE: + ntype->butfunc= node_buts_value; + break; + case SH_NODE_RGB: + ntype->butfunc= node_buts_rgb; + break; + case SH_NODE_MIX_RGB: + ntype->butfunc= node_buts_mix_rgb; + break; + case SH_NODE_VALTORGB: + ntype->butfunc= node_buts_valtorgb; + break; + case SH_NODE_MATH: + ntype->butfunc= node_buts_math; + break; + case SH_NODE_VECT_MATH: + ntype->butfunc= node_shader_buts_vect_math; + break; + case SH_NODE_GEOMETRY: + ntype->butfunc= node_shader_buts_geometry; + break; + default: + ntype->butfunc= NULL; + } +} + /* ****************** BUTTON CALLBACKS FOR COMPOSITE NODES ***************** */ -void node_browse_image_cb(void *ntree_v, void *node_v) + + +static void node_browse_image_cb(void *ntree_v, void *node_v) { bNodeTree *ntree= ntree_v; bNode *node= node_v; @@ -497,17 +695,17 @@ void node_browse_image_cb(void *ntree_v, void *node_v) node->menunr= 0; } -void node_active_cb(void *ntree_v, void *node_v) +static void node_active_cb(void *ntree_v, void *node_v) { nodeSetActive(ntree_v, node_v); } -void node_image_type_cb(void *node_v, void *unused) +static void node_image_type_cb(void *node_v, void *unused) { allqueue(REDRAWNODE, 1); } -char *node_image_type_pup(void) +static char *node_image_type_pup(void) { char *str= MEM_mallocN(256, "image type pup"); int a; @@ -524,10 +722,7 @@ char *node_image_type_pup(void) } /* copy from buttons_shading.c */ -/* renamed to deconflict with buttons shading.c */ -/*TODO: find appropriate name */ -/* -char *layer_menu2(RenderResult *rr) +static char *layer_menu(RenderResult *rr) { RenderLayer *rl; int len= 40 + 40*BLI_countlist(&rr->layers); @@ -543,8 +738,7 @@ char *layer_menu2(RenderResult *rr) return str; } -*/ -void image_layer_cb(void *ima_v, void *iuser_v) +static void image_layer_cb(void *ima_v, void *iuser_v) { ntreeCompositForceHidden(G.scene->nodetree); @@ -552,9 +746,118 @@ void image_layer_cb(void *ima_v, void *iuser_v) allqueue(REDRAWNODE, 0); } +static int node_composit_buts_image(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + ImageUser *iuser= node->storage; + + if(block) { + uiBut *bt; + short dy= (short)butr->ymax-19; + char *strp; + + uiBlockBeginAlign(block); + uiBlockSetCol(block, TH_BUT_SETTING2); + + /* browse button */ + IMAnames_to_pupstring(&strp, NULL, "LOAD NEW %x32767", &(G.main->image), NULL, NULL); + node->menunr= 0; + bt= uiDefButS(block, MENU, B_NOP, strp, + butr->xmin, dy, 19, 19, + &node->menunr, 0, 0, 0, 0, "Browses existing choices"); + uiButSetFunc(bt, node_browse_image_cb, ntree, node); + if(strp) MEM_freeN(strp); + + /* Add New button */ + if(node->id==NULL) { + bt= uiDefBut(block, BUT, B_NODE_LOADIMAGE, "Load New", + butr->xmin+19, dy, (short)(butr->xmax-butr->xmin-19.0f), 19, + NULL, 0.0, 0.0, 0, 0, "Add new Image"); + uiButSetFunc(bt, node_active_cb, ntree, node); + uiBlockSetCol(block, TH_AUTO); + } + else { + /* name button + type */ + Image *ima= (Image *)node->id; + short xmin= (short)butr->xmin, xmax= (short)butr->xmax; + short width= xmax - xmin - 45; + short icon= ICON_IMAGE_DEHLT; + + if(ima->source==IMA_SRC_MOVIE) icon= ICON_SEQUENCE; + else if(ima->source==IMA_SRC_SEQUENCE) icon= ICON_IMAGE_COL; + else if(ima->source==IMA_SRC_GENERATED) icon= ICON_BLANK1; + + bt= uiDefBut(block, TEX, B_NOP, "IM:", + xmin+19, dy, width, 19, + node->id->name+2, 0.0, 19.0, 0, 0, "Image name"); + uiButSetFunc(bt, node_ID_title_cb, node, NULL); + + /* buffer type option */ + strp= node_image_type_pup(); + bt= uiDefIconTextButS(block, MENU, B_NOP, icon, strp, + xmax-26, dy, 26, 19, + &ima->source, 0.0, 19.0, 0, 0, "Image type"); + uiButSetFunc(bt, node_image_type_cb, node, ima); + MEM_freeN(strp); + + if( ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE) ) { + width= (xmax-xmin)/2; + + dy-= 19; + uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "Frs:", + xmin, dy, width, 19, + &iuser->frames, 0.0, 10000.0, 0, 0, "Amount of images used in animation"); + uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "SFra:", + xmin+width, dy, width, 19, + &iuser->sfra, 1.0, 10000.0, 0, 0, "Start frame of animation"); + dy-= 19; + uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "Offs:", + xmin, dy, width, 19, + &iuser->offset, 0.0, 10000.0, 0, 0, "Offsets the number of the frame to use in the animation"); + uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "Cycl", + xmin+width, dy, width-20, 19, + &iuser->cycl, 0.0, 0.0, 0, 0, "Make animation go cyclic"); + uiDefIconButBitS(block, TOG, IMA_ANIM_ALWAYS, B_NODE_EXEC+node->nr, ICON_AUTO, + xmax-20, dy, 20, 19, + &iuser->flag, 0.0, 0.0, 0, 0, "Always refresh Image on frame changes"); + } + if( ima->type==IMA_TYPE_MULTILAYER && ima->rr) { + RenderLayer *rl= BLI_findlink(&ima->rr->layers, iuser->layer); + if(rl) { + width= (xmax-xmin); + dy-= 19; + strp= layer_menu(ima->rr); + bt= uiDefButS(block, MENU, B_NODE_EXEC+node->nr, strp, + xmin, dy, width, 19, + &iuser->layer, 0.0, 10000.0, 0, 0, "Layer"); + uiButSetFunc(bt, image_layer_cb, ima, node->storage); + MEM_freeN(strp); + } + } + } + + } + if(node->id) { + Image *ima= (Image *)node->id; + int retval= 19; + + /* for each draw we test for anim refresh event */ + if(iuser->flag & IMA_ANIM_REFRESHED) { + iuser->flag &= ~IMA_ANIM_REFRESHED; + addqueue(curarea->win, UI_BUT_EVENT, B_NODE_EXEC+node->nr); + } + + if( ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE) ) + retval+= 38; + if( ima->type==IMA_TYPE_MULTILAYER) + retval+= 19; + return retval; + } + else + return 19; +} /* if we use render layers from other scene, we make a nice title */ -void set_render_layers_title(void *node_v, void *unused) +static void set_render_layers_title(void *node_v, void *unused) { bNode *node= node_v; Scene *sce; @@ -580,8 +883,7 @@ void set_render_layers_title(void *node_v, void *unused) BLI_strncpy(node->name, str, 32); } -/* -char *scene_layer_menu(Scene *sce) +static char *scene_layer_menu(Scene *sce) { SceneRenderLayer *srl; int len= 40 + 40*BLI_countlist(&sce->r.layers); @@ -596,8 +898,8 @@ char *scene_layer_menu(Scene *sce) return str; } -*/ -void node_browse_scene_cb(void *ntree_v, void *node_v) + +static void node_browse_scene_cb(void *ntree_v, void *node_v) { bNodeTree *ntree= ntree_v; bNode *node= node_v; @@ -626,6 +928,715 @@ void node_browse_scene_cb(void *ntree_v, void *node_v) } +static int node_composit_buts_renderlayers(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + uiBut *bt; + char *strp; + + /* browse button scene */ + uiBlockBeginAlign(block); + IDnames_to_pupstring(&strp, NULL, "", &(G.main->scene), NULL, NULL); + node->menunr= 0; + bt= uiDefButS(block, MENU, B_NOP, strp, + butr->xmin, butr->ymin, 20, 19, + &node->menunr, 0, 0, 0, 0, "Browse Scene to use RenderLayer from"); + uiButSetFunc(bt, node_browse_scene_cb, ntree, node); + if(strp) MEM_freeN(strp); + + /* browse button layer */ + strp= scene_layer_menu(node->id?(Scene *)node->id:G.scene); + if(node->id) + bt= uiDefIconTextButS(block, MENU, B_NODE_EXEC+node->nr, ICON_SCENE_DEHLT, strp, + butr->xmin+20, butr->ymin, (butr->xmax-butr->xmin)-40, 19, + &node->custom1, 0, 0, 0, 0, "Choose Render Layer"); + else + bt= uiDefButS(block, MENU, B_NODE_EXEC+node->nr, strp, + butr->xmin+20, butr->ymin, (butr->xmax-butr->xmin)-40, 19, + &node->custom1, 0, 0, 0, 0, "Choose Render Layer"); + uiButSetFunc(bt, set_render_layers_title, node, NULL); + MEM_freeN(strp); + + /* re-render */ + /* uses custom2, not the best implementation of the world... but we need it to work now :) */ + bt= uiDefIconButS(block, TOG, B_NODE_EXEC+node->nr, ICON_SCENE, + butr->xmax-20, butr->ymin, 20, 19, + &node->custom2, 0, 0, 0, 0, "Re-render this Layer"); + + } + return 19; +} + +static int node_composit_buts_blur(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + NodeBlurData *nbd= node->storage; + uiBut *bt; + short dy= butr->ymin+38; + short dx= (butr->xmax-butr->xmin)/2; + char str[256]; + + uiBlockBeginAlign(block); + sprintf(str, "Filter Type%%t|Flat %%x%d|Tent %%x%d|Quad %%x%d|Cubic %%x%d|Gauss %%x%d|CatRom %%x%d|Mitch %%x%d", R_FILTER_BOX, R_FILTER_TENT, R_FILTER_QUAD, R_FILTER_CUBIC, R_FILTER_GAUSS, R_FILTER_CATROM, R_FILTER_MITCH); + uiDefButS(block, MENU, B_NODE_EXEC+node->nr,str, + butr->xmin, dy, dx*2, 19, + &nbd->filtertype, 0, 0, 0, 0, "Set sampling filter for blur"); + dy-=19; + uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Bokeh", + butr->xmin, dy, dx, 19, + &nbd->bokeh, 0, 0, 0, 0, "Uses circular filter, warning it's slow!"); + uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Gamma", + butr->xmin+dx, dy, dx, 19, + &nbd->gamma, 0, 0, 0, 0, "Applies filter on gamma corrected values"); + + dy-=19; + bt=uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "X:", + butr->xmin, dy, dx, 19, + &nbd->sizex, 0, 256, 0, 0, ""); + bt=uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Y:", + butr->xmin+dx, dy, dx, 19, + &nbd->sizey, 0, 256, 0, 0, ""); + } + return 57; +} + +/* qdn: defocus node */ +static int node_composit_buts_defocus(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + NodeDefocus *nqd = node->storage; + short dy = butr->ymin + 209; + short dx = butr->xmax - butr->xmin; + char* mstr1 = "Bokeh Type%t|Octagon %x8|Heptagon %x7|Hexagon %x6|Pentagon %x5|Square %x4|Triangle %x3|Disk %x0"; + + uiDefBut(block, LABEL, B_NOP, "Bokeh Type", butr->xmin, dy, dx, 19, NULL, 0, 0, 0, 0, ""); + uiDefButC(block, MENU, B_NODE_EXEC+node->nr, mstr1, + butr->xmin, dy-19, dx, 19, + &nqd->bktype, 0, 0, 0, 0, "Bokeh type"); + if (nqd->bktype) { /* for some reason rotating a disk doesn't seem to work... ;) */ + uiDefButC(block, NUM, B_NODE_EXEC+node->nr, "Rotate:", + butr->xmin, dy-38, dx, 19, + &nqd->rotation, 0, 90, 0, 0, "Bokeh shape rotation offset in degrees"); + } + uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Gamma Correct", + butr->xmin, dy-57, dx, 19, + &nqd->gamco, 0, 0, 0, 0, "Enable gamma correction before and after main process"); + if (nqd->no_zbuf==0) { + // only needed for zbuffer input + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "fStop:", + butr->xmin, dy-76, dx, 19, + &nqd->fstop, 0.5, 128, 10, 0, "Amount of focal blur, 128=infinity=perfect focus, half the value doubles the blur radius"); + } + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Maxblur:", + butr->xmin, dy-95, dx, 19, + &nqd->maxblur, 0, 10000, 1000, 0, "blur limit, maximum CoC radius, 0=no limit"); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "BThreshold:", + butr->xmin, dy-114, dx, 19, + &nqd->bthresh, 0, 100, 100, 0, "CoC radius threshold, prevents background bleed on in-focus midground, 0=off"); + uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Preview", + butr->xmin, dy-142, dx, 19, + &nqd->preview, 0, 0, 0, 0, "Enable sampling mode, useful for preview when using low samplecounts"); + if (nqd->preview) { + /* only visible when sampling mode enabled */ + uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Samples:", + butr->xmin, dy-161, dx, 19, + &nqd->samples, 16, 256, 0, 0, "Number of samples (16=grainy, higher=less noise)"); + } + uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "No zbuffer", + butr->xmin, dy-190, dx, 19, + &nqd->no_zbuf, 0, 0, 0, 0, "Enable when using an image as input instead of actual zbuffer (auto enabled if node not image based, eg. time node)"); + if (nqd->no_zbuf) { + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Zscale:", + butr->xmin, dy-209, dx, 19, + &nqd->scale, 0, 1000, 100, 0, "Scales the Z input when not using a zbuffer, controls maximum blur designated by the color white or input value 1"); + } + } + return 228; +} + +static int node_composit_buts_vecblur(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + NodeBlurData *nbd= node->storage; + short dy= butr->ymin; + short dx= (butr->xmax-butr->xmin); + + uiBlockBeginAlign(block); + uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Samples:", + butr->xmin, dy+57, dx, 19, + &nbd->samples, 1, 256, 0, 0, "Amount of samples"); + uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "MinSpeed:", + butr->xmin, dy+38, dx, 19, + &nbd->minspeed, 0, 1024, 0, 0, "Minimum speed for a pixel to be blurred, used to separate background from foreground"); + uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "MaxSpeed:", + butr->xmin, dy+19, dx, 19, + &nbd->maxspeed, 0, 1024, 0, 0, "If not zero, maximum speed in pixels"); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "BlurFac:", + butr->xmin, dy, dx, 19, + &nbd->fac, 0.0f, 2.0f, 10, 2, "Scaling factor for motion vectors, actually 'shutter speed' in frames"); + } + return 76; +} + +static int node_composit_buts_filter(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + uiBut *bt; + + /* blend type */ + bt=uiDefButS(block, MENU, B_NODE_EXEC+node->nr, "Soften %x0|Sharpen %x1|Laplace %x2|Sobel %x3|Prewitt %x4|Kirsch %x5|Shadow %x6", + butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, + &node->custom1, 0, 0, 0, 0, ""); + uiButSetFunc(bt, node_but_title_cb, node, bt); + } + return 20; +} + +static int node_composit_buts_flip(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + uiBut *bt; + + /* flip x\y */ + bt=uiDefButS(block, MENU, B_NODE_EXEC+node->nr, "Flip X %x0|Flip Y %x1|Flip X & Y %x2", + butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, + &node->custom1, 0, 0, 0, 0, ""); + uiButSetFunc(bt, node_but_title_cb, node, bt); + } + return 20; +} + +static int node_composit_buts_splitviewer(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + uiBlockBeginAlign(block); + + uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "X", + butr->xmin, butr->ymin+19, (butr->xmax-butr->xmin)/2, 20, + &node->custom2, 0.0, 0.0, 0, 0, ""); + uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Y", + butr->xmin+(butr->xmax-butr->xmin)/2, butr->ymin+19, (butr->xmax-butr->xmin)/2, 20, + &node->custom2, 0.0, 1.0, 0, 0, ""); + + uiDefButS(block, NUMSLI, B_NODE_EXEC+node->nr, "Split %: ", + butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, &node->custom1, 0, 100, 10, 0, ""); + } + return 40; +} + +static int node_composit_buts_map_value(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + TexMapping *texmap= node->storage; + short xstart= (short)butr->xmin; + short dy= (short)(butr->ymax-19.0f); + short dx= (short)(butr->xmax-butr->xmin)/2; + + uiBlockBeginAlign(block); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Offs:", xstart, dy, 2*dx, 19, texmap->loc, -1000.0f, 1000.0f, 10, 2, ""); + dy-= 19; + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Size:", xstart, dy, 2*dx, 19, texmap->size, -1000.0f, 1000.0f, 10, 3, ""); + dy-= 23; + uiBlockBeginAlign(block); + uiDefButBitI(block, TOG, TEXMAP_CLIP_MIN, B_NODE_EXEC+node->nr, "Min", xstart, dy, dx, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, ""); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", xstart+dx, dy, dx, 19, texmap->min, -1000.0f, 1000.0f, 10, 2, ""); + dy-= 19; + uiDefButBitI(block, TOG, TEXMAP_CLIP_MAX, B_NODE_EXEC+node->nr, "Max", xstart, dy, dx, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, ""); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", xstart+dx, dy, dx, 19, texmap->max, -1000.0f, 1000.0f, 10, 2, ""); + } + return 80; +} + +static int node_composit_buts_time(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + CurveMapping *cumap= node->storage; + short dx= (butr->xmax-butr->xmin)/2; + rctf *curvebutr; + + memcpy(&curvebutr, &butr, sizeof(rctf)); + curvebutr->ymin += 26; + + curvemap_buttons(block, node->storage, 's', B_NODE_EXEC+node->nr, B_REDR, curvebutr); + + cumap->flag |= CUMA_DRAW_CFRA; + if(node->custom1custom2) + cumap->black[0]= (float)(CFRA - node->custom1)/(float)(node->custom2-node->custom1); + + uiBlockBeginAlign(block); + uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Sta:", + butr->xmin, butr->ymin-22, dx, 19, + &node->custom1, 1.0, 20000.0, 0, 0, "Start frame"); + uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "End:", + butr->xmin+dx, butr->ymin-22, dx, 19, + &node->custom2, 1.0, 20000.0, 0, 0, "End frame"); + + } + + return node->width-NODE_DY; +} + +static int node_composit_buts_alphaover(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + + /* alpha type */ + uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "ConvertPremul", + butr->xmin, butr->ymin, butr->xmax-butr->xmin, 19, + &node->custom1, 0, 0, 0, 0, ""); + } + return 19; +} + +static int node_composit_buts_hue_sat(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + NodeHueSat *nhs= node->storage; + + uiBlockBeginAlign(block); + uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Hue: ", + butr->xmin, butr->ymin+40.0f, butr->xmax-butr->xmin, 20, + &nhs->hue, 0.0f, 1.0f, 100, 0, ""); + uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Sat: ", + butr->xmin, butr->ymin+20.0f, butr->xmax-butr->xmin, 20, + &nhs->sat, 0.0f, 2.0f, 100, 0, ""); + uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Val: ", + butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, + &nhs->val, 0.0f, 2.0f, 100, 0, ""); + } + return 60; +} + +static int node_composit_buts_dilateerode(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Distance:", + butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, + &node->custom2, -100, 100, 0, 0, "Distance to grow/shrink (number of iterations)"); + } + return 20; +} + +static int node_composit_buts_diff_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + short sx= (butr->xmax-butr->xmin)/4; + short dx= (butr->xmax-butr->xmin)/3; + NodeChroma *c= node->storage; + + uiBlockBeginAlign(block); + /*color space selectors*/ + uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"RGB", + butr->xmin,butr->ymin+60,sx,20, + &node->custom1,1,1, 0, 0, "RGB Color Space"); + uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"HSV", + butr->xmin+sx,butr->ymin+60,sx,20, + &node->custom1,1,2, 0, 0, "HSV Color Space"); + uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"YUV", + butr->xmin+2*sx,butr->ymin+60,sx,20, + &node->custom1,1,3, 0, 0, "YUV Color Space"); + uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"YCC", + butr->xmin+3*sx,butr->ymin+60,sx,20, + &node->custom1,1,4, 0, 0, "YCbCr Color Space"); + /*channel tolorences*/ + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, " ", + butr->xmin, butr->ymin+40, dx, 20, + &c->t1, 0.0f, 1.0f, 100, 0, "Channel 1 Tolerance"); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, " ", + butr->xmin+dx, butr->ymin+40, dx, 20, + &c->t2, 0.0f, 1.0f, 100, 0, "Channel 2 Tolorence"); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, " ", + butr->xmin+2*dx, butr->ymin+40, dx, 20, + &c->t3, 0.0f, 1.0f, 100, 0, "Channel 3 Tolorence"); + /*falloff parameters*/ + /* + uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Falloff Size ", + butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20, + &c->fsize, 0.0f, 1.0f, 100, 0, ""); + */ + uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Falloff: ", + butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20, + &c->fstrength, 0.0f, 1.0f, 100, 0, ""); + } + return 80; +} + +static int node_composit_buts_color_spill(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + short dx= (butr->xmax-butr->xmin)/3; + + NodeChroma *c=node->storage; + uiBlockBeginAlign(block); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Enhance: ", + butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20, + &c->t1, 0.0f, 0.5f, 100, 2, "Adjusts how much selected channel is affected by color spill algorithm"); + uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "R", + butr->xmin,butr->ymin,dx,20, + &node->custom1,1,1, 0, 0, "Red Spill Suppression"); + uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "G", + butr->xmin+dx,butr->ymin,dx,20, + &node->custom1,1,2, 0, 0, "Green Spill Suppression"); + uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "B", + butr->xmin+2*dx,butr->ymin,dx,20, + &node->custom1, 1, 3, 0, 0, "Blue Spill Suppression"); + uiBlockEndAlign(block); + } + return 60; + } + +static int node_composit_buts_chroma_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + short dx=(butr->xmax-butr->xmin)/2; + NodeChroma *c= node->storage; + uiBlockBeginAlign(block); + + uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Acceptance ", + butr->xmin, butr->ymin+60, butr->xmax-butr->xmin, 20, + &c->t1, 1.0f, 80.0f, 100, 0, "Tolerance for colors to be considered a keying color"); + uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Cutoff ", + butr->xmin, butr->ymin+40, butr->xmax-butr->xmin, 20, + &c->t2, 0.0f, 30.0f, 100, 0, "Colors below this will be considered as exact matches for keying color"); + + uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Lift ", + butr->xmin, butr->ymin+20, dx, 20, + &c->fsize, 0.0f, 1.0f, 100, 0, "Alpha Lift"); + uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Gain ", + butr->xmin+dx, butr->ymin+20, dx, 20, + &c->fstrength, 0.0f, 1.0f, 100, 0, "Alpha Gain"); + + uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Shadow Adjust ", + butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, + &c->t3, 0.0f, 1.0f, 100, 0, "Adjusts the brightness of any shadows captured"); + + if(c->t2 > c->t1) + c->t2=c->t1; + } + return 80; +} + +static int node_composit_buts_channel_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + short sx= (butr->xmax-butr->xmin)/4; + short cx= (butr->xmax-butr->xmin)/3; + NodeChroma *c=node->storage; + char *c1, *c2, *c3; + + /*color space selectors*/ + uiBlockBeginAlign(block); + uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"RGB", + butr->xmin,butr->ymin+60,sx,20,&node->custom1,1,1, 0, 0, "RGB Color Space"); + uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"HSV", + butr->xmin+sx,butr->ymin+60,sx,20,&node->custom1,1,2, 0, 0, "HSV Color Space"); + uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"YUV", + butr->xmin+2*sx,butr->ymin+60,sx,20,&node->custom1,1,3, 0, 0, "YUV Color Space"); + uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"YCC", + butr->xmin+3*sx,butr->ymin+60,sx,20,&node->custom1,1,4, 0, 0, "YCbCr Color Space"); + + if (node->custom1==1) { + c1="R"; c2="G"; c3="B"; + } + else if(node->custom1==2){ + c1="H"; c2="S"; c3="V"; + } + else if(node->custom1==3){ + c1="Y"; c2="U"; c3="V"; + } + else { // if(node->custom1==4){ + c1="Y"; c2="Cb"; c3="Cr"; + } + + /*channel selector */ + uiDefButS(block, ROW, B_NODE_EXEC+node->nr, c1, + butr->xmin,butr->ymin+40,cx,20,&node->custom2,1, 1, 0, 0, "Channel 1"); + uiDefButS(block, ROW, B_NODE_EXEC+node->nr, c2, + butr->xmin+cx,butr->ymin+40,cx,20,&node->custom2,1, 2, 0, 0, "Channel 2"); + uiDefButS(block, ROW, B_NODE_EXEC+node->nr, c3, + butr->xmin+cx+cx,butr->ymin+40,cx,20,&node->custom2, 1, 3, 0, 0, "Channel 3"); + + /*tolerance sliders */ + uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "High ", + butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20, + &c->t1, 0.0f, 1.0f, 100, 0, "Values higher than this setting are 100% opaque"); + uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Low ", + butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, + &c->t2, 0.0f, 1.0f, 100, 0, "Values lower than this setting are 100% keyed"); + uiBlockEndAlign(block); + + /*keep t2 (low) less than t1 (high) */ + if(c->t2 > c->t1) { + c->t2=c->t1; + } + } + return 80; +} + +static int node_composit_buts_luma_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + NodeChroma *c=node->storage; + + /*tolerance sliders */ + uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "High ", + butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20, + &c->t1, 0.0f, 1.0f, 100, 0, "Values higher than this setting are 100% opaque"); + uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Low ", + butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, + &c->t2, 0.0f, 1.0f, 100, 0, "Values lower than this setting are 100% keyed"); + uiBlockEndAlign(block); + + /*keep t2 (low) less than t1 (high) */ + if(c->t2 > c->t1) { + c->t2=c->t1; + } + } + return 40; +} + +static int node_composit_buts_map_uv(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Alpha:", + butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, + &node->custom1, 0, 100, 0, 0, "Conversion percentage of UV differences to Alpha"); + } + return 20; +} + +static int node_composit_buts_id_mask(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "ID:", + butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, + &node->custom1, 0, 10000, 0, 0, "Pass Index number to convert to Alpha"); + } + return 20; +} + + +/* allocate sufficient! */ +static void node_imagetype_string(char *str) +{ + str += sprintf(str, "Save Image as: %%t|"); + str += sprintf(str, "Targa %%x%d|", R_TARGA); + str += sprintf(str, "Targa Raw %%x%d|", R_RAWTGA); + str += sprintf(str, "PNG %%x%d|", R_PNG); + str += sprintf(str, "BMP %%x%d|", R_BMP); + str += sprintf(str, "Jpeg %%x%d|", R_JPEG90); + str += sprintf(str, "Iris %%x%d|", R_IRIS); + str += sprintf(str, "Radiance HDR %%x%d|", R_RADHDR); + str += sprintf(str, "Cineon %%x%d|", R_CINEON); + str += sprintf(str, "DPX %%x%d|", R_DPX); + str += sprintf(str, "OpenEXR %%x%d", R_OPENEXR); +} + +static int node_composit_buts_file_output(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + NodeImageFile *nif= node->storage; + short x= (short)butr->xmin; + short y= (short)butr->ymin; + short w= (short)butr->xmax-butr->xmin; + char str[320]; + + node_imagetype_string(str); + + uiBlockBeginAlign(block); + + uiDefBut(block, TEX, B_NOP, "", + x, y+60, w, 20, + nif->name, 0.0f, 240.0f, 0, 0, ""); + + uiDefButS(block, MENU, B_NOP, str, + x, y+40, w, 20, + &nif->imtype, 0.0f, 1.0f, 0, 0, ""); + + if(nif->imtype==R_OPENEXR) { + uiDefButBitS(block, TOG, R_OPENEXR_HALF, B_REDR, "Half", + x, y+20, w/2, 20, + &nif->subimtype, 0, 0, 0, 0, ""); + + uiDefButS(block, MENU,B_NOP, "Codec %t|None %x0|Pxr24 (lossy) %x1|ZIP (lossless) %x2|PIZ (lossless) %x3|RLE (lossless) %x4", + x+w/2, y+20, w/2, 20, + &nif->codec, 0, 0, 0, 0, ""); + } + else { + uiDefButS(block, NUM, B_NOP, "Quality: ", + x, y+20, w, 20, + &nif->quality, 10.0f, 100.0f, 10, 0, ""); + } + + /* start frame, end frame */ + uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "SFra: ", + x, y, w/2, 20, + &nif->sfra, 1, MAXFRAMEF, 10, 0, ""); + uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "EFra: ", + x+w/2, y, w/2, 20, + &nif->efra, 1, MAXFRAMEF, 10, 0, ""); + + } + return 80; +} + +static void node_scale_cb(void *node_v, void *unused_v) +{ + bNode *node= node_v; + bNodeSocket *nsock; + + /* check the 2 inputs, and set them to reasonable values */ + for(nsock= node->inputs.first; nsock; nsock= nsock->next) { + if(node->custom1==CMP_SCALE_RELATIVE) + nsock->ns.vec[0]= 1.0; + else { + if(nsock->next==NULL) + nsock->ns.vec[0]= (float)G.scene->r.ysch; + else + nsock->ns.vec[0]= (float)G.scene->r.xsch; + } + } +} + +static int node_composit_buts_scale(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + uiBut *bt= uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "Absolute", + butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, + &node->custom1, 0, 0, 0, 0, ""); + uiButSetFunc(bt, node_scale_cb, node, NULL); + } + return 20; +} + +/* only once called */ +static void node_composit_set_butfunc(bNodeType *ntype) +{ + switch(ntype->type) { + case NODE_GROUP: /* note, generic type, but put here because we call this function anyway */ + ntype->butfunc= node_buts_group; + break; + case CMP_NODE_IMAGE: + ntype->butfunc= node_composit_buts_image; + break; + case CMP_NODE_R_LAYERS: + ntype->butfunc= node_composit_buts_renderlayers; + break; + case CMP_NODE_NORMAL: + ntype->butfunc= node_buts_normal; + break; + case CMP_NODE_CURVE_VEC: + ntype->butfunc= node_buts_curvevec; + break; + case CMP_NODE_CURVE_RGB: + ntype->butfunc= node_buts_curvecol; + break; + case CMP_NODE_VALUE: + ntype->butfunc= node_buts_value; + break; + case CMP_NODE_RGB: + ntype->butfunc= node_buts_rgb; + break; + case CMP_NODE_FLIP: + ntype->butfunc= node_composit_buts_flip; + break; + case CMP_NODE_SPLITVIEWER: + ntype->butfunc= node_composit_buts_splitviewer; + break; + case CMP_NODE_MIX_RGB: + ntype->butfunc= node_buts_mix_rgb; + break; + case CMP_NODE_VALTORGB: + ntype->butfunc= node_buts_valtorgb; + break; + case CMP_NODE_BLUR: + ntype->butfunc= node_composit_buts_blur; + break; + /* qdn: defocus node */ + case CMP_NODE_DEFOCUS: + ntype->butfunc = node_composit_buts_defocus; + break; + case CMP_NODE_VECBLUR: + ntype->butfunc= node_composit_buts_vecblur; + break; + case CMP_NODE_FILTER: + ntype->butfunc= node_composit_buts_filter; + break; + case CMP_NODE_MAP_VALUE: + ntype->butfunc= node_composit_buts_map_value; + break; + case CMP_NODE_TIME: + ntype->butfunc= node_composit_buts_time; + break; + case CMP_NODE_ALPHAOVER: + ntype->butfunc= node_composit_buts_alphaover; + break; + case CMP_NODE_HUE_SAT: + ntype->butfunc= node_composit_buts_hue_sat; + break; + case CMP_NODE_TEXTURE: + ntype->butfunc= node_buts_texture; + break; + case CMP_NODE_DILATEERODE: + ntype->butfunc= node_composit_buts_dilateerode; + break; + case CMP_NODE_OUTPUT_FILE: + ntype->butfunc= node_composit_buts_file_output; + break; + + case CMP_NODE_DIFF_MATTE: + ntype->butfunc=node_composit_buts_diff_matte; + break; + case CMP_NODE_COLOR_SPILL: + ntype->butfunc=node_composit_buts_color_spill; + break; + case CMP_NODE_CHROMA: + ntype->butfunc=node_composit_buts_chroma_matte; + break; + case CMP_NODE_SCALE: + ntype->butfunc= node_composit_buts_scale; + break; + case CMP_NODE_CHANNEL_MATTE: + ntype->butfunc= node_composit_buts_channel_matte; + break; + case CMP_NODE_LUMA_MATTE: + ntype->butfunc= node_composit_buts_luma_matte; + break; + case CMP_NODE_MAP_UV: + ntype->butfunc= node_composit_buts_map_uv; + break; + case CMP_NODE_ID_MASK: + ntype->butfunc= node_composit_buts_id_mask; + break; + case CMP_NODE_MATH: + ntype->butfunc= node_buts_math; + break; + default: + ntype->butfunc= NULL; + } +} + + +/* ******* init draw callbacks for all tree types, only called in usiblender.c, once ************* */ + +void init_node_butfuncs(void) +{ + bNodeType **typedefs; + + /* shader nodes */ + typedefs= node_all_shaders; /* BKE_node.h */ + while( *typedefs) { + node_shader_set_butfunc(*typedefs); + typedefs++; + } + /* composit nodes */ + typedefs= node_all_composit; /* BKE_node.h */ + while( *typedefs) { + node_composit_set_butfunc(*typedefs); + typedefs++; + } +} + /* ************** Generic drawing ************** */ static void draw_nodespace_grid(SpaceNode *snode) diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c index a93b565d9d8..b81cba7d1d0 100644 --- a/source/blender/src/usiblender.c +++ b/source/blender/src/usiblender.c @@ -859,7 +859,7 @@ void BIF_init(void) initbuttons(); InitCursorData(); sound_init_listener(); - /*init_node_butfuncs();*/ /*removed because nodes now take care of themselves */ + init_node_butfuncs(); BIF_preview_init_dbase(); BIF_read_homefile(0); -- cgit v1.2.3