diff options
Diffstat (limited to 'source/blender/nodes')
12 files changed, 471 insertions, 22 deletions
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index be9dd10b71d..772ce376cb8 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -35,6 +35,7 @@ set(INC ../makesrna ../render/extern/include ../../../intern/guardedalloc + ../compositor ) set(INC_SYS @@ -107,6 +108,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 diff --git a/source/blender/nodes/NOD_composite.h b/source/blender/nodes/NOD_composite.h index 284b89bc095..ca925c82afd 100644 --- a/source/blender/nodes/NOD_composite.h +++ b/source/blender/nodes/NOD_composite.h @@ -120,4 +120,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/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 41b1204fba4..b266af15060 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,7 +137,7 @@ 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; } @@ -575,20 +576,19 @@ 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; - - if (do_preview) + bNodeTreeExec *exec= ntree->execdata; + + if(ntree==NULL) return; + + if(do_preview) ntreeInitPreview(ntree, 0, 0); if (!ntree->execdata) { @@ -598,7 +598,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview) ntree_composite_texnode(ntree, 1); /* prevent unlucky accidents */ - if (G.background) + if(G.background) rd->scemode &= ~R_COMP_CROP; /* setup callerdata for thread callback */ @@ -613,15 +613,15 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview) BLI_init_threads(&threads, exec_composite_node, rd->threads); - while (rendering) { + while(rendering) { - if (BLI_available_threads(&threads)) { + if(BLI_available_threads(&threads)) { nodeexec= getExecutableNode(exec); - if (nodeexec) { + if(nodeexec) { node = nodeexec->node; - if (ntree->progress && totnode) + if(ntree->progress && totnode) ntree->progress(ntree->prh, (1.0f - curnode/(float)totnode)); - if (ntree->stats_draw) { + if(ntree->stats_draw) { char str[128]; BLI_snprintf(str, sizeof(str), "Compositing %d %s", curnode, node->name); ntree->stats_draw(ntree->sdh, str); @@ -640,21 +640,21 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview) rendering= 0; /* test for ESC */ - if (ntree->test_break && ntree->test_break(ntree->tbh)) { - for (node= ntree->nodes.first; node; node= node->next) + if(ntree->test_break && ntree->test_break(ntree->tbh)) { + for(node= ntree->nodes.first; node; node= node->next) node->exec |= NODE_READY; } /* check for ready ones, and if we need to continue */ - for (n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) { + for(n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) { node = nodeexec->node; - if (node->exec & NODE_READY) { - if ((node->exec & NODE_FINISHED)==0) { + if(node->exec & NODE_READY) { + if((node->exec & NODE_FINISHED)==0) { BLI_remove_thread(&threads, nodeexec); /* this waits for running thread to finish btw */ node->exec |= NODE_FINISHED; /* freeing unused buffers */ - if (rd->scemode & R_COMP_FREE) + if(rd->scemode & R_COMP_FREE) freeExecutableNode(exec); } } @@ -668,6 +668,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/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..be5d25f60c3 --- /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, 120, 110, 160); + 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..af085418c0e --- /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, 400); + 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_ellipsemask.c b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c new file mode 100644 index 00000000000..556ad1ab6c6 --- /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, 120, 110, 160); + 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..ad1264a7b6b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ b/source/blender/nodes/composite/nodes/node_composite_image.c @@ -715,7 +715,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_switch.c b/source/blender/nodes/composite/nodes/node_composite_switch.c new file mode 100644 index 00000000000..f7b1f9e09e4 --- /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_OP_COLOR, 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) |