[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27459] trunk/blender/source/blender: updated despill node to incorperate changes from Xavier Thomas' s patch #18012
Robert Holcomb
bob_holcomb at hotmail.com
Fri Mar 12 19:47:35 CET 2010
Revision: 27459
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27459
Author: scourage
Date: 2010-03-12 19:47:35 +0100 (Fri, 12 Mar 2010)
Log Message:
-----------
updated despill node to incorperate changes from Xavier Thomas's patch #18012
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_node/drawnode.c
trunk/blender/source/blender/makesdna/DNA_node_types.h
trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c
Modified: trunk/blender/source/blender/editors/space_node/drawnode.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/drawnode.c 2010-03-12 17:12:04 UTC (rev 27458)
+++ trunk/blender/source/blender/editors/space_node/drawnode.c 2010-03-12 18:47:35 UTC (rev 27459)
@@ -803,10 +803,26 @@
{
uiLayout *row, *col;
- col =uiLayoutColumn(layout, 0);
- uiItemR(col, NULL, 0, ptr, "factor", 0);
- row= uiLayoutRow(col, 0);
+ uiItemL(layout, "Despill Channel:", 0);
+ row =uiLayoutRow(layout,0);
uiItemR(row, NULL, 0, ptr, "channel", UI_ITEM_R_EXPAND);
+
+ col= uiLayoutColumn(layout, 0);
+ uiItemR(col, NULL, 0, ptr, "algorithm", 0);
+
+ if(RNA_enum_get(ptr, "algorithm")==0) {
+ uiItemL(col, "Limiting Channel:", 0);
+ row=uiLayoutRow(col,0);
+ uiItemR(row, NULL, 0, ptr, "limit_channel", UI_ITEM_R_EXPAND);
+ }
+
+ uiItemR(col, NULL, 0, ptr, "ratio", UI_ITEM_R_SLIDER);
+ uiItemR(col, NULL, 0, ptr, "unspill", 0);
+ if (RNA_enum_get(ptr, "unspill")== 1) {
+ uiItemR(col, NULL, 0, ptr, "unspill_red", UI_ITEM_R_SLIDER);
+ uiItemR(col, NULL, 0, ptr, "unspill_green", UI_ITEM_R_SLIDER);
+ uiItemR(col, NULL, 0, ptr, "unspill_blue", UI_ITEM_R_SLIDER);
+ }
}
static void node_composit_buts_chroma_matte(uiLayout *layout, bContext *C, PointerRNA *ptr)
Modified: trunk/blender/source/blender/makesdna/DNA_node_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_node_types.h 2010-03-12 17:12:04 UTC (rev 27458)
+++ trunk/blender/source/blender/makesdna/DNA_node_types.h 2010-03-12 18:47:35 UTC (rev 27459)
@@ -22,7 +22,7 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): none yet.
+ * Contributor(s): Bob Holcomb, Xavier Thomas
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -312,6 +312,12 @@
float gain[3];
} NodeColorBalance;
+typedef struct NodeColorspill {
+ short limchan, unspill;
+ float limscale;
+ float uspillr, uspillg, uspillb;
+}NodeColorspill;
+
/* TEX_output */
typedef struct TexNodeOutput {
char name[32];
Modified: trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_nodetree.c 2010-03-12 17:12:04 UTC (rev 27458)
+++ trunk/blender/source/blender/makesrna/intern/rna_nodetree.c 2010-03-12 18:47:35 UTC (rev 27459)
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor(s): Blender Foundation (2008), Nathan Letwory, Robin Allen
+ * Contributor(s): Blender Foundation (2008), Nathan Letwory, Robin Allen, Bob Holcomb
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -1287,12 +1287,23 @@
static void def_cmp_color_spill(StructRNA *srna)
{
PropertyRNA *prop;
-
+
static EnumPropertyItem channel_items[] = {
{1, "R", 0, "R", "Red Spill Suppression"},
{2, "G", 0, "G", "Green Spill Suppression"},
{3, "B", 0, "B", "Blue Spill Suppression"},
{0, NULL, 0, NULL, NULL}};
+
+ static EnumPropertyItem limit_channel_items[] = {
+ {1, "R", 0, "R", "Limit by Red"},
+ {2, "G", 0, "G", "Limit by Green"},
+ {3, "B", 0, "B", "Limit by Blue"},
+ {0, NULL, 0, NULL, NULL}};
+
+ static EnumPropertyItem algorithm_items[] = {
+ {0, "SIMPLE", 0, "Simple", "Simple Limit Algorithm"},
+ {1, "AVERAGE", 0, "Average", "Average Limit Algorithm"},
+ {0, NULL, 0, NULL, NULL}};
prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "custom1");
@@ -1300,13 +1311,48 @@
RNA_def_property_ui_text(prop, "Channel", "");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
- RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
-
- prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "t1");
- RNA_def_property_range(prop, 0.0f, 0.5f);
- RNA_def_property_ui_text(prop, "Amount", "How much the selected channel is affected by");
+ prop = RNA_def_property(srna, "algorithm", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom2");
+ RNA_def_property_enum_items(prop, algorithm_items);
+ RNA_def_property_ui_text(prop, "Algorithm", "");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
+ RNA_def_struct_sdna_from(srna, "NodeColorspill", "storage");
+
+ prop = RNA_def_property(srna, "limit_channel", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "limchan");
+ RNA_def_property_enum_items(prop, limit_channel_items);
+ RNA_def_property_ui_text(prop, "Limit Channel", "");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "limscale");
+ RNA_def_property_range(prop, 0.5f, 1.5f);
+ RNA_def_property_ui_text(prop, "Ratio", "Scale limit by value");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "unspill", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "unspill", 0);
+ RNA_def_property_ui_text(prop, "Unspill", "Compensate all channels (diffenrently) by hand");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "unspill_red", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "uspillr");
+ RNA_def_property_range(prop, 0.0f, 1.5f);
+ RNA_def_property_ui_text(prop, "R", "Red spillmap scale");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "unspill_green", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "uspillg");
+ RNA_def_property_range(prop, 0.0f, 1.5f);
+ RNA_def_property_ui_text(prop, "G", "Green spillmap scale");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "unspill_blue", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "uspillb");
+ RNA_def_property_range(prop, 0.0f, 1.5f);
+ RNA_def_property_ui_text(prop, "B", "Blue spillmap scale");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
}
static void def_cmp_luma_matte(StructRNA *srna)
Modified: trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c 2010-03-12 17:12:04 UTC (rev 27458)
+++ trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c 2010-03-12 18:47:35 UTC (rev 27459)
@@ -22,7 +22,7 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): none yet.
+ * Contributor(s): Bob Holcomb, Xavier Thomas
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -30,6 +30,7 @@
#include "../CMP_util.h"
+#define avg(a,b) ((a+b)/2)
/* ******************* Color Spill Supression ********************************* */
static bNodeSocketType cmp_node_color_spill_in[]={
@@ -42,33 +43,93 @@
{-1,0,""}
};
-static void do_reduce_red(bNode *node, float* out, float *in)
+static void do_simple_spillmap_red(bNode *node, float* out, float *in)
{
- NodeChroma *c;
- c=node->storage;
-
- if(in[0] > in[1] && in[0] > in[2]) {
- out[0]=((in[1]+in[2])/2)*(1-c->t1);
+ NodeColorspill *ncs;
+ ncs=node->storage;
+ out[0]=in[0]-( ncs->limscale * in[ncs->limchan] );
+}
+
+static void do_simple_spillmap_green(bNode *node, float* out, float *in)
+{
+ NodeColorspill *ncs;
+ ncs=node->storage;
+ out[0]=in[1]-( ncs->limscale * in[ncs->limchan] );
+}
+
+static void do_simple_spillmap_blue(bNode *node, float* out, float *in)
+{
+ NodeColorspill *ncs;
+ ncs=node->storage;
+ out[0]=in[2]-( ncs->limscale * in[ncs->limchan] );
+}
+
+static void do_average_spillmap_red(bNode *node, float* out, float *in)
+{
+ NodeColorspill *ncs;
+ ncs=node->storage;
+ out[0]=in[0]-(ncs->limscale * avg(in[1], in[2]) );
+}
+
+static void do_average_spillmap_green(bNode *node, float* out, float *in)
+{
+ NodeColorspill *ncs;
+ ncs=node->storage;
+ out[0]=in[1]-(ncs->limscale * avg(in[0], in[2]) );
+}
+
+static void do_average_spillmap_blue(bNode *node, float* out, float *in)
+{
+ NodeColorspill *ncs;
+ ncs=node->storage;
+ out[0]=in[2]-(ncs->limscale * avg(in[0], in[1]) );
+}
+
+static void do_apply_spillmap_red(bNode *node, float* out, float *in, float *map)
+{
+ NodeColorspill *ncs;
+ ncs=node->storage;
+ if(map[0]>0) {
+ out[0]=in[0]-(ncs->uspillr*map[0]);
+ out[1]=in[1]+(ncs->uspillg*map[0]);
+ out[2]=in[2]+(ncs->uspillb*map[0]);
}
+ else {
+ out[0]=in[0];
+ out[1]=in[1];
+ out[2]=in[2];
+ }
}
-static void do_reduce_green(bNode *node, float* out, float *in)
+static void do_apply_spillmap_green(bNode *node, float* out, float *in, float *map)
{
- NodeChroma *c;
- c=node->storage;
-
- if(in[1] > in[0] && in[1] > in[2]) {
- out[1]=((in[0]+in[2])/2)*(1-c->t1);
+ NodeColorspill *ncs;
+ ncs=node->storage;
+ if(map[0]>0) {
+ out[0]=in[0]+(ncs->uspillr*map[0]);
+ out[1]=in[1]-(ncs->uspillg*map[0]);
+ out[2]=in[2]+(ncs->uspillb*map[0]);
+ }
+ else {
+ out[0]=in[0];
+ out[1]=in[1];
+ out[2]=in[2];
}
}
-static void do_reduce_blue(bNode *node, float* out, float *in)
+static void do_apply_spillmap_blue(bNode *node, float* out, float *in, float *map)
{
- NodeChroma *c;
- c=node->storage;
-
- if(in[2] > in[1] && in[2] > in[1]) {
- out[2]=((in[1]+in[0])/2)*(1-c->t1);
+ NodeColorspill *ncs;
+ ncs=node->storage;
+ if(map[0]>0) {
+ out[0]=in[0]+(ncs->uspillr*map[0]);
+ out[1]=in[1]+(ncs->uspillg*map[0]);
+ out[2]=in[2]-(ncs->uspillb*map[0]);
+ }
+ else {
+ out[0]=in[0];
+ out[1]=in[1];
+ out[2]=in[2];
}
}
@@ -79,28 +140,86 @@
discussions from vfxtalk.com.*/
CompBuf *cbuf;
CompBuf *rgbbuf;
+ CompBuf *spillmap;
+ NodeColorspill *ncs;
+ ncs=node->storage;
if(out[0]->hasoutput==0 || in[0]->hasinput==0) return;
if(in[0]->data==NULL) return;
cbuf=typecheck_compbuf(in[0]->data, CB_RGBA);
+ spillmap=alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1);
rgbbuf=dupalloc_compbuf(cbuf);
switch(node->custom1)
{
case 1: /*red spill*/
{
- composit1_pixel_processor(node, rgbbuf, cbuf, in[1]->vec, do_reduce_red, CB_RGBA);
+ switch(node->custom2)
+ {
+ case 0: /* simple limit */
+ {
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list