Sorry folks, forgot the commit message. The patch adds the Double Edge Mask comp. node. Useful for VFX work and other such things.
Basic concept is it takes two single channel inputs and produces a single channel output where feathered region is created by combining areas and filling varying gradient between input 1 and input 2's edges. Short explanation of how it works found here: http://wiki.blender.org/index.php/User:Xgl_asyliax On Tue, Jan 10, 2012 at 2:32 PM, Thomas Dinges <blen...@dingto.org> wrote: > > > -------- Original-Nachricht -------- Betreff: [Bf-blender-cvs] SVN > commit: /data/svn/bf-blender [43265] trunk/blender/source/blender: Datum: > Tue, 10 Jan 2012 19:08:08 +0000 (UTC) Von: Peter Larabell > <xgl.asyl...@gmail.com> <xgl.asyl...@gmail.com> Antwort an: > bf-committers@blender.org An: bf-blender-...@blender.org > > Revision: 43265 > > http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43265 > Author: xglasyliax > Date: 2012-01-10 19:08:08 +0000 (Tue, 10 Jan 2012) > Log Message: > ----------- > > > Modified Paths: > -------------- > trunk/blender/source/blender/blenkernel/BKE_node.h > trunk/blender/source/blender/blenkernel/intern/node.c > trunk/blender/source/blender/editors/space_node/drawnode.c > trunk/blender/source/blender/makesrna/RNA_access.h > trunk/blender/source/blender/makesrna/intern/rna_nodetree.c > trunk/blender/source/blender/makesrna/intern/rna_nodetree_types.h > trunk/blender/source/blender/nodes/CMakeLists.txt > trunk/blender/source/blender/nodes/NOD_composite.h > > Added Paths: > ----------- > > trunk/blender/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c > > Modified: trunk/blender/source/blender/blenkernel/BKE_node.h > =================================================================== > --- trunk/blender/source/blender/blenkernel/BKE_node.h 2012-01-10 > 19:01:27 UTC (rev 43264) > +++ trunk/blender/source/blender/blenkernel/BKE_node.h 2012-01-10 > 19:08:08 UTC (rev 43265) > @@ -642,6 +642,7 @@ > #define CMP_NODE_STABILIZE2D 263 > #define CMP_NODE_TRANSFORM 264 > #define CMP_NODE_MOVIEDISTORTION 265 > +#define CMP_NODE_DOUBLEEDGEMASK 266 > > #define CMP_NODE_GLARE 301 > #define CMP_NODE_TONEMAP 302 > > Modified: trunk/blender/source/blender/blenkernel/intern/node.c > =================================================================== > --- trunk/blender/source/blender/blenkernel/intern/node.c 2012-01-10 > 19:01:27 UTC (rev 43264) > +++ trunk/blender/source/blender/blenkernel/intern/node.c 2012-01-10 > 19:08:08 UTC (rev 43265) > @@ -1839,6 +1839,7 @@ > register_node_type_cmp_vecblur(ttype); > register_node_type_cmp_dilateerode(ttype); > register_node_type_cmp_defocus(ttype); > + register_node_type_cmp_doubleedgemask(ttype); > > register_node_type_cmp_valtorgb(ttype); > register_node_type_cmp_rgbtobw(ttype); > > Modified: trunk/blender/source/blender/editors/space_node/drawnode.c > =================================================================== > --- trunk/blender/source/blender/editors/space_node/drawnode.c > 2012-01-10 19:01:27 UTC (rev 43264) > +++ trunk/blender/source/blender/editors/space_node/drawnode.c > 2012-01-10 19:08:08 UTC (rev 43265) > @@ -1472,6 +1472,18 @@ > uiItemR(col, ptr, "factor", 0, NULL, ICON_NONE); > } > > +static void node_composit_buts_double_edge_mask(uiLayout *layout, bContext > *UNUSED(C), PointerRNA *ptr) > +{ > + uiLayout *col; > + > + col= uiLayoutColumn(layout, 0); > + > + uiItemL(col, "Inner Edge:", ICON_NONE); > + uiItemR(col, ptr, "inner_mode", 0, "", ICON_NONE); > + uiItemL(col, "Buffer Edge:", ICON_NONE); > + uiItemR(col, ptr, "edge_mode", 0, "", ICON_NONE); > +} > + > static void node_composit_buts_map_value(uiLayout *layout, bContext > *UNUSED(C), PointerRNA *ptr) > { > uiLayout *sub, *col; > @@ -1926,6 +1938,9 @@ > case CMP_NODE_ID_MASK: > ntype->uifunc= node_composit_buts_id_mask; > break; > + case CMP_NODE_DOUBLEEDGEMASK: > + ntype->uifunc= node_composit_buts_double_edge_mask; > + break; > case CMP_NODE_MATH: > ntype->uifunc= node_buts_math; > break; > > Modified: trunk/blender/source/blender/makesrna/RNA_access.h > =================================================================== > --- trunk/blender/source/blender/makesrna/RNA_access.h 2012-01-10 > 19:01:27 UTC (rev 43264) > +++ trunk/blender/source/blender/makesrna/RNA_access.h 2012-01-10 > 19:08:08 UTC (rev 43265) > @@ -136,6 +136,7 @@ > extern StructRNA RNA_CompositorNodeGlare; > extern StructRNA RNA_CompositorNodeHueSat; > extern StructRNA RNA_CompositorNodeIDMask; > +extern StructRNA RNA_CompositorNodeDoubleEdgeMask; > extern StructRNA RNA_CompositorNodeImage; > extern StructRNA RNA_CompositorNodeInvert; > extern StructRNA RNA_CompositorNodeLensdist; > > Modified: trunk/blender/source/blender/makesrna/intern/rna_nodetree.c > =================================================================== > --- trunk/blender/source/blender/makesrna/intern/rna_nodetree.c > 2012-01-10 19:01:27 UTC (rev 43264) > +++ trunk/blender/source/blender/makesrna/intern/rna_nodetree.c > 2012-01-10 19:08:08 UTC (rev 43265) > @@ -2125,6 +2125,35 @@ > RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); > } > > +static void def_cmp_double_edge_mask(StructRNA * srna) > +{ > + PropertyRNA *prop; > + > + static EnumPropertyItem BufEdgeMode_items[] = { > + {0, "BLEED_OUT", 0, "Bleed Out", "Allow mask pixels to > bleed along edges"}, > + {1, "KEEP_IN", 0, "Keep In", "Restrict mask pixels from > touching edges"}, > + {0, NULL, 0, NULL, NULL} > + }; > + > + static EnumPropertyItem InnerEdgeMode_items[] = { > + {0, "ALL", 0, "All", "All pixels on inner mask edge are > considered during mask calculation"}, > + {1, "ADJACENT_ONLY", 0, "Adjacent Only", "Only inner mask > pixels adjacent to outer mask pixels are considered during mask calculation"}, > + {0, NULL, 0, NULL, NULL} > + }; > + > + prop = RNA_def_property(srna, "inner_mode", PROP_ENUM, PROP_NONE); > + RNA_def_property_enum_sdna(prop, NULL, "custom2"); > + RNA_def_property_enum_items(prop, InnerEdgeMode_items); > + RNA_def_property_ui_text(prop, "Inner Edge Mode", ""); > + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); > + > + prop = RNA_def_property(srna, "edge_mode", PROP_ENUM, PROP_NONE); > + RNA_def_property_enum_sdna(prop, NULL, "custom1"); > + RNA_def_property_enum_items(prop, BufEdgeMode_items); > + RNA_def_property_ui_text(prop, "Buffer Edge Mode", ""); > + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); > +} > + > static void def_cmp_map_uv(StructRNA *srna) > { > PropertyRNA *prop; > @@ -3375,4 +3404,3 @@ > #undef NODE_DEFINE_SUBTYPES > > #endif > - > > Modified: trunk/blender/source/blender/makesrna/intern/rna_nodetree_types.h > =================================================================== > --- trunk/blender/source/blender/makesrna/intern/rna_nodetree_types.h > 2012-01-10 19:01:27 UTC (rev 43264) > +++ trunk/blender/source/blender/makesrna/intern/rna_nodetree_types.h > 2012-01-10 19:08:08 UTC (rev 43265) > @@ -130,6 +130,7 @@ > DefNode( CompositorNode, CMP_NODE_SPLITVIEWER, def_cmp_splitviewer, > "SPLITVIEWER", SplitViewer, "Split Viewer", "" ) > DefNode( CompositorNode, CMP_NODE_MAP_UV, def_cmp_map_uv, > "MAP_UV", MapUV, "Map UV", "" ) > DefNode( CompositorNode, CMP_NODE_ID_MASK, def_cmp_id_mask, > "ID_MASK", IDMask, "ID Mask", "" ) > +DefNode( CompositorNode, CMP_NODE_DOUBLEEDGEMASK, > def_cmp_double_edge_mask,"DOUBLEEDGEMASK", DoubleEdgeMask, "Double Edge > Mask", "" ) > DefNode( CompositorNode, CMP_NODE_DEFOCUS, def_cmp_defocus, > "DEFOCUS", Defocus, "Defocus", "" ) > DefNode( CompositorNode, CMP_NODE_DISPLACE, 0, > "DISPLACE", Displace, "Displace", "" ) > DefNode( CompositorNode, CMP_NODE_COMBHSVA, 0, > "COMBHSVA", CombHSVA, "Combine HSVA", "" ) > > Modified: trunk/blender/source/blender/nodes/CMakeLists.txt > =================================================================== > --- trunk/blender/source/blender/nodes/CMakeLists.txt 2012-01-10 19:01:27 UTC > (rev 43264) > +++ trunk/blender/source/blender/nodes/CMakeLists.txt 2012-01-10 19:08:08 UTC > (rev 43265) > @@ -59,6 +59,7 @@ > composite/nodes/node_composite_composite.c > composite/nodes/node_composite_crop.c > composite/nodes/node_composite_curves.c > + composite/nodes/node_composite_doubleEdgeMask.c > composite/nodes/node_composite_defocus.c > composite/nodes/node_composite_diffMatte.c > composite/nodes/node_composite_dilate.c > > Modified: trunk/blender/source/blender/nodes/NOD_composite.h > =================================================================== > --- trunk/blender/source/blender/nodes/NOD_composite.h 2012-01-10 > 19:01:27 UTC (rev 43264) > +++ trunk/blender/source/blender/nodes/NOD_composite.h 2012-01-10 > 19:08:08 UTC (rev 43265) > @@ -80,6 +80,7 @@ > void register_node_type_cmp_vecblur(struct bNodeTreeType *ttype); > void register_node_type_cmp_dilateerode(struct bNodeTreeType *ttype); > void register_node_type_cmp_defocus(struct bNodeTreeType *ttype); > +void register_node_type_cmp_doubleedgemask(struct bNodeTreeType *ttype); > > void register_node_type_cmp_valtorgb(struct bNodeTreeType *ttype); > void register_node_type_cmp_rgbtobw(struct bNodeTreeType *ttype); > > Added: > trunk/blender/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c > =================================================================== > --- > trunk/blender/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c > (rev 0) > +++ > trunk/blender/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c > 2012-01-10 19:08:08 UTC (rev 43265) > @@ -0,0 +1,1183 @@ > +/* > + * $Id: node_composite_doubleEdgeMask.c 35237 2012-01-01 03:06:22Z > xgl.asyliax $ > + * > + * ***** 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) 2011 Blender Foundation. > + * All rights reserved. > + * > + * The Original Code is: all of this file. > + * > + * Contributor(s): Peter Larabell. > + * > + * ***** END GPL LICENSE BLOCK ***** > + */ > + > +/** \file blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c > + * \ingroup cmpnodes > + */ > +#include "node_composite_util.h" > +/* **************** DblEdgMatte ******************** */ > + > + > +static bNodeSocketTemplate cmp_node_doubleedgemask_in[]= { > + { SOCK_FLOAT, 1, "Inner Mask", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, > PROP_NONE}, // inner mask socket definition > + { SOCK_FLOAT, 1, "Outer Mask", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, > PROP_NONE}, // outer mask socket definition > + { -1, 0, "" } > // input socket array terminator > +}; > +static bNodeSocketTemplate cmp_node_doubleedgemask_out[]= { > + { SOCK_FLOAT, 0, "Mask"}, // output socket definition > + { -1, 0, "" } // output socket array terminator > +}; > + > +static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned > int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned > int *rsize){ > + int x; > + unsigned int isz=0; // inner edge size > + unsigned int osz=0; // outer edge size > + unsigned int gsz=0; // gradient fill area size > + /* Test the four corners */ > + /* upper left corner */ > + x=t-rw+1; > + // test if inner mask is filled > + if(limask[x]){ > > @@ Diff output truncated at 10240 characters. @@ > _______________________________________________ > Bf-blender-cvs mailing > listBf-blender-cvs@blender.orghttp://lists.blender.org/mailman/listinfo/bf-blender-cvs > > _______________________________________________ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers