Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2013-03-18 20:34:57 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2013-03-18 20:34:57 +0400
commit4638e5f99a9ba59ad0b8a1fd52b12e876480b9e8 (patch)
tree2444f12b4612440f44cf02835cdf5951b6564e92 /source/blender/nodes/texture
parent7bfef29f2f2a1b262d28abdc6e30fcd9c1f1caad (diff)
Merge of the PyNodes branch (aka "custom nodes") into trunk.
PyNodes opens up the node system in Blender to scripters and adds a number of UI-level improvements. === Dynamic node type registration === Node types can now be added at runtime, using the RNA registration mechanism from python. This enables addons such as render engines to create a complete user interface with nodes. Examples of how such nodes can be defined can be found in my personal wiki docs atm [1] and as a script template in release/scripts/templates_py/custom_nodes.py [2]. === Node group improvements === Each node editor now has a tree history of edited node groups, which allows opening and editing nested node groups. The node editor also supports pinning now, so that different spaces can be used to edit different node groups simultaneously. For more ramblings and rationale see (really old) blog post on code.blender.org [3]. The interface of node groups has been overhauled. Sockets of a node group are no longer displayed in columns on either side, but instead special input/output nodes are used to mirror group sockets inside a node tree. This solves the problem of long node lines in groups and allows more adaptable node layout. Internal sockets can be exposed from a group by either connecting to the extension sockets in input/output nodes (shown as empty circle) or by adding sockets from the node property bar in the "Interface" panel. Further details such as the socket name can also be changed there. [1] http://wiki.blender.org/index.php/User:Phonybone/Python_Nodes [2] http://projects.blender.org/scm/viewvc.php/trunk/blender/release/scripts/templates_py/custom_nodes.py?view=markup&root=bf-blender [3] http://code.blender.org/index.php/2012/01/improving-node-group-interface-editing/
Diffstat (limited to 'source/blender/nodes/texture')
-rw-r--r--source/blender/nodes/texture/node_texture_tree.c206
-rw-r--r--source/blender/nodes/texture/node_texture_util.c28
-rw-r--r--source/blender/nodes/texture/node_texture_util.h10
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_at.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_bricks.c14
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_checker.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_common.c69
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_compose.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_coord.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_curves.c30
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_decompose.c18
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_distance.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_hueSatVal.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_image.c14
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_invert.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_math.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_mixRgb.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_output.c22
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_proc.c16
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_rotate.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_scale.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_texture.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_translate.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_valToNor.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_valToRgb.c26
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_viewer.c12
26 files changed, 358 insertions, 275 deletions
diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c
index ba94531c259..0690ccdd19f 100644
--- a/source/blender/nodes/texture/node_texture_tree.c
+++ b/source/blender/nodes/texture/node_texture_tree.c
@@ -34,6 +34,7 @@
#include "DNA_texture_types.h"
#include "DNA_node_types.h"
+#include "DNA_space_types.h"
#include "BLI_listbase.h"
#include "BLI_threads.h"
@@ -41,9 +42,11 @@
#include "BLF_translation.h"
+#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_node.h"
+#include "BKE_paint.h"
#include "node_common.h"
#include "node_exec.h"
@@ -51,16 +54,57 @@
#include "NOD_texture.h"
#include "node_texture_util.h"
+#include "RNA_access.h"
+
#include "RE_pipeline.h"
#include "RE_shader_ext.h"
-static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func)
+static void texture_get_from_context(const bContext *C, bNodeTreeType *UNUSED(treetype), bNodeTree **r_ntree, ID **r_id, ID **r_from)
{
- Tex *tx;
- for (tx = main->tex.first; tx; tx = tx->id.next) {
- if (tx->nodetree) {
- func(calldata, &tx->id, tx->nodetree);
+ SpaceNode *snode = CTX_wm_space_node(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = OBACT;
+ Tex *tx = NULL;
+
+ if (snode->texfrom == SNODE_TEX_OBJECT) {
+ if (ob) {
+ tx = give_current_object_texture(ob);
+ if (tx) {
+ if (ob->type == OB_LAMP)
+ *r_from = (ID*)ob->data;
+ else
+ *r_from = (ID*)give_current_material(ob, ob->actcol);
+
+ /* from is not set fully for material nodes, should be ID + Node then */
+ *r_id = &tx->id;
+ *r_ntree = tx->nodetree;
+ }
+ }
+ }
+ else if (snode->texfrom == SNODE_TEX_WORLD) {
+ tx = give_current_world_texture(scene->world);
+ if (tx) {
+ *r_from = (ID *)scene->world;
+ *r_id = &tx->id;
+ *r_ntree = tx->nodetree;
+ }
+ }
+ else {
+ struct Brush *brush = NULL;
+
+ if (ob && (ob->mode & OB_MODE_SCULPT))
+ brush = paint_brush(&scene->toolsettings->sculpt->paint);
+ else
+ brush = paint_brush(&scene->toolsettings->imapaint.paint);
+
+ if (brush) {
+ *r_from = (ID *)brush;
+ tx = give_current_brush_texture(brush);
+ if (tx) {
+ *r_id = &tx->id;
+ *r_ntree = tx->nodetree;
+ }
}
}
}
@@ -75,6 +119,7 @@ static void foreach_nodeclass(Scene *UNUSED(scene), void *calldata, bNodeClassCa
func(calldata, NODE_CLASS_CONVERTOR, N_("Convertor"));
func(calldata, NODE_CLASS_DISTORT, N_("Distort"));
func(calldata, NODE_CLASS_GROUP, N_("Group"));
+ func(calldata, NODE_CLASS_INTERFACE, N_("Interface"));
func(calldata, NODE_CLASS_LAYOUT, N_("Layout"));
}
@@ -93,49 +138,42 @@ static void localize(bNodeTree *localtree, bNodeTree *UNUSED(ntree))
}
}
-static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
+static void local_sync(bNodeTree *UNUSED(localtree), bNodeTree *UNUSED(ntree))
{
- bNode *lnode;
-
- /* copy over contents of previews */
- for (lnode = localtree->nodes.first; lnode; lnode = lnode->next) {
- if (ntreeNodeExists(ntree, lnode->new_node)) {
- bNode *node = lnode->new_node;
-
- if (node->preview && node->preview->rect) {
- if (lnode->preview && lnode->preview->rect) {
- int xsize = node->preview->xsize;
- int ysize = node->preview->ysize;
- memcpy(node->preview->rect, lnode->preview->rect, 4 * xsize + xsize * ysize * sizeof(char) * 4);
- }
- }
- }
- }
}
static void update(bNodeTree *ntree)
{
ntree_update_reroute_nodes(ntree);
+
+ if (ntree->update & NTREE_UPDATE_NODES) {
+ /* clean up preview cache, in case nodes have been removed */
+ BKE_node_preview_remove_unused(ntree);
+ }
}
-bNodeTreeType ntreeType_Texture = {
- /* type */ NTREE_TEXTURE,
- /* id_name */ "NTTexture Nodetree",
+bNodeTreeType *ntreeType_Texture;
+
+void register_node_tree_type_tex()
+{
+ bNodeTreeType *tt = ntreeType_Texture = MEM_callocN(sizeof(bNodeTreeType), "texture node tree type");
- /* node_types */ { NULL, NULL },
+ tt->type = NTREE_TEXTURE;
+ strcpy(tt->idname, "TextureNodeTree");
+ strcpy(tt->ui_name, "Texture");
+ tt->ui_icon = 0; /* defined in drawnode.c */
+ strcpy(tt->ui_description, "");
- /* free_cache */ NULL,
- /* free_node_cache */ NULL,
- /* foreach_nodetree */ foreach_nodetree,
- /* foreach_nodeclass */ foreach_nodeclass,
- /* localize */ localize,
- /* local_sync */ local_sync,
- /* local_merge */ NULL,
- /* update */ update,
- /* update_node */ NULL,
- /* validate_link */ NULL,
- /* update_internal_links */ node_update_internal_links_default
-};
+ tt->foreach_nodeclass = foreach_nodeclass;
+ tt->update = update;
+ tt->localize = localize;
+ tt->local_sync = local_sync;
+ tt->get_from_context = texture_get_from_context;
+
+ tt->ext.srna = &RNA_TextureNodeTree;
+
+ ntreeTypeAdd(tt);
+}
int ntreeTexTagAnimated(bNodeTree *ntree)
{
@@ -158,24 +196,13 @@ int ntreeTexTagAnimated(bNodeTree *ntree)
return 0;
}
-/* XXX Group nodes must set use_tree_data to false, since their trees can be shared by multiple nodes.
- * If use_tree_data is true, the ntree->execdata pointer is checked to avoid multiple execution of top-level trees.
- */
-bNodeTreeExec *ntreeTexBeginExecTree(bNodeTree *ntree, int use_tree_data)
+bNodeTreeExec *ntreeTexBeginExecTree_internal(bNodeExecContext *context, bNodeTree *ntree, bNodeInstanceKey parent_key)
{
bNodeTreeExec *exec;
bNode *node;
- if (use_tree_data) {
- /* XXX hack: prevent exec data from being generated twice.
- * this should be handled by the renderer!
- */
- if (ntree->execdata)
- return ntree->execdata;
- }
-
/* common base initialization */
- exec = ntree_exec_begin(ntree);
+ exec = ntree_exec_begin(context, ntree, parent_key);
/* allocate the thread stack listbase array */
exec->threadstack = MEM_callocN(BLENDER_MAX_THREADS * sizeof(ListBase), "thread stack array");
@@ -183,12 +210,28 @@ bNodeTreeExec *ntreeTexBeginExecTree(bNodeTree *ntree, int use_tree_data)
for (node = exec->nodetree->nodes.first; node; node = node->next)
node->need_exec = 1;
- if (use_tree_data) {
- /* XXX this should not be necessary, but is still used for cmp/sha/tex nodes,
- * which only store the ntree pointer. Should be fixed at some point!
- */
- ntree->execdata = exec;
- }
+ return exec;
+}
+
+bNodeTreeExec *ntreeTexBeginExecTree(bNodeTree *ntree)
+{
+ bNodeExecContext context;
+ bNodeTreeExec *exec;
+
+ /* XXX hack: prevent exec data from being generated twice.
+ * this should be handled by the renderer!
+ */
+ if (ntree->execdata)
+ return ntree->execdata;
+
+ context.previews = ntree->previews;
+
+ exec = ntreeTexBeginExecTree_internal(&context, ntree, NODE_INSTANCE_KEY_BASE);
+
+ /* XXX this should not be necessary, but is still used for cmp/sha/tex nodes,
+ * which only store the ntree pointer. Should be fixed at some point!
+ */
+ ntree->execdata = exec;
return exec;
}
@@ -207,35 +250,34 @@ static void tex_free_delegates(bNodeTreeExec *exec)
MEM_freeN(ns->data);
}
-/* XXX Group nodes must set use_tree_data to false, since their trees can be shared by multiple nodes.
- * If use_tree_data is true, the ntree->execdata pointer is checked to avoid multiple execution of top-level trees.
- */
-void ntreeTexEndExecTree(bNodeTreeExec *exec, int use_tree_data)
+void ntreeTexEndExecTree_internal(bNodeTreeExec *exec)
{
- if (exec) {
- bNodeTree *ntree = exec->nodetree;
- bNodeThreadStack *nts;
- int a;
+ bNodeThreadStack *nts;
+ int a;
+
+ if (exec->threadstack) {
+ tex_free_delegates(exec);
- if (exec->threadstack) {
- tex_free_delegates(exec);
-
- for (a = 0; a < BLENDER_MAX_THREADS; a++) {
- for (nts = exec->threadstack[a].first; nts; nts = nts->next)
- if (nts->stack) MEM_freeN(nts->stack);
- BLI_freelistN(&exec->threadstack[a]);
- }
-
- MEM_freeN(exec->threadstack);
- exec->threadstack = NULL;
+ for (a = 0; a < BLENDER_MAX_THREADS; a++) {
+ for (nts = exec->threadstack[a].first; nts; nts = nts->next)
+ if (nts->stack) MEM_freeN(nts->stack);
+ BLI_freelistN(&exec->threadstack[a]);
}
- ntree_exec_end(exec);
+ MEM_freeN(exec->threadstack);
+ exec->threadstack = NULL;
+ }
+
+ ntree_exec_end(exec);
+}
+
+void ntreeTexEndExecTree(bNodeTreeExec *exec)
+{
+ if (exec) {
+ ntreeTexEndExecTree_internal(exec);
- if (use_tree_data) {
- /* XXX clear nodetree backpointer to exec data, same problem as noted in ntreeBeginExecTree */
- ntree->execdata = NULL;
- }
+ /* XXX clear nodetree backpointer to exec data, same problem as noted in ntreeBeginExecTree */
+ exec->nodetree->execdata = NULL;
}
}
@@ -275,7 +317,7 @@ int ntreeTexExecTree(
if (!exec) {
BLI_lock_thread(LOCK_NODES);
if (!nodes->execdata)
- ntreeTexBeginExecTree(nodes, 1);
+ ntreeTexBeginExecTree(nodes);
BLI_unlock_thread(LOCK_NODES);
exec = nodes->execdata;
diff --git a/source/blender/nodes/texture/node_texture_util.c b/source/blender/nodes/texture/node_texture_util.c
index 06473d800d0..80644157b02 100644
--- a/source/blender/nodes/texture/node_texture_util.c
+++ b/source/blender/nodes/texture/node_texture_util.c
@@ -49,13 +49,28 @@
#include <assert.h>
#include "node_texture_util.h"
+
+int tex_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree)
+{
+ return (strcmp(ntree->idname, "TextureNodeTree")==0);
+}
+
+void tex_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag)
+{
+ node_type_base(ntype, type, name, nclass, flag);
+
+ ntype->poll = tex_node_poll_default;
+ ntype->update_internal_links = node_update_internal_links_default;
+}
+
+
static void tex_call_delegate(TexDelegate *dg, float *out, TexParams *params, short thread)
{
if (dg->node->need_exec) {
dg->fn(out, params, dg->node, dg->in, thread);
if (dg->cdata->do_preview)
- tex_do_preview(dg->node, params->previewco, out);
+ tex_do_preview(dg->preview, params->previewco, out);
}
}
@@ -112,19 +127,17 @@ void params_from_cdata(TexParams *out, TexCallData *in)
out->mtex = in->mtex;
}
-void tex_do_preview(bNode *node, const float coord[2], const float col[4])
+void tex_do_preview(bNodePreview *preview, const float coord[2], const float col[4])
{
- bNodePreview *preview = node->preview;
-
if (preview) {
int xs = ((coord[0] + 1.0f) * 0.5f) * preview->xsize;
int ys = ((coord[1] + 1.0f) * 0.5f) * preview->ysize;
-
- nodeAddToPreview(node, col, xs, ys, 0); /* 0 = no color management */
+
+ BKE_node_preview_set_pixel(preview, col, xs, ys, 0); /* 0 = no color management */
}
}
-void tex_output(bNode *node, bNodeStack **in, bNodeStack *out, TexFn texfn, TexCallData *cdata)
+void tex_output(bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack *out, TexFn texfn, TexCallData *cdata)
{
TexDelegate *dg;
if (!out->data)
@@ -136,6 +149,7 @@ void tex_output(bNode *node, bNodeStack **in, bNodeStack *out, TexFn texfn, TexC
dg->cdata = cdata;
dg->fn = texfn;
dg->node = node;
+ dg->preview = execdata->preview;
memcpy(dg->in, in, MAX_SOCKET * sizeof(bNodeStack *));
dg->type = out->sockettype;
}
diff --git a/source/blender/nodes/texture/node_texture_util.h b/source/blender/nodes/texture/node_texture_util.h
index 3b2a7e14f69..b81ea51ddff 100644
--- a/source/blender/nodes/texture/node_texture_util.h
+++ b/source/blender/nodes/texture/node_texture_util.h
@@ -65,6 +65,7 @@
#include "BKE_library.h"
#include "node_util.h"
+#include "NOD_texture.h"
#include "NOD_texture.h"
@@ -111,16 +112,21 @@ typedef struct TexDelegate {
TexCallData *cdata;
TexFn fn;
bNode *node;
+ bNodePreview *preview;
bNodeStack *in[MAX_SOCKET];
int type;
} TexDelegate;
+
+int tex_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree);
+void tex_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag);
+
void tex_input_rgba(float *out, bNodeStack *in, TexParams *params, short thread);
void tex_input_vec(float *out, bNodeStack *in, TexParams *params, short thread);
float tex_input_value(bNodeStack *in, TexParams *params, short thread);
-void tex_output(bNode *node, bNodeStack **in, bNodeStack *out, TexFn texfn, TexCallData *data);
-void tex_do_preview(bNode *node, const float coord[2], const float col[4]);
+void tex_output(bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack *out, TexFn texfn, TexCallData *data);
+void tex_do_preview(bNodePreview *preview, const float coord[2], const float col[4]);
void params_from_cdata(TexParams *out, TexCallData *in);
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], &params, cdata->thread);
else
tex_input_rgba(&target->tr, in[0], &params, 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(&params, cdata);
tex_input_rgba(col, in[0], &params, 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);
}