diff options
Diffstat (limited to 'source/blender/nodes/texture/nodes')
23 files changed, 205 insertions, 184 deletions
diff --git a/source/blender/nodes/texture/nodes/node_texture_at.c b/source/blender/nodes/texture/nodes/node_texture_at.c index 4c2d276b902..ef930a39fe3 100644 --- a/source/blender/nodes/texture/nodes/node_texture_at.c +++ b/source/blender/nodes/texture/nodes/node_texture_at.c @@ -53,19 +53,19 @@ static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack ** tex_input_rgba(out, in[0], &np, thread); } -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &colorfn, data); + tex_output(node, execdata, in, out[0], &colorfn, data); } -void register_node_type_tex_at(bNodeTreeType *ttype) +void register_node_type_tex_at() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_AT, "At", NODE_CLASS_DISTORT, 0); + tex_node_type_base(&ntype, TEX_NODE_AT, "At", NODE_CLASS_DISTORT, 0); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 140, 100, 320); - node_type_exec(&ntype, exec); + node_type_exec(&ntype, NULL, NULL, exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_bricks.c b/source/blender/nodes/texture/nodes/node_texture_bricks.c index b4f81f08e43..afcbf4216c3 100644 --- a/source/blender/nodes/texture/nodes/node_texture_bricks.c +++ b/source/blender/nodes/texture/nodes/node_texture_bricks.c @@ -50,7 +50,7 @@ static bNodeSocketTemplate outputs[] = { { -1, 0, "" } }; -static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp)) +static void init(bNodeTree *UNUSED(ntree), bNode *node) { node->custom3 = 0.5; /* offset */ node->custom4 = 1.0; /* squash */ @@ -116,20 +116,20 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor } } -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &colorfn, data); + tex_output(node, execdata, in, out[0], &colorfn, data); } -void register_node_type_tex_bricks(bNodeTreeType *ttype) +void register_node_type_tex_bricks() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_BRICKS, "Bricks", NODE_CLASS_PATTERN, NODE_PREVIEW|NODE_OPTIONS); + tex_node_type_base(&ntype, TEX_NODE_BRICKS, "Bricks", NODE_CLASS_PATTERN, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 150, 60, 150); node_type_init(&ntype, init); - node_type_exec(&ntype, exec); + node_type_exec(&ntype, NULL, NULL, exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_checker.c b/source/blender/nodes/texture/nodes/node_texture_checker.c index 1f653d1f7b9..53c91db0312 100644 --- a/source/blender/nodes/texture/nodes/node_texture_checker.c +++ b/source/blender/nodes/texture/nodes/node_texture_checker.c @@ -65,19 +65,19 @@ static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack ** } } -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &colorfn, data); + tex_output(node, execdata, in, out[0], &colorfn, data); } -void register_node_type_tex_checker(bNodeTreeType *ttype) +void register_node_type_tex_checker() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_CHECKER, "Checker", NODE_CLASS_PATTERN, NODE_PREVIEW|NODE_OPTIONS); + tex_node_type_base(&ntype, TEX_NODE_CHECKER, "Checker", NODE_CLASS_PATTERN, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 100, 60, 150); - node_type_exec(&ntype, exec); + node_type_exec(&ntype, NULL, NULL, exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_common.c b/source/blender/nodes/texture/nodes/node_texture_common.c index aa427ff3587..2af2a3a1999 100644 --- a/source/blender/nodes/texture/nodes/node_texture_common.c +++ b/source/blender/nodes/texture/nodes/node_texture_common.c @@ -38,9 +38,12 @@ #include "BKE_node.h" #include "node_texture_util.h" +#include "NOD_common.h" #include "node_common.h" #include "node_exec.h" +#include "RNA_access.h" + static void copy_stack(bNodeStack *to, bNodeStack *from) { if (to != from) { @@ -55,7 +58,7 @@ static void copy_stack(bNodeStack *to, bNodeStack *from) /**** GROUP ****/ -static void *group_initexec(bNode *node) +static void *group_initexec(bNodeExecContext *context, bNode *node, bNodeInstanceKey key) { bNodeTree *ngroup= (bNodeTree*)node->id; void *exec; @@ -64,7 +67,7 @@ static void *group_initexec(bNode *node) return NULL; /* initialize the internal node tree execution */ - exec = ntreeTexBeginExecTree(ngroup, 0); + exec = ntreeTexBeginExecTree_internal(context, ngroup, key); return exec; } @@ -73,43 +76,56 @@ static void group_freeexec(bNode *UNUSED(node), void *nodedata) { bNodeTreeExec*gexec= (bNodeTreeExec*)nodedata; - ntreeTexEndExecTree(gexec, 0); + ntreeTexEndExecTree_internal(gexec); } /* Copy inputs to the internal stack. * This is a shallow copy, no buffers are duplicated here! */ -static void group_copy_inputs(bNode *node, bNodeStack **in, bNodeStack *gstack) +static void group_copy_inputs(bNode *gnode, bNodeStack **in, bNodeStack *gstack) { + bNodeTree *ngroup = (bNodeTree*)gnode->id; + bNode *node; bNodeSocket *sock; bNodeStack *ns; int a; - for (sock=node->inputs.first, a=0; sock; sock=sock->next, ++a) { - if (sock->groupsock) { - ns = node_get_socket_stack(gstack, sock->groupsock); - copy_stack(ns, in[a]); + + for (node = ngroup->nodes.first; node; node = node->next) { + if (node->type == NODE_GROUP_INPUT) { + for (sock = node->outputs.first, a = 0; sock; sock = sock->next, ++a) { + ns = node_get_socket_stack(gstack, sock); + if (ns) + copy_stack(ns, in[a]); + } } } } /* Copy internal results to the external outputs. */ -static void group_copy_outputs(bNode *node, bNodeStack **out, bNodeStack *gstack) +static void group_copy_outputs(bNode *gnode, bNodeStack **out, bNodeStack *gstack) { + bNodeTree *ngroup = (bNodeTree*)gnode->id; + bNode *node; bNodeSocket *sock; bNodeStack *ns; int a; - for (sock=node->outputs.first, a=0; sock; sock=sock->next, ++a) { - if (sock->groupsock) { - ns = node_get_socket_stack(gstack, sock->groupsock); - copy_stack(out[a], ns); + + for (node = ngroup->nodes.first; node; node = node->next) { + if (node->type == NODE_GROUP_OUTPUT && (node->flag & NODE_DO_OUTPUT)) { + for (sock = node->inputs.first, a = 0; sock; sock = sock->next, ++a) { + ns = node_get_socket_stack(gstack, sock); + if (ns) + copy_stack(out[a], ns); + } + break; /* only one active output node */ } } } -static void group_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out) +static void group_execute(void *data, int thread, struct bNode *node, bNodeExecData *execdata, struct bNodeStack **in, struct bNodeStack **out) { - bNodeTreeExec *exec= (bNodeTreeExec*)nodedata; + bNodeTreeExec *exec= execdata->data; bNodeThreadStack *nts; if (!exec) @@ -133,20 +149,27 @@ static void group_execute(void *data, int thread, struct bNode *node, void *node ntreeReleaseThreadStack(nts); } -void register_node_type_tex_group(bNodeTreeType *ttype) +void register_node_type_tex_group() { static bNodeType ntype; - node_type_base(ttype, &ntype, NODE_GROUP, "Group", NODE_CLASS_GROUP, NODE_OPTIONS|NODE_CONST_OUTPUT); + /* NB: cannot use sh_node_type_base for node group, because it would map the node type + * to the shared NODE_GROUP integer type id. + */ + node_type_base_custom(&ntype, "TextureNodeGroup", "Group", NODE_CLASS_GROUP, NODE_OPTIONS | NODE_CONST_OUTPUT); + ntype.type = NODE_GROUP; + ntype.poll = tex_node_poll_default; + ntype.update_internal_links = node_update_internal_links_default; + ntype.ext.srna = RNA_struct_find("TextureNodeGroup"); + BLI_assert(ntype.ext.srna != NULL); + RNA_struct_blender_type_set(ntype.ext.srna, &ntype); + node_type_socket_templates(&ntype, NULL, NULL); node_type_size(&ntype, 120, 60, 200); node_type_label(&ntype, node_group_label); - node_type_init(&ntype, node_group_init); - node_type_valid(&ntype, node_group_valid); - node_type_template(&ntype, node_group_template); node_type_update(&ntype, NULL, node_group_verify); - node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear); - node_type_exec_new(&ntype, group_initexec, group_freeexec, group_execute); + strcpy(ntype.group_tree_idname, "TextureNodeTree"); + node_type_exec(&ntype, group_initexec, group_freeexec, group_execute); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_compose.c b/source/blender/nodes/texture/nodes/node_texture_compose.c index 43a8ba1babf..ddaae829da9 100644 --- a/source/blender/nodes/texture/nodes/node_texture_compose.c +++ b/source/blender/nodes/texture/nodes/node_texture_compose.c @@ -52,19 +52,19 @@ static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack ** out[i] = tex_input_value(in[i], p, thread); } -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &colorfn, data); + tex_output(node, execdata, in, out[0], &colorfn, data); } -void register_node_type_tex_compose(bNodeTreeType *ttype) +void register_node_type_tex_compose() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_COMPOSE, "Combine RGBA", NODE_CLASS_OP_COLOR, 0); + tex_node_type_base(&ntype, TEX_NODE_COMPOSE, "Combine RGBA", NODE_CLASS_OP_COLOR, 0); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 100, 60, 150); - node_type_exec(&ntype, exec); + node_type_exec(&ntype, NULL, NULL, exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_coord.c b/source/blender/nodes/texture/nodes/node_texture_coord.c index 971520ebc38..94793288ec3 100644 --- a/source/blender/nodes/texture/nodes/node_texture_coord.c +++ b/source/blender/nodes/texture/nodes/node_texture_coord.c @@ -43,20 +43,20 @@ static void vectorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack * copy_v3_v3(out, p->co); } -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &vectorfn, data); + tex_output(node, execdata, in, out[0], &vectorfn, data); } -void register_node_type_tex_coord(bNodeTreeType *ttype) +void register_node_type_tex_coord() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_COORD, "Coordinates", NODE_CLASS_INPUT, NODE_OPTIONS); + tex_node_type_base(&ntype, TEX_NODE_COORD, "Coordinates", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, outputs); node_type_size(&ntype, 120, 110, 160); node_type_storage(&ntype, "node_coord", NULL, NULL); - node_type_exec(&ntype, exec); + node_type_exec(&ntype, NULL, NULL, exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_curves.c b/source/blender/nodes/texture/nodes/node_texture_curves.c index 5980f938938..94235eae93c 100644 --- a/source/blender/nodes/texture/nodes/node_texture_curves.c +++ b/source/blender/nodes/texture/nodes/node_texture_curves.c @@ -54,32 +54,31 @@ static void time_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNU out[0] = CLAMPIS(fac, 0.0f, 1.0f); } -static void time_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void time_exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &time_colorfn, data); + tex_output(node, execdata, in, out[0], &time_colorfn, data); } -static void time_init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp)) +static void time_init(bNodeTree *UNUSED(ntree), bNode *node) { node->custom1= 1; node->custom2= 250; node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); } -void register_node_type_tex_curve_time(bNodeTreeType *ttype) +void register_node_type_tex_curve_time() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_CURVE_TIME, "Time", NODE_CLASS_INPUT, NODE_OPTIONS); + tex_node_type_base(&ntype, TEX_NODE_CURVE_TIME, "Time", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, time_outputs); node_type_size(&ntype, 140, 100, 320); node_type_init(&ntype, time_init); node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); - node_type_exec(&ntype, time_exec); - node_type_exec_new(&ntype, node_initexec_curves, NULL, NULL); /* only for its initexec func */ + node_type_exec(&ntype, node_initexec_curves, NULL, time_exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } /* **************** CURVE RGB ******************** */ @@ -102,27 +101,26 @@ static void rgb_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, out[3] = cin[3]; } -static void rgb_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void rgb_exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &rgb_colorfn, data); + tex_output(node, execdata, in, out[0], &rgb_colorfn, data); } -static void rgb_init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp)) +static void rgb_init(bNodeTree *UNUSED(ntree), bNode *node) { node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f); } -void register_node_type_tex_curve_rgb(bNodeTreeType *ttype) +void register_node_type_tex_curve_rgb() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + tex_node_type_base(&ntype, TEX_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, rgb_inputs, rgb_outputs); node_type_size(&ntype, 200, 140, 320); node_type_init(&ntype, rgb_init); node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); - node_type_exec(&ntype, rgb_exec); - node_type_exec_new(&ntype, node_initexec_curves, NULL, NULL); /* only for its initexec func */ + node_type_exec(&ntype, node_initexec_curves, NULL, rgb_exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_decompose.c b/source/blender/nodes/texture/nodes/node_texture_decompose.c index 0866428ca6c..fa2c1d6398f 100644 --- a/source/blender/nodes/texture/nodes/node_texture_decompose.c +++ b/source/blender/nodes/texture/nodes/node_texture_decompose.c @@ -70,22 +70,22 @@ static void valuefn_a(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack *out = out[3]; } -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &valuefn_r, data); - tex_output(node, in, out[1], &valuefn_g, data); - tex_output(node, in, out[2], &valuefn_b, data); - tex_output(node, in, out[3], &valuefn_a, data); + tex_output(node, execdata, in, out[0], &valuefn_r, data); + tex_output(node, execdata, in, out[1], &valuefn_g, data); + tex_output(node, execdata, in, out[2], &valuefn_b, data); + tex_output(node, execdata, in, out[3], &valuefn_a, data); } -void register_node_type_tex_decompose(bNodeTreeType *ttype) +void register_node_type_tex_decompose() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_DECOMPOSE, "Separate RGBA", NODE_CLASS_OP_COLOR, 0); + tex_node_type_base(&ntype, TEX_NODE_DECOMPOSE, "Separate RGBA", NODE_CLASS_OP_COLOR, 0); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 100, 60, 150); - node_type_exec(&ntype, exec); + node_type_exec(&ntype, NULL, NULL, exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_distance.c b/source/blender/nodes/texture/nodes/node_texture_distance.c index 8c3b1555d5d..fefa093481d 100644 --- a/source/blender/nodes/texture/nodes/node_texture_distance.c +++ b/source/blender/nodes/texture/nodes/node_texture_distance.c @@ -56,20 +56,20 @@ static void valuefn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack ** *out = len_v3v3(co2, co1); } -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &valuefn, data); + tex_output(node, execdata, in, out[0], &valuefn, data); } -void register_node_type_tex_distance(bNodeTreeType *ttype) +void register_node_type_tex_distance() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_DISTANCE, "Distance", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + tex_node_type_base(&ntype, TEX_NODE_DISTANCE, "Distance", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 120, 110, 160); node_type_storage(&ntype, "node_distance", NULL, NULL); - node_type_exec(&ntype, exec); + node_type_exec(&ntype, NULL, NULL, exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c index b5e9969a830..c5acf01801c 100644 --- a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c +++ b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c @@ -87,19 +87,19 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor out[3] = col[3]; } -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &colorfn, data); + tex_output(node, execdata, in, out[0], &colorfn, data); } -void register_node_type_tex_hue_sat(bNodeTreeType *ttype) +void register_node_type_tex_hue_sat() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + tex_node_type_base(&ntype, TEX_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 150, 80, 250); - node_type_exec(&ntype, exec); + node_type_exec(&ntype, NULL, NULL, exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_image.c b/source/blender/nodes/texture/nodes/node_texture_image.c index 2ef1669a266..e897b0e4e96 100644 --- a/source/blender/nodes/texture/nodes/node_texture_image.c +++ b/source/blender/nodes/texture/nodes/node_texture_image.c @@ -83,12 +83,12 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(i } } -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &colorfn, data); + tex_output(node, execdata, in, out[0], &colorfn, data); } -static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp)) +static void init(bNodeTree *UNUSED(ntree), bNode *node) { ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user"); node->storage= iuser; @@ -97,16 +97,16 @@ static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(nt iuser->ok= 1; } -void register_node_type_tex_image(bNodeTreeType *ttype) +void register_node_type_tex_image() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); + tex_node_type_base(&ntype, TEX_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, outputs); node_type_size(&ntype, 120, 80, 300); node_type_init(&ntype, init); node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); - node_type_exec(&ntype, exec); + node_type_exec(&ntype, NULL, NULL, exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_invert.c b/source/blender/nodes/texture/nodes/node_texture_invert.c index 9c2963d2dc2..aa394bff8bc 100644 --- a/source/blender/nodes/texture/nodes/node_texture_invert.c +++ b/source/blender/nodes/texture/nodes/node_texture_invert.c @@ -58,19 +58,19 @@ static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack ** out[3] = col[3]; } -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &colorfn, data); + tex_output(node, execdata, in, out[0], &colorfn, data); } -void register_node_type_tex_invert(bNodeTreeType *ttype) +void register_node_type_tex_invert() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + tex_node_type_base(&ntype, TEX_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 90, 80, 100); - node_type_exec(&ntype, exec); + node_type_exec(&ntype, NULL, NULL, exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c index 95d70ccc7d6..e83579070a9 100644 --- a/source/blender/nodes/texture/nodes/node_texture_math.c +++ b/source/blender/nodes/texture/nodes/node_texture_math.c @@ -181,21 +181,21 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor } } -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &valuefn, data); + tex_output(node, execdata, in, out[0], &valuefn, data); } -void register_node_type_tex_math(bNodeTreeType *ttype) +void register_node_type_tex_math() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + tex_node_type_base(&ntype, TEX_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 120, 110, 160); node_type_label(&ntype, node_math_label); node_type_storage(&ntype, "node_math", NULL, NULL); - node_type_exec(&ntype, exec); + node_type_exec(&ntype, NULL, NULL, exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c index fe04854c734..7a68af4b1e2 100644 --- a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c +++ b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c @@ -59,20 +59,20 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor ramp_blend(node->custom1, out, fac, col2); } -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &colorfn, data); + tex_output(node, execdata, in, out[0], &colorfn, data); } -void register_node_type_tex_mix_rgb(bNodeTreeType *ttype) +void register_node_type_tex_mix_rgb() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + tex_node_type_base(&ntype, TEX_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 100, 60, 150); node_type_label(&ntype, node_blend_label); - node_type_exec(&ntype, exec); + node_type_exec(&ntype, NULL, NULL, exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_output.c b/source/blender/nodes/texture/nodes/node_texture_output.c index 2f5efe8c45e..8c8f7622d29 100644 --- a/source/blender/nodes/texture/nodes/node_texture_output.c +++ b/source/blender/nodes/texture/nodes/node_texture_output.c @@ -41,7 +41,7 @@ static bNodeSocketTemplate inputs[] = { }; /* applies to render pipeline */ -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) +static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **UNUSED(out)) { TexCallData *cdata = (TexCallData *)data; TexResult *target = cdata->target; @@ -54,7 +54,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(o tex_input_rgba(&target->tr, in[1], ¶ms, cdata->thread); else tex_input_rgba(&target->tr, in[0], ¶ms, cdata->thread); - tex_do_preview(node, params.co, &target->tr); + tex_do_preview(execdata->preview, params.co, &target->tr); } else { /* 0 means don't care, so just use first */ @@ -141,7 +141,7 @@ static void assign_index(struct bNode *node) node->custom1 = index; } -static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp)) +static void init(bNodeTree *UNUSED(ntree), bNode *node) { TexNodeOutput *tno = MEM_callocN(sizeof(TexNodeOutput), "TEX_output"); node->storage= tno; @@ -151,26 +151,26 @@ static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(nt assign_index(node); } -static void copy(bNode *orig, bNode *new) +static void copy(bNodeTree *dest_ntree, bNode *dest_node, bNode *src_node) { - node_copy_standard_storage(orig, new); - unique_name(new); - assign_index(new); + node_copy_standard_storage(dest_ntree, dest_node, src_node); + unique_name(dest_node); + assign_index(dest_node); } -void register_node_type_tex_output(bNodeTreeType *ttype) +void register_node_type_tex_output() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_OUTPUT, "Output", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS); + tex_node_type_base(&ntype, TEX_NODE_OUTPUT, "Output", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, NULL); node_type_size(&ntype, 150, 60, 200); node_type_init(&ntype, init); node_type_storage(&ntype, "TexNodeOutput", node_free_standard_storage, copy); - node_type_exec(&ntype, exec); + node_type_exec(&ntype, NULL, NULL, exec); /* Do not allow muting output. */ node_type_internal_links(&ntype, NULL); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_proc.c b/source/blender/nodes/texture/nodes/node_texture_proc.c index de2dac22d81..504e77ebb27 100644 --- a/source/blender/nodes/texture/nodes/node_texture_proc.c +++ b/source/blender/nodes/texture/nodes/node_texture_proc.c @@ -129,11 +129,11 @@ static int count_outputs(bNode *node) { \ texfn(result, p, node, in, 1, &name##_map_inputs, thread); \ } \ - static void name##_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) \ + static void name##_exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) \ { \ int outs = count_outputs(node); \ - if (outs >= 1) tex_output(node, in, out[0], &name##_colorfn, data); \ - if (outs >= 2) tex_output(node, in, out[1], &name##_normalfn, data); \ + if (outs >= 1) tex_output(node, execdata, in, out[0], &name##_colorfn, data); \ + if (outs >= 2) tex_output(node, execdata, in, out[1], &name##_normalfn, data); \ } @@ -281,7 +281,7 @@ ProcDef(stucci) /* --- */ -static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp)) +static void init(bNodeTree *UNUSED(ntree), bNode *node) { Tex *tex = MEM_callocN(sizeof(Tex), "Tex"); node->storage= tex; @@ -296,18 +296,18 @@ static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(nt /* Node type definitions */ #define TexDef(TEXTYPE, outputs, name, Name) \ -void register_node_type_tex_proc_##name(bNodeTreeType *ttype) \ +void register_node_type_tex_proc_##name() \ { \ static bNodeType ntype; \ \ - node_type_base(ttype, &ntype, TEX_NODE_PROC+TEXTYPE, Name, NODE_CLASS_TEXTURE, NODE_PREVIEW|NODE_OPTIONS); \ + tex_node_type_base(&ntype, TEX_NODE_PROC+TEXTYPE, Name, NODE_CLASS_TEXTURE, NODE_PREVIEW|NODE_OPTIONS); \ node_type_socket_templates(&ntype, name##_inputs, outputs); \ node_type_size(&ntype, 140, 80, 140); \ node_type_init(&ntype, init); \ node_type_storage(&ntype, "Tex", node_free_standard_storage, node_copy_standard_storage); \ - node_type_exec(&ntype, name##_exec); \ + node_type_exec(&ntype, NULL, NULL, name##_exec); \ \ - nodeRegisterType(ttype, &ntype); \ + nodeRegisterType(&ntype); \ } #define C outputs_color_only diff --git a/source/blender/nodes/texture/nodes/node_texture_rotate.c b/source/blender/nodes/texture/nodes/node_texture_rotate.c index 1b1d57044a3..8f3f66dbee4 100644 --- a/source/blender/nodes/texture/nodes/node_texture_rotate.c +++ b/source/blender/nodes/texture/nodes/node_texture_rotate.c @@ -90,19 +90,19 @@ static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack ** tex_input_rgba(out, in[0], &np, thread); } } -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &colorfn, data); + tex_output(node, execdata, in, out[0], &colorfn, data); } -void register_node_type_tex_rotate(bNodeTreeType *ttype) +void register_node_type_tex_rotate() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, NODE_OPTIONS); + tex_node_type_base(&ntype, TEX_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 140, 100, 320); - node_type_exec(&ntype, exec); + node_type_exec(&ntype, NULL, NULL, exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_scale.c b/source/blender/nodes/texture/nodes/node_texture_scale.c index 56562724fb9..67e0c064b7c 100644 --- a/source/blender/nodes/texture/nodes/node_texture_scale.c +++ b/source/blender/nodes/texture/nodes/node_texture_scale.c @@ -63,19 +63,19 @@ static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack ** tex_input_rgba(out, in[0], &np, thread); } -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &colorfn, data); + tex_output(node, execdata, in, out[0], &colorfn, data); } -void register_node_type_tex_scale(bNodeTreeType *ttype) +void register_node_type_tex_scale() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, NODE_OPTIONS); + tex_node_type_base(&ntype, TEX_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 90, 80, 100); - node_type_exec(&ntype, exec); + node_type_exec(&ntype, NULL, NULL, exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_texture.c b/source/blender/nodes/texture/nodes/node_texture_texture.c index f839f485976..9970c3c2a26 100644 --- a/source/blender/nodes/texture/nodes/node_texture_texture.c +++ b/source/blender/nodes/texture/nodes/node_texture_texture.c @@ -90,19 +90,19 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor } } -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &colorfn, data); + tex_output(node, execdata, in, out[0], &colorfn, data); } -void register_node_type_tex_texture(bNodeTreeType *ttype) +void register_node_type_tex_texture() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); + tex_node_type_base(&ntype, TEX_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 120, 80, 240); - node_type_exec(&ntype, exec); + node_type_exec(&ntype, NULL, NULL, exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_translate.c b/source/blender/nodes/texture/nodes/node_texture_translate.c index a95cb00a47d..3d5db4f863a 100644 --- a/source/blender/nodes/texture/nodes/node_texture_translate.c +++ b/source/blender/nodes/texture/nodes/node_texture_translate.c @@ -59,19 +59,19 @@ static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack ** tex_input_rgba(out, in[0], &np, thread); } -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &colorfn, data); + tex_output(node, execdata, in, out[0], &colorfn, data); } -void register_node_type_tex_translate(bNodeTreeType *ttype) +void register_node_type_tex_translate() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, NODE_OPTIONS); + tex_node_type_base(&ntype, TEX_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 90, 80, 100); - node_type_exec(&ntype, exec); + node_type_exec(&ntype, NULL, NULL, exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_valToNor.c b/source/blender/nodes/texture/nodes/node_texture_valToNor.c index bbfc1fa616b..d7495f9833d 100644 --- a/source/blender/nodes/texture/nodes/node_texture_valToNor.c +++ b/source/blender/nodes/texture/nodes/node_texture_valToNor.c @@ -75,19 +75,19 @@ static void normalfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack * out[1] = val-nor[1]; out[2] = val-nor[2]; } -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &normalfn, data); + tex_output(node, execdata, in, out[0], &normalfn, data); } -void register_node_type_tex_valtonor(bNodeTreeType *ttype) +void register_node_type_tex_valtonor() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_VALTONOR, "Value to Normal", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + tex_node_type_base(&ntype, TEX_NODE_VALTONOR, "Value to Normal", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 90, 80, 100); - node_type_exec(&ntype, exec); + node_type_exec(&ntype, NULL, NULL, exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c index 78635453fc1..fec89aa03eb 100644 --- a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c +++ b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c @@ -52,28 +52,28 @@ static void valtorgb_colorfn(float *out, TexParams *p, bNode *node, bNodeStack * } } -static void valtorgb_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void valtorgb_exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &valtorgb_colorfn, data); + tex_output(node, execdata, in, out[0], &valtorgb_colorfn, data); } -static void valtorgb_init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp)) +static void valtorgb_init(bNodeTree *UNUSED(ntree), bNode *node) { node->storage = add_colorband(1); } -void register_node_type_tex_valtorgb(bNodeTreeType *ttype) +void register_node_type_tex_valtorgb() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + tex_node_type_base(&ntype, TEX_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, valtorgb_in, valtorgb_out); node_type_size(&ntype, 240, 200, 300); node_type_init(&ntype, valtorgb_init); node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage); - node_type_exec(&ntype, valtorgb_exec); + node_type_exec(&ntype, NULL, NULL, valtorgb_exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } /* **************** RGBTOBW ******************** */ @@ -94,19 +94,19 @@ static void rgbtobw_valuefn(float *out, TexParams *p, bNode *UNUSED(node), bNode *out = rgb_to_bw(cin); } -static void rgbtobw_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void rgbtobw_exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { - tex_output(node, in, out[0], &rgbtobw_valuefn, data); + tex_output(node, execdata, in, out[0], &rgbtobw_valuefn, data); } -void register_node_type_tex_rgbtobw(bNodeTreeType *ttype) +void register_node_type_tex_rgbtobw() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0); + tex_node_type_base(&ntype, TEX_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0); node_type_socket_templates(&ntype, rgbtobw_in, rgbtobw_out); node_type_size(&ntype, 80, 40, 120); - node_type_exec(&ntype, rgbtobw_exec); + node_type_exec(&ntype, NULL, NULL, rgbtobw_exec); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_viewer.c b/source/blender/nodes/texture/nodes/node_texture_viewer.c index 5cb8d8c438c..44724c9280f 100644 --- a/source/blender/nodes/texture/nodes/node_texture_viewer.c +++ b/source/blender/nodes/texture/nodes/node_texture_viewer.c @@ -42,7 +42,7 @@ static bNodeSocketTemplate outputs[] = { { -1, 0, "" } }; -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) +static void exec(void *data, int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *execdata, bNodeStack **in, bNodeStack **UNUSED(out)) { TexCallData *cdata = (TexCallData *)data; @@ -52,21 +52,21 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(o params_from_cdata(¶ms, cdata); tex_input_rgba(col, in[0], ¶ms, cdata->thread); - tex_do_preview(node, params.previewco, col); + tex_do_preview(execdata->preview, params.previewco, col); } } -void register_node_type_tex_viewer(bNodeTreeType *ttype) +void register_node_type_tex_viewer() { static bNodeType ntype; - node_type_base(ttype, &ntype, TEX_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW); + tex_node_type_base(&ntype, TEX_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 100, 60, 150); - node_type_exec(&ntype, exec); + node_type_exec(&ntype, NULL, NULL, exec); /* Do not allow muting viewer node. */ node_type_internal_links(&ntype, NULL); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } |