All UI code reverted to drawnode.c

This commit is contained in:
2007-03-25 23:54:39 +00:00
parent 8d4f2f9fe1
commit c1e9018118
62 changed files with 1205 additions and 1185 deletions

View File

@@ -190,7 +190,10 @@ struct ShadeResult;
#define SH_NODE_SQUEEZE 117 #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 */ /* the type definitions array */
static bNodeType *node_all_shaders[]; 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_MATH 247
#define CMP_NODE_LUMA_MATTE 248 #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 */ /* the type definitions array */
static bNodeType* node_all_composit[]; static bNodeType* node_all_composit[];

View File

@@ -784,8 +784,8 @@ bNode *nodeAddNodeType(bNodeTree *ntree, int type, bNodeTree *ngroup)
/* got it-bob*/ /* got it-bob*/
if(ntype->initfunc!=NULL) if(ntype->initfunc!=NULL)
ntype->initfunc(node); ntype->initfunc(node);
return node; return node;
} }
/* keep socket listorder identical, for copying links */ /* keep socket listorder identical, for copying links */

View File

@@ -98,9 +98,9 @@ void node_draw_link(struct SpaceNode *snode, struct bNodeLink *link);
void init_node_butfuncs(void); void init_node_butfuncs(void);
/* exported to CMP and SHD nodes */ /* exported to CMP and SHD nodes */
void node_ID_title_cb(void *node_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_but_title_cb(void *node_v, void *but_v);
void node_texmap_cb(void *texmap_v, void *unused_v); //void node_texmap_cb(void *texmap_v, void *unused_v);
//void node_new_mat_cb(void *ntree_v, void *node_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_browse_mat_cb(void *ntree_v, void *node_v);
//void node_mat_alone_cb(void *node_v, void *unused); //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); //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_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_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_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_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_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_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_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_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_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_math(struct uiBlock *block, struct bNodeTree *ntree, struct bNode *node, struct rctf *butr) ;
/* ************* Shader nodes ***************** */ /* ************* Shader nodes ***************** */

View File

@@ -35,17 +35,6 @@
#include "BKE_node.h" #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 ****************** */ /* ****************** types array for all composite nodes ****************** */

View File

@@ -35,10 +35,6 @@
#include "BKE_node.h" #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 */ /* the type definitions array */
/* ****************** types array for all shaders ****************** */ /* ****************** types array for all shaders ****************** */

View File

@@ -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= { bNodeType cmp_node_alphaover= {
/* type code */ CMP_NODE_ALPHAOVER, /* type code */ CMP_NODE_ALPHAOVER,
/* name */ "AlphaOver", /* name */ "AlphaOver",
@@ -128,7 +116,8 @@ bNodeType cmp_node_alphaover= {
/* output sock */ cmp_node_alphaover_out, /* output sock */ cmp_node_alphaover_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_alphaover, /* execfunc */ node_composit_exec_alphaover,
/* butfunc */ node_composit_buts_alphaover /* butfunc */ NULL,
/*initfunc */ NULL
}; };

View File

@@ -611,39 +611,6 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
free_compbuf(img); 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) static void node_composit_init_blur(bNode* node)
{ {
node->storage= MEM_callocN(sizeof(NodeBlurData), "node blur data"); node->storage= MEM_callocN(sizeof(NodeBlurData), "node blur data");
@@ -658,8 +625,8 @@ bNodeType cmp_node_blur= {
/* output sock */ cmp_node_blur_out, /* output sock */ cmp_node_blur_out,
/* storage */ "NodeBlurData", /* storage */ "NodeBlurData",
/* execfunc */ node_composit_exec_blur, /* execfunc */ node_composit_exec_blur,
/* butfunc */ node_composit_buts_blur, /* butfunc */ NULL,
node_composit_init_blur /*initfunc */ node_composit_init_blur
}; };

View File

@@ -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) static void node_composit_init_channel_matte(bNode *node)
{ {
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma"); NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
@@ -255,6 +198,6 @@ bNodeType cmp_node_channel_matte={
/* output sock */ cmp_node_channel_matte_out, /* output sock */ cmp_node_channel_matte_out,
/* storage */ "NodeChroma", /* storage */ "NodeChroma",
/* execfunc */ node_composit_exec_channel_matte, /* execfunc */ node_composit_exec_channel_matte,
/* butfunc */ node_composit_buts_channel_matte, /* butfunc */ NULL,
node_composit_init_channel_matte node_composit_init_channel_matte
}; };

View File

@@ -160,36 +160,6 @@ static void node_composit_exec_chroma_matte(void *data, bNode *node, bNodeStack
free_compbuf(cbuf); 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) static void node_composit_init_chroma_matte(bNode *node)
{ {
@@ -211,7 +181,7 @@ bNodeType cmp_node_chroma={
/* output sock */ cmp_node_chroma_out, /* output sock */ cmp_node_chroma_out,
/* storage */ "NodeChroma", /* storage */ "NodeChroma",
/* execfunc */ node_composit_exec_chroma_matte, /* execfunc */ node_composit_exec_chroma_matte,
/* butfunc */ node_composit_buts_chroma_matte, /* butfunc */ NULL,
node_composit_init_chroma_matte node_composit_init_chroma_matte
}; };

View File

@@ -113,30 +113,6 @@ static void node_composit_exec_color_spill(void *data, bNode *node, bNodeStack *
free_compbuf(cbuf); 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) static void node_composit_init_color_spill(bNode *node)
{ {
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma"); NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
@@ -158,7 +134,7 @@ bNodeType cmp_node_color_spill={
/* output sock */ cmp_node_color_spill_out, /* output sock */ cmp_node_color_spill_out,
/* storage */ "NodeChroma", /* storage */ "NodeChroma",
/* execfunc */ node_composit_exec_color_spill, /* execfunc */ node_composit_exec_color_spill,
/* butfunc */ node_composit_buts_color_spill, /* butfunc */ NULL,
node_composit_init_color_spill node_composit_init_color_spill
}; };

View File

@@ -96,5 +96,6 @@ bNodeType cmp_node_composite= {
/* output sock */ NULL, /* output sock */ NULL,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_composite, /* execfunc */ node_composit_exec_composite,
/* butfunc */ NULL /* butfunc */ NULL,
/*initfunc */ NULL
}; };

View File

@@ -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->custom1<node->custom2)
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) static void node_composit_init_curves_time(bNode* node)
{ {
node->custom1= G.scene->r.sfra; node->custom1= G.scene->r.sfra;
@@ -96,8 +67,8 @@ bNodeType cmp_node_curve_time= {
/* output sock */ cmp_node_time_out, /* output sock */ cmp_node_time_out,
/* storage */ "CurveMapping", /* storage */ "CurveMapping",
/* execfunc */ node_composit_exec_curves_time, /* execfunc */ node_composit_exec_curves_time,
/* butfunc */ node_composit_buts_curves_time, /* butfunc */ NULL,
node_composit_init_curves_time /* initfunc */ node_composit_init_curves_time
}; };
@@ -135,8 +106,8 @@ bNodeType cmp_node_curve_vec= {
/* output sock */ cmp_node_curve_vec_out, /* output sock */ cmp_node_curve_vec_out,
/* storage */ "CurveMapping", /* storage */ "CurveMapping",
/* execfunc */ node_composit_exec_curve_vec, /* execfunc */ node_composit_exec_curve_vec,
/* butfunc */ node_buts_curvevec, /* butfunc */ NULL,
node_composit_init_curve_vec /* initfunc */ node_composit_init_curve_vec
}; };
@@ -217,7 +188,7 @@ bNodeType cmp_node_curve_rgb= {
/* output sock */ cmp_node_curve_rgb_out, /* output sock */ cmp_node_curve_rgb_out,
/* storage */ "CurveMapping", /* storage */ "CurveMapping",
/* execfunc */ node_composit_exec_curve_rgb, /* execfunc */ node_composit_exec_curve_rgb,
/* butfunc */ node_buts_curvecol, /* butfunc */ NULL,
node_composit_init_curve_rgb /* initfunc */ node_composit_init_curve_rgb
}; };

View File

@@ -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); 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) static void node_composit_init_defocus(bNode* node)
{ {
/* qdn: defocus node */ /* qdn: defocus node */
@@ -868,8 +814,8 @@ bNodeType cmp_node_defocus = {
/* output sock */ cmp_node_defocus_out, /* output sock */ cmp_node_defocus_out,
/* storage */ "NodeDefocus", /* storage */ "NodeDefocus",
/* execfunc */ node_composit_exec_defocus, /* execfunc */ node_composit_exec_defocus,
/* butfunc */ node_composit_buts_defocus, /* butfunc */ NULL,
node_composit_init_defocus /* initfunc */ node_composit_init_defocus
}; };

View File

@@ -185,50 +185,6 @@ static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack **
free_compbuf(inbuf); 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) static void node_composit_init_diff_matte(bNode *node)
{ {
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma"); NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
@@ -250,8 +206,8 @@ bNodeType cmp_node_diff_matte={
/* output sock */ cmp_node_diff_matte_out, /* output sock */ cmp_node_diff_matte_out,
/* storage */ "NodeChroma", /* storage */ "NodeChroma",
/* execfunc */ node_composit_exec_diff_matte, /* execfunc */ node_composit_exec_diff_matte,
/* butfunc */ node_composit_buts_diff_matte, /* butfunc */ NULL,
node_composit_init_diff_matte /* initfunc */ node_composit_init_diff_matte
}; };

View File

@@ -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= { bNodeType cmp_node_dilateerode= {
/* type code */ CMP_NODE_DILATEERODE, /* type code */ CMP_NODE_DILATEERODE,
/* name */ "Dilate/Erode", /* name */ "Dilate/Erode",
@@ -162,7 +152,8 @@ bNodeType cmp_node_dilateerode= {
/* output sock */ cmp_node_dilateerode_out, /* output sock */ cmp_node_dilateerode_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_dilateerode, /* execfunc */ node_composit_exec_dilateerode,
/* butfunc */ node_composit_buts_dilateerode /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -152,7 +152,8 @@ bNodeType cmp_node_displace= {
/* input sock */ cmp_node_displace_in, /* input sock */ cmp_node_displace_in,
/* output sock */ cmp_node_displace_out, /* output sock */ cmp_node_displace_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_displace, /* execfunc */ node_composit_exec_displace,
/* butfunc */ NULL /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -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= { bNodeType cmp_node_filter= {
/* type code */ CMP_NODE_FILTER, /* type code */ CMP_NODE_FILTER,
@@ -236,7 +223,8 @@ bNodeType cmp_node_filter= {
/* output sock */ cmp_node_filter_out, /* output sock */ cmp_node_filter_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_filter, /* execfunc */ node_composit_exec_filter,
/* butfunc */ node_composit_buts_filter /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -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= { bNodeType cmp_node_flip= {
/* type code */ CMP_NODE_FLIP, /* type code */ CMP_NODE_FLIP,
/* name */ "Flip", /* name */ "Flip",
@@ -108,7 +94,8 @@ bNodeType cmp_node_flip= {
/* output sock */ cmp_node_flip_out, /* output sock */ cmp_node_flip_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_flip, /* execfunc */ node_composit_exec_flip,
/* butfunc */ node_composit_buts_flip /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -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) static void node_composit_init_hue_sat(bNode* node)
{ {
NodeHueSat *nhs= MEM_callocN(sizeof(NodeHueSat), "node hue sat"); 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, /* output sock */ cmp_node_hue_sat_out,
/* storage */ "NodeHueSat", /* storage */ "NodeHueSat",
/* execfunc */ node_composit_exec_hue_sat, /* execfunc */ node_composit_exec_hue_sat,
/* butfunc */ node_composit_buts_hue_sat, /* butfunc */ NULL,
node_composit_init_hue_sat /* initfunc */ node_composit_init_hue_sat
}; };

View File

@@ -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= { bNodeType cmp_node_idmask= {
/* type code */ CMP_NODE_ID_MASK, /* type code */ CMP_NODE_ID_MASK,
/* name */ "ID Mask", /* name */ "ID Mask",
@@ -103,7 +93,8 @@ bNodeType cmp_node_idmask= {
/* output sock */ cmp_node_idmask_out, /* output sock */ cmp_node_idmask_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_idmask, /* execfunc */ node_composit_exec_idmask,
/* butfunc */ node_composit_buts_id_mask /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -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) static void node_composit_init_image(bNode* node)
{ {
ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user"); ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
@@ -406,8 +219,8 @@ bNodeType cmp_node_image= {
/* output sock */ cmp_node_rlayers_out, /* output sock */ cmp_node_rlayers_out,
/* storage */ "ImageUser", /* storage */ "ImageUser",
/* execfunc */ node_composit_exec_image, /* execfunc */ node_composit_exec_image,
/* butfunc */ node_composit_buts_image, /* butfunc */ NULL,
node_composit_init_image /* initfunc */ node_composit_init_image
}; };
/* **************** RENDER RESULT ******************** */ /* **************** 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= { bNodeType cmp_node_rlayers= {
/* type code */ CMP_NODE_R_LAYERS, /* type code */ CMP_NODE_R_LAYERS,
@@ -633,8 +336,8 @@ bNodeType cmp_node_rlayers= {
/* output sock */ cmp_node_rlayers_out, /* output sock */ cmp_node_rlayers_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_rlayers, /* execfunc */ node_composit_exec_rlayers,
/* butfunc */ node_composit_buts_renderlayers, /* butfunc */ NULL,
NULL /* initfunc */ NULL
}; };

View File

@@ -95,28 +95,6 @@ static void node_composit_exec_luma_matte(void *data, bNode *node, bNodeStack **
free_compbuf(cbuf); 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) static void node_composit_init_luma_matte(bNode *node)
{ {
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma"); NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
@@ -134,7 +112,7 @@ bNodeType cmp_node_luma_matte={
/* output sock */ cmp_node_luma_matte_out, /* output sock */ cmp_node_luma_matte_out,
/* storage */ "NodeChroma", /* storage */ "NodeChroma",
/* execfunc */ node_composit_exec_luma_matte, /* execfunc */ node_composit_exec_luma_matte,
/* butfunc */ node_composit_buts_luma_matte, /* butfunc */ NULL,
node_composit_init_luma_matte /* initfunc */ node_composit_init_luma_matte
}; };

View File

@@ -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= { bNodeType cmp_node_mapuv= {
/* type code */ CMP_NODE_MAP_UV, /* type code */ CMP_NODE_MAP_UV,
/* name */ "Map UV", /* name */ "Map UV",
@@ -148,7 +138,8 @@ bNodeType cmp_node_mapuv= {
/* output sock */ cmp_node_mapuv_out, /* output sock */ cmp_node_mapuv_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_mapuv, /* execfunc */ node_composit_exec_mapuv,
/* butfunc */ node_composit_buts_map_uv /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -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) 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, /* output sock */ cmp_node_map_value_out,
/* storage */ "TexMapping", /* storage */ "TexMapping",
/* execfunc */ node_composit_exec_map_value, /* execfunc */ node_composit_exec_map_value,
/* butfunc */ node_composit_buts_map_value, /* butfunc */ NULL,
node_composit_init_map_value /* initfunc */ node_composit_init_map_value
}; };

View File

@@ -167,7 +167,8 @@ bNodeType cmp_node_math= {
/* output sock */ cmp_node_math_out, /* output sock */ cmp_node_math_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_math, /* execfunc */ node_composit_exec_math,
/* butfunc */ node_buts_math /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -86,6 +86,7 @@ bNodeType cmp_node_mix_rgb= {
/* output sock */ cmp_node_mix_rgb_out, /* output sock */ cmp_node_mix_rgb_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_mix_rgb, /* execfunc */ node_composit_exec_mix_rgb,
/* butfunc */ node_buts_mix_rgb /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -86,7 +86,8 @@ bNodeType cmp_node_normal= {
/* output sock */ cmp_node_normal_out, /* output sock */ cmp_node_normal_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_normal, /* execfunc */ node_composit_exec_normal,
/* butfunc */ node_buts_normal /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -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) static void node_composit_init_output_file(bNode *node)
{ {
NodeImageFile *nif= MEM_callocN(sizeof(NodeImageFile), "node image file"); NodeImageFile *nif= MEM_callocN(sizeof(NodeImageFile), "node image file");
@@ -166,8 +100,8 @@ bNodeType cmp_node_output_file= {
/* output sock */ NULL, /* output sock */ NULL,
/* storage */ "NodeImageFile", /* storage */ "NodeImageFile",
/* execfunc */ node_composit_exec_output_file, /* execfunc */ node_composit_exec_output_file,
/* butfunc */ node_composit_buts_output_file, /* butfunc */ NULL,
node_composit_init_output_file /* initfunc */ node_composit_init_output_file
}; };

View File

@@ -52,7 +52,8 @@ bNodeType cmp_node_rgb= {
/* output sock */ cmp_node_rgb_out, /* output sock */ cmp_node_rgb_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_rgb, /* execfunc */ node_composit_exec_rgb,
/* butfunc */ node_buts_rgb /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -141,5 +141,6 @@ bNodeType cmp_node_rotate= {
/* output sock */ cmp_node_rotate_out, /* output sock */ cmp_node_rotate_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_rotate, /* execfunc */ node_composit_exec_rotate,
/* butfunc */ NULL /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -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= { bNodeType cmp_node_scale= {
/* type code */ CMP_NODE_SCALE, /* type code */ CMP_NODE_SCALE,
/* name */ "Scale", /* name */ "Scale",
@@ -139,7 +110,8 @@ bNodeType cmp_node_scale= {
/* output sock */ cmp_node_scale_out, /* output sock */ cmp_node_scale_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_scale, /* execfunc */ node_composit_exec_scale,
/* butfunc */ node_composit_buts_scale /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -105,7 +105,8 @@ bNodeType cmp_node_sephsva= {
/* output sock */ cmp_node_sephsva_out, /* output sock */ cmp_node_sephsva_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_sephsva, /* 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, /* output sock */ cmp_node_combhsva_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_combhsva, /* execfunc */ node_composit_exec_combhsva,
/* butfunc */ NULL /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -83,7 +83,8 @@ bNodeType cmp_node_seprgba= {
/* output sock */ cmp_node_seprgba_out, /* output sock */ cmp_node_seprgba_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_seprgba, /* 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, /* output sock */ cmp_node_combrgba_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_combrgba, /* execfunc */ node_composit_exec_combrgba,
/* butfunc */ NULL /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -104,7 +104,8 @@ bNodeType cmp_node_sepycca= {
/* output sock */ cmp_node_sepycca_out, /* output sock */ cmp_node_sepycca_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_sepycca, /* 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, /* output sock */ cmp_node_combycca_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_combycca, /* execfunc */ node_composit_exec_combycca,
/* butfunc */ NULL /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -105,7 +105,8 @@ bNodeType cmp_node_sepyuva= {
/* output sock */ cmp_node_sepyuva_out, /* output sock */ cmp_node_sepyuva_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_sepyuva, /* 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, /* output sock */ cmp_node_combyuva_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_combyuva, /* execfunc */ node_composit_exec_combyuva,
/* butfunc */ NULL /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -79,6 +79,7 @@ bNodeType cmp_node_setalpha= {
/* output sock */ cmp_node_setalpha_out, /* output sock */ cmp_node_setalpha_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_setalpha, /* execfunc */ node_composit_exec_setalpha,
/* butfunc */ NULL /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -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) static void node_composit_init_splitviewer(bNode* node)
{ {
ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user"); ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
@@ -169,8 +151,8 @@ bNodeType cmp_node_splitviewer= {
/* output sock */ NULL, /* output sock */ NULL,
/* storage */ "ImageUser", /* storage */ "ImageUser",
/* execfunc */ node_composit_exec_splitviewer, /* execfunc */ node_composit_exec_splitviewer,
/* butfunc */ node_composit_buts_splitviewer, /* butfunc */ NULL,
node_composit_init_splitviewer /* initfunc */ node_composit_init_splitviewer
}; };

View File

@@ -126,7 +126,8 @@ bNodeType cmp_node_texture= {
/* output sock */ cmp_node_texture_out, /* output sock */ cmp_node_texture_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_texture, /* execfunc */ node_composit_exec_texture,
/* butfunc */ node_buts_texture /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -65,6 +65,7 @@ bNodeType cmp_node_translate= {
/* output sock */ cmp_node_translate_out, /* output sock */ cmp_node_translate_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_translate, /* execfunc */ node_composit_exec_translate,
/* butfunc */ NULL /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -89,8 +89,8 @@ bNodeType cmp_node_valtorgb= {
/* output sock */ cmp_node_valtorgb_out, /* output sock */ cmp_node_valtorgb_out,
/* storage */ "ColorBand", /* storage */ "ColorBand",
/* execfunc */ node_composit_exec_valtorgb, /* execfunc */ node_composit_exec_valtorgb,
/* butfunc */ node_buts_valtorgb, /* butfunc */ NULL,
node_composit_init_valtorgb /* initfunc */ node_composit_init_valtorgb
}; };
@@ -142,8 +142,8 @@ bNodeType cmp_node_rgbtobw= {
/* output sock */ cmp_node_rgbtobw_out, /* output sock */ cmp_node_rgbtobw_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_rgbtobw, /* execfunc */ node_composit_exec_rgbtobw,
/* butfunc */ NULL, /* butfunc */ NULL,
NULL /* initfunc */ NULL
}; };

View File

@@ -51,6 +51,7 @@ bNodeType cmp_node_value= {
/* output sock */ cmp_node_value_out, /* output sock */ cmp_node_value_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_value, /* execfunc */ node_composit_exec_value,
/* butsfunc */ node_buts_value /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -125,6 +125,6 @@ bNodeType cmp_node_vecblur= {
/* output sock */ cmp_node_vecblur_out, /* output sock */ cmp_node_vecblur_out,
/* storage */ "NodeBlurData", /* storage */ "NodeBlurData",
/* execfunc */ node_composit_exec_vecblur, /* execfunc */ node_composit_exec_vecblur,
/* butfunc */ node_composit_buts_vecblur, /* butfunc */ NULL,
node_composit_init_vecblur /* initfunc */ node_composit_init_vecblur
}; };

View File

@@ -133,8 +133,8 @@ bNodeType cmp_node_viewer= {
/* output sock */ NULL, /* output sock */ NULL,
/* storage */ "ImageUser", /* storage */ "ImageUser",
/* execfunc */ node_composit_exec_viewer, /* execfunc */ node_composit_exec_viewer,
/* butfunc */ NULL, /* butfunc */ NULL,
node_composit_init_viewer /* initfunc */ node_composit_init_viewer
}; };

View File

@@ -145,6 +145,7 @@ bNodeType cmp_node_zcombine= {
/* output sock */ cmp_node_zcombine_out, /* output sock */ cmp_node_zcombine_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_composit_exec_zcombine, /* execfunc */ node_composit_exec_zcombine,
/* butfunc */ NULL /* butfunc */ NULL,
/* initfunc */ NULL
}; };

View File

@@ -58,7 +58,7 @@ bNodeType sh_node_camera= {
/* output sock */ sh_node_camera_out, /* output sock */ sh_node_camera_out,
/* storage */ "node_camera", /* storage */ "node_camera",
/* execfunc */ node_shader_exec_camera, /* execfunc */ node_shader_exec_camera,
/* butfunc */ NULL, /* butfunc */ NULL,
NULL /* initfunc */ NULL
}; };

View File

@@ -65,8 +65,8 @@ bNodeType sh_node_curve_vec= {
/* output sock */ sh_node_curve_vec_out, /* output sock */ sh_node_curve_vec_out,
/* storage */ "CurveMapping", /* storage */ "CurveMapping",
/* execfunc */ node_shader_exec_curve_vec, /* execfunc */ node_shader_exec_curve_vec,
/* butfunc */ node_buts_curvevec, /* butfunc */ NULL,
/* initfunc */ node_shader_init_curve_vec /* initfunc */ node_shader_init_curve_vec
}; };
@@ -105,7 +105,7 @@ bNodeType sh_node_curve_rgb= {
/* output sock */ sh_node_curve_rgb_out, /* output sock */ sh_node_curve_rgb_out,
/* storage */ "CurveMapping", /* storage */ "CurveMapping",
/* execfunc */ node_shader_exec_curve_rgb, /* execfunc */ node_shader_exec_curve_rgb,
/* butfunc */ node_buts_curvecol, /* butfunc */ NULL,
/* initfunc */ node_shader_init_curve_rgb /* initfunc */ node_shader_init_curve_rgb
}; };

View File

@@ -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) static void node_shader_init_geometry(bNode *node)
{ {
node->storage= MEM_callocN(sizeof(NodeGeometry), "NodeGeometry"); node->storage= MEM_callocN(sizeof(NodeGeometry), "NodeGeometry");
@@ -135,7 +123,7 @@ bNodeType sh_node_geom= {
/* output sock */ sh_node_geom_out, /* output sock */ sh_node_geom_out,
/* storage */ "NodeGeometry", /* storage */ "NodeGeometry",
/* execfunc */ node_shader_exec_geom, /* execfunc */ node_shader_exec_geom,
/* butfunc */ node_shader_buts_geometry, /* butfunc */ NULL,
/* initfunc */ node_shader_init_geometry /* initfunc */ node_shader_init_geometry
}; };

View File

@@ -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) static void node_shader_init_mapping(bNode *node)
{ {
@@ -126,8 +78,8 @@ bNodeType sh_node_mapping= {
/* output sock */ sh_node_mapping_out, /* output sock */ sh_node_mapping_out,
/* storage */ "TexMapping", /* storage */ "TexMapping",
/* execfunc */ node_shader_exec_mapping, /* execfunc */ node_shader_exec_mapping,
/* butfunc */ node_shader_buts_mapping, /* butfunc */ NULL,
/* initfunc */ node_shader_init_mapping /* initfunc */ node_shader_init_mapping
}; };

View File

@@ -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) static void node_shader_init_material(bNode* node)
{ {
@@ -280,8 +144,8 @@ bNodeType sh_node_material= {
/* output sock */ sh_node_material_out, /* output sock */ sh_node_material_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_shader_exec_material, /* execfunc */ node_shader_exec_material,
/* butfunc */ node_shader_buts_material, /* butfunc */ NULL,
/* initfunc */ node_shader_init_material /* initfunc */ node_shader_init_material
}; };

View File

@@ -187,7 +187,7 @@ bNodeType sh_node_math= {
/* output sock */ sh_node_math_out, /* output sock */ sh_node_math_out,
/* storage */ "node_math", /* storage */ "node_math",
/* execfunc */ node_shader_exec_math, /* execfunc */ node_shader_exec_math,
/* butfunc */ node_buts_math, /* butfunc */ NULL,
NULL /* initfunc */ NULL
}; };

View File

@@ -69,7 +69,7 @@ bNodeType sh_node_mix_rgb= {
/* output sock */ sh_node_mix_rgb_out, /* output sock */ sh_node_mix_rgb_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_shader_exec_mix_rgb, /* execfunc */ node_shader_exec_mix_rgb,
/* butfunc */ node_buts_mix_rgb, /* butfunc */ NULL,
NULL /* initfunc */ NULL
}; };

View File

@@ -66,7 +66,7 @@ bNodeType sh_node_normal= {
/* output sock */ sh_node_normal_out, /* output sock */ sh_node_normal_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_shader_exec_normal, /* execfunc */ node_shader_exec_normal,
/* butfunc */ node_buts_normal, /* butfunc */ NULL,
NULL /* initfunc */ NULL
}; };

View File

@@ -71,8 +71,8 @@ bNodeType sh_node_output= {
/* output sock */ NULL, /* output sock */ NULL,
/* storage */ "", /* storage */ "",
/* execfunc */ node_shader_exec_output, /* execfunc */ node_shader_exec_output,
/* butfunc */ NULL, /* butfunc */ NULL,
NULL /* initfunc */ NULL
}; };

View File

@@ -51,7 +51,7 @@ bNodeType sh_node_rgb= {
/* output sock */ sh_node_rgb_out, /* output sock */ sh_node_rgb_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_shader_exec_rgb, /* execfunc */ node_shader_exec_rgb,
/* butfunc */ node_buts_rgb, /* butfunc */ NULL,
NULL /* initfunc */ NULL
}; };

View File

@@ -63,7 +63,7 @@ bNodeType sh_node_squeeze= {
/* output sock */ sh_node_squeeze_out, /* output sock */ sh_node_squeeze_out,
/* storage */ "node_squeeze", /* storage */ "node_squeeze",
/* execfunc */ node_shader_exec_squeeze, /* execfunc */ node_shader_exec_squeeze,
/* butfunc */ NULL, /* butfunc */ NULL,
NULL /* initfunc */ NULL
}; };

View File

@@ -119,8 +119,8 @@ bNodeType sh_node_texture= {
/* output sock */ sh_node_texture_out, /* output sock */ sh_node_texture_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_shader_exec_texture, /* execfunc */ node_shader_exec_texture,
/* butfunc */ node_buts_texture, /* butfunc */ NULL,
NULL /* initfunc */ NULL
}; };

View File

@@ -68,8 +68,8 @@ bNodeType sh_node_valtorgb= {
/* output sock */ sh_node_valtorgb_out, /* output sock */ sh_node_valtorgb_out,
/* storage */ "ColorBand", /* storage */ "ColorBand",
/* execfunc */ node_shader_exec_valtorgb, /* execfunc */ node_shader_exec_valtorgb,
/* butfunc */ node_buts_valtorgb, /* butfunc */ NULL,
/* initfunc */ node_shader_init_valtorgb /* initfunc */ node_shader_init_valtorgb
}; };
@@ -101,8 +101,8 @@ bNodeType sh_node_rgbtobw= {
/* output sock */ sh_node_rgbtobw_out, /* output sock */ sh_node_rgbtobw_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_shader_exec_rgbtobw, /* execfunc */ node_shader_exec_rgbtobw,
/* butfunc */ NULL, /* butfunc */ NULL,
/* initfunc */ NULL /* initfunc */ NULL
}; };

View File

@@ -53,8 +53,8 @@ bNodeType sh_node_value= {
/* output sock */ sh_node_value_out, /* output sock */ sh_node_value_out,
/* storage */ "", /* storage */ "",
/* execfunc */ node_shader_exec_value, /* execfunc */ node_shader_exec_value,
/* butfunc */ node_buts_value, /* butfunc */ NULL,
NULL /* initfunc */ NULL
}; };

View File

@@ -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= { bNodeType sh_node_vect_math= {
/* type code */ SH_NODE_VECT_MATH, /* type code */ SH_NODE_VECT_MATH,
/* name */ "Vector Math", /* name */ "Vector Math",
@@ -119,7 +108,7 @@ bNodeType sh_node_vect_math= {
/* output sock */ sh_node_vect_math_out, /* output sock */ sh_node_vect_math_out,
/* storage */ "node_vect_math", /* storage */ "node_vect_math",
/* execfunc */ node_shader_exec_vect_math, /* execfunc */ node_shader_exec_vect_math,
/* butfunc */ node_shader_buts_vect_math, /* butfunc */ NULL,
NULL /* initfunc */ NULL
}; };

View File

@@ -22,10 +22,11 @@ incs += ' ../blenlib ../makesdna ../blenkernel'
incs += ' ../include #/intern/bmfont ../imbuf ../render/extern/include' incs += ' ../include #/intern/bmfont ../imbuf ../render/extern/include'
incs += ' #/intern/bsp/extern ../radiosity/extern/include' incs += ' #/intern/bsp/extern ../radiosity/extern/include'
incs += ' #/intern/decimation/extern ../blenloader ../python' 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 += ' ../quicktime #/intern/elbeem/extern'
incs += ' #/intern/ghost #/intern/opennl/extern' incs += ' #/intern/ghost #/intern/opennl/extern'
incs += ' ' + env['BF_PYTHON_INC'] incs += ' ' + env['BF_PYTHON_INC']
incs += ' ' + env['BF_SDL_INC'] incs += ' ' + env['BF_SDL_INC']
incs += ' ' + env['BF_OPENGL_INC'] incs += ' ' + env['BF_OPENGL_INC']

File diff suppressed because it is too large Load Diff

View File

@@ -859,7 +859,7 @@ void BIF_init(void)
initbuttons(); initbuttons();
InitCursorData(); InitCursorData();
sound_init_listener(); sound_init_listener();
/*init_node_butfuncs();*/ /*removed because nodes now take care of themselves */ init_node_butfuncs();
BIF_preview_init_dbase(); BIF_preview_init_dbase();
BIF_read_homefile(0); BIF_read_homefile(0);