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:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-05-24 13:47:29 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-05-24 13:47:29 +0400
commit14a56caee6c63822cb3af4471ed89e3ebefebc55 (patch)
tree4c1cf223f60370894006fc0e6fdc4f3f4f09e90c /source/blender/nodes
parente76812a1d7490b01066c0f751d5311b58825ffd8 (diff)
parent5f677f995d204c378f7aad3de826b2e193276487 (diff)
Merging r46725 through r46963 from trunk into soc-2011-tomato
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/CMakeLists.txt9
-rw-r--r--source/blender/nodes/NOD_composite.h8
-rw-r--r--source/blender/nodes/NOD_shader.h1
-rw-r--r--source/blender/nodes/SConscript1
-rw-r--r--source/blender/nodes/composite/node_composite_tree.c34
-rw-r--r--source/blender/nodes/composite/node_composite_util.c4
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_blur.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_bokehblur.c60
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_bokehimage.c66
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_boxmask.c75
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorcorrection.c89
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_defocus.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_ellipsemask.c75
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_image.c96
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_outputFile.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_switch.c58
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_viewer.c2
-rw-r--r--source/blender/nodes/intern/node_common.c19
-rw-r--r--source/blender/nodes/intern/node_exec.c4
-rw-r--r--source/blender/nodes/intern/node_util.c4
-rw-r--r--source/blender/nodes/shader/node_shader_util.c10
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_object_info.c61
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_environment.c7
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_image.c7
24 files changed, 609 insertions, 91 deletions
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index 3ac7e74a700..358abb08ba4 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -36,6 +36,7 @@ set(INC
../render/extern/include
../../../intern/guardedalloc
../../../intern/raskter
+ ../compositor
)
set(INC_SYS
@@ -109,6 +110,13 @@ set(SRC
composite/nodes/node_composite_vecBlur.c
composite/nodes/node_composite_viewer.c
composite/nodes/node_composite_zcombine.c
+ composite/nodes/node_composite_bokehblur.c
+ composite/nodes/node_composite_bokehimage.c
+ composite/nodes/node_composite_boxmask.c
+ composite/nodes/node_composite_ellipsemask.c
+ composite/nodes/node_composite_switch.c
+ composite/nodes/node_composite_colorcorrection.c
+
composite/node_composite_tree.c
composite/node_composite_util.c
@@ -152,6 +160,7 @@ set(SRC
shader/nodes/node_shader_volume_isotropic.c
shader/nodes/node_shader_light_path.c
shader/nodes/node_shader_light_falloff.c
+ shader/nodes/node_shader_object_info.c
shader/nodes/node_shader_mix_shader.c
shader/nodes/node_shader_add_shader.c
shader/nodes/node_shader_output_lamp.c
diff --git a/source/blender/nodes/NOD_composite.h b/source/blender/nodes/NOD_composite.h
index 4378c6a1d36..f850ea91f12 100644
--- a/source/blender/nodes/NOD_composite.h
+++ b/source/blender/nodes/NOD_composite.h
@@ -122,4 +122,12 @@ void register_node_type_cmp_glare(struct bNodeTreeType *ttype);
void register_node_type_cmp_tonemap(struct bNodeTreeType *ttype);
void register_node_type_cmp_lensdist(struct bNodeTreeType *ttype);
+
+void register_node_type_cmp_colorcorrection(struct bNodeTreeType *ttype);
+void register_node_type_cmp_boxmask(struct bNodeTreeType *ttype);
+void register_node_type_cmp_ellipsemask(struct bNodeTreeType *ttype);
+void register_node_type_cmp_bokehimage(struct bNodeTreeType *ttype);
+void register_node_type_cmp_bokehblur(struct bNodeTreeType *ttype);
+void register_node_type_cmp_switch(struct bNodeTreeType *ttype);
+
#endif
diff --git a/source/blender/nodes/NOD_shader.h b/source/blender/nodes/NOD_shader.h
index 3d93f41cfe5..dd6d25380b4 100644
--- a/source/blender/nodes/NOD_shader.h
+++ b/source/blender/nodes/NOD_shader.h
@@ -74,6 +74,7 @@ void register_node_type_sh_attribute(struct bNodeTreeType *ttype);
void register_node_type_sh_geometry(struct bNodeTreeType *ttype);
void register_node_type_sh_light_path(struct bNodeTreeType *ttype);
void register_node_type_sh_light_falloff(struct bNodeTreeType *ttype);
+void register_node_type_sh_object_info(struct bNodeTreeType *ttype);
void register_node_type_sh_fresnel(struct bNodeTreeType *ttype);
void register_node_type_sh_layer_weight(struct bNodeTreeType *ttype);
void register_node_type_sh_tex_coord(struct bNodeTreeType *ttype);
diff --git a/source/blender/nodes/SConscript b/source/blender/nodes/SConscript
index c8b13e24533..86178b31688 100644
--- a/source/blender/nodes/SConscript
+++ b/source/blender/nodes/SConscript
@@ -13,6 +13,7 @@ incs += ' ../imbuf ../avi '
incs += ' ../blenloader'
incs += ' ../blenfont ../blenkernel ../renderconverter '
incs += ' ../gpu #/extern/glew/include '
+incs += ' ../compositor '
incs += ' ' + env['BF_OPENGL_INC']
incs += ' ' + env['BF_ZLIB_INC']
diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c
index 67b5c3641b5..a88ba82f505 100644
--- a/source/blender/nodes/composite/node_composite_tree.c
+++ b/source/blender/nodes/composite/node_composite_tree.c
@@ -59,6 +59,7 @@
#include "NOD_composite.h"
#include "node_composite_util.h"
+#include "COM_compositor.h"
static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func)
{
@@ -136,12 +137,22 @@ static void localize(bNodeTree *localtree, bNodeTree *ntree)
if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
if (node->id) {
if (node->flag & NODE_DO_OUTPUT)
- node->new_node->id= (ID *)BKE_image_copy((Image *)node->id);
+ node->new_node->id= (ID *)node->id;
else
node->new_node->id= NULL;
}
}
+ /* copy over the preview buffers to update graduatly */
+ if (node->preview) {
+ bNodePreview *preview = MEM_callocN(sizeof(bNodePreview), "Preview");
+ preview->pad = node->preview->pad;
+ preview->xsize = node->preview->xsize;
+ preview->ysize = node->preview->ysize;
+ preview->rect = MEM_dupallocN(node->preview->rect);
+ node->new_node->preview = preview;
+ }
+
for (sock= node->outputs.first; sock; sock= sock->next) {
sock->new_sock->cache= sock->cache;
compbuf_set_node(sock->new_sock->cache, node->new_node);
@@ -575,19 +586,18 @@ static void ntree_composite_texnode(bNodeTree *ntree, int init)
}
/* optimized tree execute test for compositing */
-void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
+/* optimized tree execute test for compositing */
+static void ntreeCompositExecTreeOld(bNodeTree *ntree, RenderData *rd, int do_preview)
{
bNodeExec *nodeexec;
bNode *node;
ListBase threads;
ThreadData thdata;
int totnode, curnode, rendering= 1, n;
- bNodeTreeExec *exec;
-
- if (ntree==NULL) return;
-
- exec = ntree->execdata;
-
+ bNodeTreeExec *exec= ntree->execdata;
+
+ if (ntree == NULL) return;
+
if (do_preview)
ntreeInitPreview(ntree, 0, 0);
@@ -668,6 +678,14 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
ntreeCompositEndExecTree(exec, 1);
}
+void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int rendering, int do_preview)
+{
+ if (G.rt == 200)
+ ntreeCompositExecTreeOld(ntree, rd, do_preview);
+ else
+ COM_execute(ntree, rendering);
+}
+
/* *********************************************** */
/* clumsy checking... should do dynamic outputs once */
diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c
index f26b5f44f99..0d1840a7a7d 100644
--- a/source/blender/nodes/composite/node_composite_util.c
+++ b/source/blender/nodes/composite/node_composite_util.c
@@ -986,7 +986,7 @@ void convolve(CompBuf* dst, CompBuf* in1, CompBuf* in2)
fRGB wt, *colp;
int x, y, ch;
int xbl, ybl, nxb, nyb, xbsz, ybsz;
- int in2done = 0;
+ int in2done = FALSE;
CompBuf* rdst = alloc_compbuf(in1->x, in1->y, in1->type, 1);
@@ -1086,7 +1086,7 @@ void convolve(CompBuf* dst, CompBuf* in1, CompBuf* in2)
}
}
- in2done = 1;
+ in2done = TRUE;
}
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c
index 77b62938d94..d19ea3f202f 100644
--- a/source/blender/nodes/composite/nodes/node_composite_blur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_blur.c
@@ -699,7 +699,7 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
bokeh_single_image(node, new, gammabuf, in[1]->vec[0]);
else if (1)
blur_single_image(node, new, gammabuf, in[1]->vec[0]);
- else /* bloom experimental... */
+ else /* bloom experimental... */
bloom_with_reference(new, gammabuf, NULL, in[1]->vec[0], nbd);
if (nbd->gamma) {
diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehblur.c b/source/blender/nodes/composite/nodes/node_composite_bokehblur.c
new file mode 100644
index 00000000000..f239267a128
--- /dev/null
+++ b/source/blender/nodes/composite/nodes/node_composite_bokehblur.c
@@ -0,0 +1,60 @@
+/*
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2006 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Campbell Barton, Alfredo de Greef, David Millan Escriva,
+ * Juho Vepsäläinen
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/intern/CMP_nodes/CMP_blur.c
+ * \ingroup cmpnodes
+ */
+
+
+#include "../node_composite_util.h"
+
+/* **************** BLUR ******************** */
+static bNodeSocketTemplate cmp_node_bokehblur_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+ { SOCK_RGBA, 1, "Bokeh", 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 1, "Size", 0.01f, 0.0f, 0.0f, 0.0f, 0.0f, 0.5f},
+ { SOCK_FLOAT, 1, "Bounding box", 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
+ { -1, 0, "" }
+};
+
+static bNodeSocketTemplate cmp_node_bokehblur_out[]= {
+ { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+ { -1, 0, "" }
+};
+
+void register_node_type_cmp_bokehblur(bNodeTreeType *ttype)
+{
+ static bNodeType ntype;
+
+ node_type_base(ttype, &ntype, CMP_NODE_BOKEHBLUR, "Bokeh Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_bokehblur_in, cmp_node_bokehblur_out);
+ node_type_size(&ntype, 120, 80, 200);
+ nodeRegisterType(ttype, &ntype);
+}
diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehimage.c b/source/blender/nodes/composite/nodes/node_composite_bokehimage.c
new file mode 100644
index 00000000000..15dba89d12b
--- /dev/null
+++ b/source/blender/nodes/composite/nodes/node_composite_bokehimage.c
@@ -0,0 +1,66 @@
+/*
+* $Id$
+*
+* ***** BEGIN GPL LICENSE BLOCK *****
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*
+* The Original Code is Copyright (C) 2006 Blender Foundation.
+* All rights reserved.
+*
+* The Original Code is: all of this file.
+*
+* Contributor(s): none yet.
+*
+* ***** END GPL LICENSE BLOCK *****
+
+*/
+
+/** \file blender/nodes/intern/CMP_nodes/CMP_gamma.c
+ * \ingroup cmpnodes
+ */
+
+
+#include "../node_composite_util.h"
+
+/* **************** Bokeh image Tools ******************** */
+
+static bNodeSocketTemplate cmp_node_bokehimage_out[]= {
+ { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+ { -1, 0, "" }
+};
+static void node_composit_init_bokehimage(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+{
+ NodeBokehImage * data = MEM_callocN(sizeof(NodeBokehImage), "NodeBokehImage");
+ data->angle = 0.0f;
+ data->flaps = 5;
+ data->rounding = 0.0f;
+ data->catadioptric = 0.0f;
+ data->lensshift = 0.0f;
+ node->storage = data;
+}
+
+void register_node_type_cmp_bokehimage(bNodeTreeType *ttype)
+{
+ static bNodeType ntype;
+
+ node_type_base(ttype, &ntype, CMP_NODE_BOKEHIMAGE, "Bokeh Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS);
+ node_type_socket_templates(&ntype, NULL, cmp_node_bokehimage_out);
+ node_type_size(&ntype, 140, 100, 320);
+ node_type_init(&ntype, node_composit_init_bokehimage);
+ node_type_storage(&ntype, "NodeBokehImage", node_free_standard_storage, node_copy_standard_storage);
+
+ nodeRegisterType(ttype, &ntype);
+}
diff --git a/source/blender/nodes/composite/nodes/node_composite_boxmask.c b/source/blender/nodes/composite/nodes/node_composite_boxmask.c
new file mode 100644
index 00000000000..8c3744e2930
--- /dev/null
+++ b/source/blender/nodes/composite/nodes/node_composite_boxmask.c
@@ -0,0 +1,75 @@
+/*
+ * $Id: CMP_math.c 36271 2011-04-21 13:11:51Z campbellbarton $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2006 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/intern/CMP_nodes/CMP_math.c
+ * \ingroup cmpnodes
+ */
+
+
+#include "../node_composite_util.h"
+
+/* **************** SCALAR MATH ******************** */
+static bNodeSocketTemplate cmp_node_boxmask_in[]= {
+ { SOCK_FLOAT, 1, "Mask", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 1, "Value", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+ { -1, 0, "" }
+};
+
+static bNodeSocketTemplate cmp_node_boxmask_out[]= {
+ { SOCK_FLOAT, 0, "Mask", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+ { -1, 0, "" }
+};
+
+static void node_composit_init_boxmask(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+{
+ NodeBoxMask *data = MEM_callocN(sizeof(NodeBoxMask), "NodeBoxMask");
+ data->x = 0.5;
+ data->y = 0.5;
+ data->width = 0.2;
+ data->height = 0.1;
+ data->rotation = 0.0;
+ node->storage = data;
+}
+
+void register_node_type_cmp_boxmask(bNodeTreeType *ttype)
+{
+ static bNodeType ntype;
+
+ node_type_base(ttype, &ntype, CMP_NODE_MASK_BOX, "Box Mask", NODE_CLASS_MATTE, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_boxmask_in, cmp_node_boxmask_out);
+ node_type_size(&ntype, 260, 110, 300);
+ node_type_init(&ntype, node_composit_init_boxmask);
+ node_type_storage(&ntype, "NodeBoxMask", node_free_standard_storage, node_copy_standard_storage);
+
+ nodeRegisterType(ttype, &ntype);
+}
+
+
+
+
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c
new file mode 100644
index 00000000000..929efaef2c8
--- /dev/null
+++ b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c
@@ -0,0 +1,89 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2006 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Jeroen Bakker.
+ * Monique Dewanchand
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/composite/nodes/node_composite_colorcorrection.c
+ * \ingroup cmpnodes
+ */
+
+
+
+#include "node_composite_util.h"
+
+
+/* ******************* Color Balance ********************************* */
+static bNodeSocketTemplate cmp_node_colorcorrection_in[]={
+ { SOCK_RGBA,1,"Image", 1.0f, 1.0f, 1.0f, 1.0f},
+ { SOCK_FLOAT, 1, "Mask", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+ { -1,0,""}
+};
+
+static bNodeSocketTemplate cmp_node_colorcorrection_out[]={
+ { SOCK_RGBA,0,"Image"},
+ { -1,0,""}
+};
+
+static void node_composit_init_colorcorrection(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+{
+ NodeColorCorrection *n= node->storage= MEM_callocN(sizeof(NodeColorCorrection), "node colorcorrection");
+ n->startmidtones = 0.2f;
+ n->endmidtones = 0.7f;
+ n->master.contrast = 1.0f;
+ n->master.gain = 1.0f;
+ n->master.gamma = 1.0f;
+ n->master.lift= 0.0f;
+ n->master.saturation= 1.0f;
+ n->midtones.contrast = 1.0f;
+ n->midtones.gain = 1.0f;
+ n->midtones.gamma = 1.0f;
+ n->midtones.lift= 0.0f;
+ n->midtones.saturation= 1.0f;
+ n->shadows.contrast = 1.0f;
+ n->shadows.gain = 1.0f;
+ n->shadows.gamma = 1.0f;
+ n->shadows.lift= 0.0f;
+ n->shadows.saturation= 1.0f;
+ n->highlights.contrast = 1.0f;
+ n->highlights.gain = 1.0f;
+ n->highlights.gamma = 1.0f;
+ n->highlights.lift= 0.0f;
+ n->highlights.saturation= 1.0f;
+ node->custom1 = 7; // red + green + blue enabled
+}
+
+void register_node_type_cmp_colorcorrection(bNodeTreeType *ttype)
+{
+ static bNodeType ntype;
+
+ node_type_base(ttype, &ntype, CMP_NODE_COLORCORRECTION, "Color Correction", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_colorcorrection_in, cmp_node_colorcorrection_out);
+ node_type_size(&ntype, 400, 200, 500);
+ node_type_init(&ntype, node_composit_init_colorcorrection);
+ node_type_storage(&ntype, "NodeColorCorrection", node_free_standard_storage, node_copy_standard_storage);
+
+ nodeRegisterType(ttype, &ntype);
+}
diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c
index 72dec01066e..1a6e3fb1675 100644
--- a/source/blender/nodes/composite/nodes/node_composite_defocus.c
+++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c
@@ -249,7 +249,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf,
float bkh_b[4] = {0}; // shape 2D bound
float cam_fdist=1, cam_invfdist=1, cam_lens=35;
float dof_sp, maxfgc, bk_hn_theta=0, inradsq=0;
- int y, len_bkh=0, ydone=0;
+ int y, len_bkh=0, ydone = FALSE;
float aspect, aperture;
int minsz;
//float bcrad, nmaxc, scf;
@@ -748,7 +748,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf,
p4 = p * new->type;
if (nqd->bktype==0) // Disk
lwt = ((u*u + v*v)<=cR2) ? wcor : 0.f;
- else // AA not needed here
+ else /* AA not needed here */
lwt = wcor * getWeight(BKH, len_bkh, u, v, ct_crad, inradsq);
// prevent background bleeding onto in-focus pixels, user-option
if (ct_crad > nqd->bthresh) { // if center blur > threshold
@@ -868,7 +868,7 @@ static void node_composit_init_defocus(bNodeTree *UNUSED(ntree), bNode* node, bN
nbd->gamco = 0;
nbd->samples = 16;
nbd->fstop = 128.f;
- nbd->maxblur = 0;
+ nbd->maxblur = 16;
nbd->bthresh = 1.f;
nbd->scale = 1.f;
nbd->no_zbuf = 1;
diff --git a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c
new file mode 100644
index 00000000000..a6ba3034d87
--- /dev/null
+++ b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c
@@ -0,0 +1,75 @@
+/*
+ * $Id: CMP_math.c 36271 2011-04-21 13:11:51Z campbellbarton $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2006 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/intern/CMP_nodes/CMP_math.c
+ * \ingroup cmpnodes
+ */
+
+
+#include "../node_composite_util.h"
+
+/* **************** SCALAR MATH ******************** */
+static bNodeSocketTemplate cmp_node_ellipsemask_in[]= {
+ { SOCK_FLOAT, 1, "Mask", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 1, "Value", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+ { -1, 0, "" }
+};
+
+static bNodeSocketTemplate cmp_node_ellipsemask_out[]= {
+ { SOCK_FLOAT, 0, "Mask", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+ { -1, 0, "" }
+};
+
+static void node_composit_init_ellipsemask(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+{
+ NodeEllipseMask *data = MEM_callocN(sizeof(NodeEllipseMask), "NodeEllipseMask");
+ data->x = 0.5;
+ data->y = 0.5;
+ data->width = 0.2;
+ data->height = 0.1;
+ data->rotation = 0.0;
+ node->storage = data;
+}
+
+void register_node_type_cmp_ellipsemask(bNodeTreeType *ttype)
+{
+ static bNodeType ntype;
+
+ node_type_base(ttype, &ntype, CMP_NODE_MASK_ELLIPSE, "Ellipse Mask", NODE_CLASS_MATTE, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_ellipsemask_in, cmp_node_ellipsemask_out);
+ node_type_size(&ntype, 260, 110, 300);
+ node_type_init(&ntype, node_composit_init_ellipsemask);
+ node_type_storage(&ntype, "NodeEllipseMask", node_free_standard_storage, node_copy_standard_storage);
+
+ nodeRegisterType(ttype, &ntype);
+}
+
+
+
+
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c
index 4467fb1f193..70d68737032 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.c
+++ b/source/blender/nodes/composite/nodes/node_composite_image.c
@@ -145,37 +145,26 @@ static void cmp_node_image_add_render_pass_outputs(bNodeTree *ntree, bNode *node
cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_TRANSM_COLOR, RRES_OUT_TRANSM_COLOR);
}
-static void cmp_node_image_add_multilayer_outputs(bNodeTree *ntree, bNode *node, ListBase *layers)
+static void cmp_node_image_add_multilayer_outputs(bNodeTree *ntree, bNode *node, RenderLayer *rl)
{
bNodeSocket *sock;
NodeImageLayer *sockdata;
- RenderLayer *rl;
RenderPass *rpass;
- int layer_index, pass_index;
- char name[30]; /* EXR_TOT_MAXNAME-2 ('.' and channel char are appended) */
- int type;
-
- for (rl=layers->first, layer_index=0; rl; rl=rl->next, ++layer_index) {
- for (rpass=rl->passes.first, pass_index=0; rpass; rpass=rpass->next, ++pass_index) {
- /* reconstruct layer name from <render layer>.<render pass> strings */
- if (rl->name[0] != '\0')
- BLI_snprintf(name, sizeof(name), "%s.%s", rl->name, rpass->name);
- else
- BLI_strncpy(name, rpass->name, sizeof(name));
-
- if (rpass->channels == 1)
- type = SOCK_FLOAT;
- else
- type = SOCK_RGBA;
-
- sock = nodeAddSocket(ntree, node, SOCK_OUT, name, type);
- /* extra socket info */
- sockdata = MEM_callocN(sizeof(NodeImageLayer), "node image layer");
- sock->storage = sockdata;
-
- sockdata->layer_index = layer_index;
- sockdata->pass_index = pass_index;
- }
+ int index;
+ for (rpass=rl->passes.first, index=0; rpass; rpass=rpass->next, ++index) {
+ int type;
+ if (rpass->channels == 1)
+ type = SOCK_FLOAT;
+ else
+ type = SOCK_RGBA;
+
+ sock = nodeAddSocket(ntree, node, SOCK_OUT, rpass->name, type);
+ /* extra socket info */
+ sockdata = MEM_callocN(sizeof(NodeImageLayer), "node image layer");
+ sock->storage = sockdata;
+
+ sockdata->pass_index = index;
+ sockdata->pass_flag = rpass->passtype;
}
}
@@ -189,16 +178,16 @@ static void cmp_node_image_create_outputs(bNodeTree *ntree, bNode *node)
BKE_image_get_ibuf(ima, iuser);
if (ima->rr) {
- if (ima->type == IMA_TYPE_MULTILAYER) {
- cmp_node_image_add_multilayer_outputs(ntree, node, &ima->rr->layers);
- }
- else {
- RenderLayer *rl= BLI_findlink(&ima->rr->layers, iuser->layer);
- if (rl)
+ RenderLayer *rl= BLI_findlink(&ima->rr->layers, iuser->layer);
+
+ if (rl) {
+ if (ima->type!=IMA_TYPE_MULTILAYER)
cmp_node_image_add_render_pass_outputs(ntree, node, rl->passflag);
else
- cmp_node_image_add_render_pass_outputs(ntree, node, RRES_OUT_IMAGE|RRES_OUT_ALPHA);
+ cmp_node_image_add_multilayer_outputs(ntree, node, rl);
}
+ else
+ cmp_node_image_add_render_pass_outputs(ntree, node, RRES_OUT_IMAGE|RRES_OUT_ALPHA);
}
else
cmp_node_image_add_render_pass_outputs(ntree, node, RRES_OUT_IMAGE|RRES_OUT_ALPHA|RRES_OUT_Z);
@@ -415,28 +404,23 @@ static CompBuf *node_composit_get_zimage(bNode *node, RenderData *rd)
}
/* check if layer is available, returns pass buffer */
-static CompBuf *compbuf_multilayer_get(RenderData *rd, Image *ima, ImageUser *iuser, int layer_index, int pass_index)
+static CompBuf *compbuf_multilayer_get(RenderData *rd, RenderLayer *rl, Image *ima, ImageUser *iuser, int passindex)
{
- RenderLayer *rl = BLI_findlink(&ima->rr->layers, layer_index);
- if (rl) {
- RenderPass *rpass = BLI_findlink(&rl->passes, pass_index);
- if (rpass) {
- CompBuf *cbuf;
-
- iuser->layer = layer_index;
- iuser->pass = pass_index;
- BKE_image_multilayer_index(ima->rr, iuser);
- cbuf = node_composit_get_image(rd, ima, iuser);
-
- return cbuf;
- }
+ RenderPass *rpass = BLI_findlink(&rl->passes, passindex);
+ if (rpass) {
+ CompBuf *cbuf;
+
+ iuser->pass = passindex;
+ BKE_image_multilayer_index(ima->rr, iuser);
+ cbuf = node_composit_get_image(rd, ima, iuser);
+
+ return cbuf;
}
return NULL;
}
static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
-
/* image assigned to output */
/* stack order input sockets: col, alpha */
if (node->id) {
@@ -447,11 +431,14 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSE
/* first set the right frame number in iuser */
BKE_image_user_frame_calc(iuser, rd->cfra, 0);
- if (ima->type==IMA_TYPE_MULTILAYER) {
- /* force a load, we assume iuser index will be set OK anyway */
+ /* force a load, we assume iuser index will be set OK anyway */
+ if (ima->type==IMA_TYPE_MULTILAYER)
BKE_image_get_ibuf(ima, iuser);
- if (ima->rr) {
+ if (ima->type==IMA_TYPE_MULTILAYER && ima->rr) {
+ RenderLayer *rl= BLI_findlink(&ima->rr->layers, iuser->layer);
+
+ if (rl) {
bNodeSocket *sock;
NodeImageLayer *sockdata;
int out_index;
@@ -460,7 +447,7 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSE
for (sock=node->outputs.first, out_index=0; sock; sock=sock->next, ++out_index) {
sockdata = sock->storage;
if (out[out_index]->hasoutput) {
- CompBuf *stackbuf = out[out_index]->data = compbuf_multilayer_get(rd, ima, iuser, sockdata->layer_index, sockdata->pass_index);
+ CompBuf *stackbuf = out[out_index]->data = compbuf_multilayer_get(rd, rl, ima, iuser, sockdata->pass_index);
if (stackbuf) {
/* preview policy: take first 'Combined' pass if available,
* otherwise just use the first layer.
@@ -469,7 +456,7 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSE
firstbuf = stackbuf;
}
if (!combinedbuf &&
- (strcmp(sock->name, "Combined") == 0 || strcmp(sock->name, "Image") == 0))
+ (strcmp(sock->name, "Combined") == 0 || strcmp(sock->name, "Image") == 0))
{
combinedbuf = stackbuf;
}
@@ -715,7 +702,6 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNU
RE_ReleaseResult(re);
}
-
void register_node_type_cmp_rlayers(bNodeTreeType *ttype)
{
static bNodeType ntype;
diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
index a571b140a1f..fcc8ed4a128 100644
--- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c
+++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
@@ -124,7 +124,7 @@ bNodeSocket *ntreeCompositOutputFileAddSocket(bNodeTree *ntree, bNode *node, con
}
}
/* use node data format by default */
- sockdata->use_node_format = 1;
+ sockdata->use_node_format = TRUE;
nimf->active_input = BLI_findindex(&node->inputs, sock);
diff --git a/source/blender/nodes/composite/nodes/node_composite_switch.c b/source/blender/nodes/composite/nodes/node_composite_switch.c
new file mode 100644
index 00000000000..ee7e3124a7b
--- /dev/null
+++ b/source/blender/nodes/composite/nodes/node_composite_switch.c
@@ -0,0 +1,58 @@
+/*
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2006 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/intern/CMP_nodes/CMP_switch.c
+ * \ingroup cmpnodes
+ */
+
+#include "../node_composite_util.h"
+
+/* **************** MIX RGB ******************** */
+static bNodeSocketTemplate cmp_node_switch_in[]= {
+ { SOCK_RGBA, 1, "Off", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+ { SOCK_RGBA, 1, "On", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+ { -1, 0, "" }
+};
+
+static bNodeSocketTemplate cmp_node_switch_out[]= {
+ { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+ { -1, 0, "" }
+};
+
+/* custom1 = mix type */
+void register_node_type_cmp_switch(bNodeTreeType *ttype)
+{
+ static bNodeType ntype;
+
+ node_type_base(ttype, &ntype, CMP_NODE_SWITCH, "Switch", NODE_CLASS_LAYOUT, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_switch_in, cmp_node_switch_out);
+ node_type_size(&ntype, 110, 60, 120);
+ nodeRegisterType(ttype, &ntype);
+}
+
diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.c b/source/blender/nodes/composite/nodes/node_composite_viewer.c
index 3fdedbb2e42..4a0726e473b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_viewer.c
+++ b/source/blender/nodes/composite/nodes/node_composite_viewer.c
@@ -129,6 +129,8 @@ static void node_composit_init_viewer(bNodeTree *UNUSED(ntree), bNode* node, bNo
iuser->sfra= 1;
iuser->fie_ima= 2;
iuser->ok= 1;
+ node->custom3 = 0.5f;
+ node->custom4 = 0.5f;
}
void register_node_type_cmp_viewer(bNodeTreeType *ttype)
diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c
index 49a3d6c07b4..fa1af821a2d 100644
--- a/source/blender/nodes/intern/node_common.c
+++ b/source/blender/nodes/intern/node_common.c
@@ -57,6 +57,7 @@
#include "MEM_guardedalloc.h"
#include "node_common.h"
+#include "node_util.h"
#include "node_exec.h"
#include "NOD_socket.h"
@@ -133,7 +134,7 @@ bNode *node_group_make_from_selected(bNodeTree *ntree)
DO_MINMAX2((&node->locx), min, max);
totnode++;
}
- node->done= 0;
+ node->done = FALSE;
}
if (totnode==0) return NULL;
@@ -551,7 +552,7 @@ static bNodeSocket *group_verify_socket(bNodeTree *ntree, ListBase *lb, int in_o
sock->groupsock = gsock;
BLI_strncpy(sock->name, gsock->name, sizeof(sock->name));
- if(gsock->type != sock->type)
+ if (gsock->type != sock->type)
nodeSocketSetType(sock, gsock->type);
/* XXX hack: group socket input/output roles are inverted internally,
@@ -810,12 +811,24 @@ bNodeTemplate node_whileloop_template(bNode *node)
/**** FRAME ****/
+static void node_frame_init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
+{
+ NodeFrame *data = (NodeFrame *)MEM_callocN(sizeof(NodeFrame), "frame node storage");
+ node->storage = data;
+
+ data->flag |= NODE_FRAME_SHRINK;
+
+ data->label_size = 20;
+}
+
void register_node_type_frame(bNodeTreeType *ttype)
{
/* frame type is used for all tree types, needs dynamic allocation */
bNodeType *ntype= MEM_callocN(sizeof(bNodeType), "frame node type");
- node_type_base(ttype, ntype, NODE_FRAME, "Frame", NODE_CLASS_LAYOUT, NODE_BACKGROUND);
+ node_type_base(ttype, ntype, NODE_FRAME, "Frame", NODE_CLASS_LAYOUT, NODE_BACKGROUND|NODE_OPTIONS);
+ node_type_init(ntype, node_frame_init);
+ node_type_storage(ntype, "NodeFrame", node_free_standard_storage, node_copy_standard_storage);
node_type_size(ntype, 150, 100, 0);
node_type_compatibility(ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c
index 3b757e753a4..3f77638e25a 100644
--- a/source/blender/nodes/intern/node_exec.c
+++ b/source/blender/nodes/intern/node_exec.c
@@ -242,7 +242,7 @@ bNodeThreadStack *ntreeGetThreadStack(bNodeTreeExec *exec, int thread)
for (nts=lb->first; nts; nts=nts->next) {
if (!nts->used) {
- nts->used= 1;
+ nts->used = TRUE;
break;
}
}
@@ -250,7 +250,7 @@ bNodeThreadStack *ntreeGetThreadStack(bNodeTreeExec *exec, int thread)
if (!nts) {
nts= MEM_callocN(sizeof(bNodeThreadStack), "bNodeThreadStack");
nts->stack= MEM_dupallocN(exec->stack);
- nts->used= 1;
+ nts->used = TRUE;
BLI_addtail(lb, nts);
}
diff --git a/source/blender/nodes/intern/node_util.c b/source/blender/nodes/intern/node_util.c
index 1c38bdf39d7..548a21ee35b 100644
--- a/source/blender/nodes/intern/node_util.c
+++ b/source/blender/nodes/intern/node_util.c
@@ -57,7 +57,9 @@ void node_free_curves(bNode *node)
void node_free_standard_storage(bNode *node)
{
- MEM_freeN(node->storage);
+ if (node->storage) {
+ MEM_freeN(node->storage);
+ }
}
void node_copy_curves(bNode *orig_node, bNode *new_node)
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c
index 9a9a27603dc..5961c2b330b 100644
--- a/source/blender/nodes/shader/node_shader_util.c
+++ b/source/blender/nodes/shader/node_shader_util.c
@@ -277,23 +277,23 @@ void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, int do_outputs)
bNodeStack *nsin[MAX_SOCKET]; /* arbitrary... watch this */
bNodeStack *nsout[MAX_SOCKET]; /* arbitrary... watch this */
GPUNodeStack gpuin[MAX_SOCKET+1], gpuout[MAX_SOCKET+1];
- int doit;
+ int do_it;
stack= exec->stack;
for (n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
node = nodeexec->node;
- doit = 0;
+ do_it = FALSE;
/* for groups, only execute outputs for edited group */
if (node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
if (do_outputs && (node->flag & NODE_DO_OUTPUT))
- doit = 1;
+ do_it = TRUE;
}
else
- doit = 1;
+ do_it = TRUE;
- if (doit) {
+ if (do_it) {
if (node->typeinfo->gpufunc) {
node_get_stack(node, stack, nsin, nsout);
gpu_stack_from_data_list(gpuin, &node->inputs, nsin);
diff --git a/source/blender/nodes/shader/nodes/node_shader_object_info.c b/source/blender/nodes/shader/nodes/node_shader_object_info.c
new file mode 100644
index 00000000000..ee356dbb3b3
--- /dev/null
+++ b/source/blender/nodes/shader/nodes/node_shader_object_info.c
@@ -0,0 +1,61 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2005 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "../node_shader_util.h"
+
+/* **************** OUTPUT ******************** */
+
+static bNodeSocketTemplate sh_node_object_info_out[]= {
+ { SOCK_VECTOR, 0, "Location", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 0, "Object Index", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 0, "Material Index", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 0, "Random", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+ { -1, 0, "" }
+};
+
+static int node_shader_gpu_object_info(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
+{
+ return GPU_stack_link(mat, "node_object_info", in, out);
+}
+
+/* node type definition */
+void register_node_type_sh_object_info(bNodeTreeType *ttype)
+{
+ static bNodeType ntype;
+
+ node_type_base(ttype, &ntype, SH_NODE_OBJECT_INFO, "Object Info", NODE_CLASS_INPUT, 0);
+ node_type_compatibility(&ntype, NODE_NEW_SHADING);
+ node_type_socket_templates(&ntype, NULL, sh_node_object_info_out);
+ node_type_size(&ntype, 150, 60, 200);
+ node_type_init(&ntype, NULL);
+ node_type_storage(&ntype, "", NULL, NULL);
+ node_type_exec(&ntype, NULL);
+ node_type_gpu(&ntype, node_shader_gpu_object_info);
+
+ nodeRegisterType(ttype, &ntype);
+}
+
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
index 852c056dc28..9e80f79b0c5 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
@@ -55,11 +55,8 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat, bNode *node, GPUNod
Image *ima= (Image*)node->id;
ImageUser *iuser= NULL;
- if (!ima) {
- float black[4] = {0.0f, 0.0f, 0.0f, 1.0f};
- GPUNodeLink *vec = GPU_uniform(black);
- return GPU_stack_link(mat, "set_rgba", out, out, vec);
- }
+ if (!ima)
+ return GPU_stack_link(mat, "node_tex_environment_empty", in, out);
if (!in[0].link)
in[0].link = GPU_builtin(GPU_VIEW_POSITION);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.c b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
index 28dcada3d33..e00467a52ef 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
@@ -55,11 +55,8 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, GPUNodeStack
Image *ima= (Image*)node->id;
ImageUser *iuser= NULL;
- if (!ima) {
- float black[4] = {0.0f, 0.0f, 0.0f, 1.0f};
- GPUNodeLink *vec = GPU_uniform(black);
- return GPU_stack_link(mat, "set_rgba", out, out, vec);
- }
+ if (!ima)
+ return GPU_stack_link(mat, "node_tex_image_empty", in, out);
if (!in[0].link)
in[0].link = GPU_attribute(CD_MTFACE, "");