[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23104] branches/blender2.5/blender/source /blender: Added Levels Node (histogram, with mean/std deviation outputs)

Robert Holcomb bob_holcomb at hotmail.com
Thu Sep 10 06:12:22 CEST 2009


Revision: 23104
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23104
Author:   scourage
Date:     2009-09-10 06:12:22 +0200 (Thu, 10 Sep 2009)

Log Message:
-----------
Added Levels Node (histogram, with mean/std deviation outputs)
Added RGB space distance matte Node
Added HSV color matte Node

Fixed Image difference matte Node to use image differences instead of RGB space distance
Fixed luminance node for low end values being read wrong
Fixed CMP_util copy/swap functions not accounting for all channels
Fixed UI for difference matte Node 

Added RNA for new nodes

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/BKE_node.h
    branches/blender2.5/blender/source/blender/blenkernel/intern/node.c
    branches/blender2.5/blender/source/blender/editors/space_node/drawnode.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_nodetree.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_nodetree_types.h
    branches/blender2.5/blender/source/blender/nodes/CMP_node.h
    branches/blender2.5/blender/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c
    branches/blender2.5/blender/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c
    branches/blender2.5/blender/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c
    branches/blender2.5/blender/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c
    branches/blender2.5/blender/source/blender/nodes/intern/CMP_util.c
    branches/blender2.5/blender/source/blender/nodes/intern/CMP_util.h

Added Paths:
-----------
    branches/blender2.5/blender/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c
    branches/blender2.5/blender/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c
    branches/blender2.5/blender/source/blender/nodes/intern/CMP_nodes/CMP_levels.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/BKE_node.h
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/BKE_node.h	2009-09-10 03:59:12 UTC (rev 23103)
+++ branches/blender2.5/blender/source/blender/blenkernel/BKE_node.h	2009-09-10 04:12:22 UTC (rev 23104)
@@ -25,7 +25,7 @@
  *
  * The Original Code is: all of this file.
  *
- * Contributor(s): none yet.
+ * Contributor(s): Bob Holcomb.
  *
  * ***** END GPL LICENSE BLOCK *****
  */
@@ -325,7 +325,7 @@
 #define CMP_NODE_COMBYUVA	234
 #define CMP_NODE_DIFF_MATTE	235
 #define CMP_NODE_COLOR_SPILL	236
-#define CMP_NODE_CHROMA		237
+#define CMP_NODE_CHROMA_MATTE	237
 #define CMP_NODE_CHANNEL_MATTE	238
 #define CMP_NODE_FLIP		239
 #define CMP_NODE_SPLITVIEWER	240
@@ -345,6 +345,9 @@
 #define CMP_NODE_DBLUR		254
 #define CMP_NODE_BILATERALBLUR  255
 #define CMP_NODE_PREMULKEY  256
+#define CMP_NODE_DIST_MATTE	257
+#define CMP_NODE_VIEW_LEVELS    258
+#define CMP_NODE_COLOR_MATTE 259
 
 #define CMP_NODE_GLARE		301
 #define CMP_NODE_TONEMAP	302

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/node.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/node.c	2009-09-10 03:59:12 UTC (rev 23103)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/node.c	2009-09-10 04:12:22 UTC (rev 23104)
@@ -22,7 +22,7 @@
  *
  * The Original Code is: all of this file.
  *
- * Contributor(s): none yet.
+ * Contributor(s): Bob Holcomb.
  *
  * ***** END GPL LICENSE BLOCK *****
  */
@@ -2597,7 +2597,7 @@
 				if(outsocket_exists(lnode->new_node, lsock->new_sock)) {
 					lsock->new_sock->ns.data= lsock->ns.data;
 					lsock->ns.data= NULL;
-					lsock->new_sock= NULL;
+						lsock->new_sock= NULL;
 				}
 			}
 		}
@@ -2932,6 +2932,7 @@
 	nodeRegisterType(ntypelist, &cmp_node_viewer);
 	nodeRegisterType(ntypelist, &cmp_node_splitviewer);
 	nodeRegisterType(ntypelist, &cmp_node_output_file);
+	nodeRegisterType(ntypelist, &cmp_node_view_levels);
 	
 	nodeRegisterType(ntypelist, &cmp_node_curve_rgb);
 	nodeRegisterType(ntypelist, &cmp_node_mix_rgb);
@@ -2971,7 +2972,9 @@
 	nodeRegisterType(ntypelist, &cmp_node_premulkey);
 	
 	nodeRegisterType(ntypelist, &cmp_node_diff_matte);
-	nodeRegisterType(ntypelist, &cmp_node_chroma);
+	nodeRegisterType(ntypelist, &cmp_node_distance_matte);
+	nodeRegisterType(ntypelist, &cmp_node_chroma_matte);
+	nodeRegisterType(ntypelist, &cmp_node_color_matte);
 	nodeRegisterType(ntypelist, &cmp_node_channel_matte);
 	nodeRegisterType(ntypelist, &cmp_node_color_spill);
 	nodeRegisterType(ntypelist, &cmp_node_luma_matte);

Modified: branches/blender2.5/blender/source/blender/editors/space_node/drawnode.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_node/drawnode.c	2009-09-10 03:59:12 UTC (rev 23103)
+++ branches/blender2.5/blender/source/blender/editors/space_node/drawnode.c	2009-09-10 04:12:22 UTC (rev 23104)
@@ -22,7 +22,7 @@
  *
  * The Original Code is: all of this file.
  *
- * Contributor(s): David Millan Escriva, Juho Vepsäläinen
+ * Contributor(s): David Millan Escriva, Juho Vepsäläinen, Bob Holcomb
  *
  * ***** END GPL LICENSE BLOCK *****
  */
@@ -1647,45 +1647,35 @@
 static int node_composit_buts_diff_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
 {
 	if(block) {
-		short sx= (butr->xmax-butr->xmin)/4;
-		short dx= (butr->xmax-butr->xmin)/3;
 		NodeChroma *c= node->storage;
 		
 		uiBlockBeginAlign(block);
-		/*color space selectors*/
-		uiDefButS(block, ROW,B_NODE_EXEC,"RGB",
-							butr->xmin,butr->ymin+60,sx,20,
-							&node->custom1,1,1, 0, 0, "RGB Color Space");
-		uiDefButS(block, ROW,B_NODE_EXEC,"HSV",
-							butr->xmin+sx,butr->ymin+60,sx,20,
-							&node->custom1,1,2, 0, 0, "HSV Color Space");
-		uiDefButS(block, ROW,B_NODE_EXEC,"YUV",
-							butr->xmin+2*sx,butr->ymin+60,sx,20,
-							&node->custom1,1,3, 0, 0, "YUV Color Space");
-					uiDefButS(block, ROW,B_NODE_EXEC,"YCC",
-							butr->xmin+3*sx,butr->ymin+60,sx,20,
-							&node->custom1,1,4, 0, 0, "YCbCr Color Space");
-		/*channel tolorences*/
-		uiDefButF(block, NUM, B_NODE_EXEC, " ",
-							butr->xmin, butr->ymin+40, dx, 20,
-							&c->t1, 0.0f, 1.0f, 100, 0, "Channel 1 Tolerance");
-		uiDefButF(block, NUM, B_NODE_EXEC, " ",
-							butr->xmin+dx, butr->ymin+40, dx, 20,
-							&c->t2, 0.0f, 1.0f, 100, 0, "Channel 2 Tolorence");
-		uiDefButF(block, NUM, B_NODE_EXEC, " ",
-							butr->xmin+2*dx, butr->ymin+40, dx, 20,
-							&c->t3, 0.0f, 1.0f, 100, 0, "Channel 3 Tolorence");
-		/*falloff parameters*/
-		/*
-		uiDefButF(block, NUMSLI, B_NODE_EXEC, "Falloff Size ",
+		uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Tolerance: ", 
 			butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20,
-			&c->fsize, 0.0f, 1.0f, 100, 0, "");
-		*/
-		uiDefButF(block, NUMSLI, B_NODE_EXEC, "Falloff: ",
+			&c->t1, 0.0f, 1.0f, 100, 0, "Color differences below this threshold are keyed.");
+		uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Falloff: ", 
+			butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
+			&c->t2, 0.0f, 1.0f, 100, 0, "Color differences below this additional threshold are partially keyed.");
+      uiBlockEndAlign(block);
+	}
+	return 40;
+}
+
+static int node_composit_buts_distance_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+{
+	if(block) {
+		NodeChroma *c= node->storage;
+		
+		uiBlockBeginAlign(block);
+		uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Tolerance: ", 
 			butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20,
-			&c->fstrength, 0.0f, 1.0f, 100, 0, "");
+			&c->t1, 0.0f, 1.0f, 100, 0, "Color distances below this threshold are keyed.");
+		uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Falloff: ", 
+			butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
+			&c->t2, 0.0f, 1.0f, 100, 0, "Color distances below this additional threshold are partially keyed.");
+       uiBlockEndAlign(block);
 	}
-	return 80;
+	return 40;
 }
 
 static int node_composit_buts_color_spill(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
@@ -1717,6 +1707,7 @@
 	if(block) {
 		short dx=(butr->xmax-butr->xmin)/2;
 		NodeChroma *c= node->storage;
+
 		uiBlockBeginAlign(block);
 
 		uiDefButF(block, NUMSLI, B_NODE_EXEC, "Acceptance ",
@@ -1736,6 +1727,7 @@
 		uiDefButF(block, NUMSLI, B_NODE_EXEC, "Shadow Adjust ",
 			butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
 			&c->t3, 0.0f, 1.0f, 100, 0, "Adjusts the brightness of any shadows captured");
+		uiBlockEndAlign(block);
 
 		if(c->t2 > c->t1)
 			c->t2=c->t1;
@@ -1743,6 +1735,28 @@
 	return 80;
 }
 
+static int node_composit_buts_color_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+{
+	if(block) {
+		NodeChroma *c= node->storage;
+		uiBlockBeginAlign(block);
+
+		uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "H: ",
+			butr->xmin, butr->ymin+40, butr->xmax-butr->xmin, 20,
+			&c->t1, 0.0f, 0.25f, 100, 0, "Hue tolerance for colors to be considered a keying color");
+		uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "S: ",
+			butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20,
+			&c->t2, 0.0f, 1.0f, 100, 0, "Saturation Tolerance for the color");
+		uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "V: ",
+			butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
+			&c->t3, 0.0f, 1.0f, 100, 0, "Value Tolerance for the color");
+
+		uiBlockEndAlign(block);
+	}
+	return 60;
+}
+
+
 static int node_composit_buts_channel_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
 {
 	if(block) {
@@ -1977,6 +1991,29 @@
 	return 20;
 }
 
+static int node_composit_buts_view_levels(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+{
+	if(block) {
+		short sx= (butr->xmax-butr->xmin)/5;
+	
+		/*color space selectors*/
+		uiBlockBeginAlign(block);
+		uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"C",
+			butr->xmin,butr->ymin,sx,20,&node->custom1,1,1, 0, 0, "Combined RGB");
+		uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"R",
+			butr->xmin+sx,butr->ymin,sx,20,&node->custom1,1,2, 0, 0, "Red Channel");
+		uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"G",
+			butr->xmin+2*sx,butr->ymin,sx,20,&node->custom1,1,3, 0, 0, "Green Channel");
+		uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"B",
+			butr->xmin+3*sx,butr->ymin,sx,20,&node->custom1,1,4, 0, 0, "Blue Channel");
+      uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"L",
+			butr->xmin+4*sx,butr->ymin,sx,20,&node->custom1,1,5, 0, 0, "Luminenc Channel");
+		uiBlockEndAlign(block);
+	}
+	return 20;
+}
+
+
 /* only once called */
 static void node_composit_set_butfunc(bNodeType *ntype)
 {
@@ -2070,17 +2107,22 @@
 			break;
 		case CMP_NODE_OUTPUT_FILE:
 			ntype->butfunc= node_composit_buts_file_output;
-			break;
-	
+			break;	
 		case CMP_NODE_DIFF_MATTE:
 			ntype->butfunc=node_composit_buts_diff_matte;
 			break;
+		case CMP_NODE_DIST_MATTE:
+			ntype->butfunc=node_composit_buts_distance_matte;
+			break;
 		case CMP_NODE_COLOR_SPILL:
 			ntype->butfunc=node_composit_buts_color_spill;
 			break;
-		case CMP_NODE_CHROMA:
+		case CMP_NODE_CHROMA_MATTE:
 			ntype->butfunc=node_composit_buts_chroma_matte;
 			break;
+		case CMP_NODE_COLOR_MATTE:
+			ntype->butfunc=node_composit_buts_color_matte;
+			break;
 		case CMP_NODE_SCALE:
 			ntype->butfunc= node_composit_buts_scale;
 			break;
@@ -2105,6 +2147,9 @@
 		case CMP_NODE_PREMULKEY:
 			ntype->butfunc= node_composit_buts_premulkey;
 			break;
+      case CMP_NODE_VIEW_LEVELS:
+			ntype->butfunc=node_composit_buts_view_levels;
+ 			break;
 		default:
 			ntype->butfunc= NULL;
 	}

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_nodetree.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_nodetree.c	2009-09-10 03:59:12 UTC (rev 23103)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_nodetree.c	2009-09-10 04:12:22 UTC (rev 23104)
@@ -747,43 +747,63 @@
 static void def_cmp_diff_matte(StructRNA *srna)
 {
 	PropertyRNA *prop;
+
+	RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
+
+	/* TODO: nicer wrapping for tolerances */	
 	
-	static EnumPropertyItem color_space_items[] = {
-		{1, "RGB", 0, "RGB",   ""},
-		{2, "HSV", 0, "HSV",   ""},
-		{3, "YUV", 0, "YUV",   ""},
-		{4, "YCC", 0, "YCbCr", ""},
-		{0, NULL, 0, NULL, NULL}
-	};

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list