[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24112] trunk/blender/source/blender: 2. 5 Nodes:

Thomas Dinges dingto at gmx.de
Tue Oct 27 14:46:02 CET 2009


Revision: 24112
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24112
Author:   dingto
Date:     2009-10-27 14:46:02 +0100 (Tue, 27 Oct 2009)

Log Message:
-----------
2.5 Nodes:

* Added missing button set functions for Matte Nodes.
* Wrapped some Matte Nodes to new Layout Engine. 

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_node/drawnode.c
    trunk/blender/source/blender/makesrna/intern/rna_nodetree.c

Modified: trunk/blender/source/blender/editors/space_node/drawnode.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/drawnode.c	2009-10-27 13:40:41 UTC (rev 24111)
+++ trunk/blender/source/blender/editors/space_node/drawnode.c	2009-10-27 13:46:02 UTC (rev 24112)
@@ -1362,7 +1362,6 @@
 
 static void node_composit_buts_chroma_matte(uiLayout *layout, PointerRNA *ptr)
 {
-
 	uiLayout *col;
 	
 	col= uiLayoutColumn(layout, 0);
@@ -1373,26 +1372,6 @@
 	uiItemR(col, NULL, 0, ptr, "lift", UI_ITEM_R_SLIDER);
 	uiItemR(col, NULL, 0, ptr, "gain", UI_ITEM_R_SLIDER);
 	uiItemR(col, NULL, 0, ptr, "shadow_adjust", UI_ITEM_R_SLIDER);
-
-//	uiBlock *block= uiLayoutAbsoluteBlock(layout);
-//	bNode *node= ptr->data;
-//	rctf *butr= &node->butr;
-//	short dx=(butr->xmax-butr->xmin)/2;
-//	NodeChroma *c= node->storage;
-
-//	uiBlockBeginAlign(block);
-//
-//	uiDefButF(block, NUMSLI, B_NODE_EXEC, "Acceptance ", butr->xmin, butr->ymin+60, butr->xmax-butr->xmin, 20, &c->t1, 1.0f, 80.0f, 100, 0, "Tolerance for colors to be considered a keying color");
-//	uiDefButF(block, NUMSLI, B_NODE_EXEC, "Cutoff ", butr->xmin, butr->ymin+40, butr->xmax-butr->xmin, 20, &c->t2, 0.0f, 30.0f, 100, 0, "Colors below this will be considered as exact matches for keying color");
-//
-//	uiDefButF(block, NUMSLI, B_NODE_EXEC, "Lift ", butr->xmin, butr->ymin+20, dx, 20, &c->fsize, 0.0f, 1.0f, 100, 0, "Alpha Lift");
-//	uiDefButF(block, NUMSLI, B_NODE_EXEC, "Gain ", butr->xmin+dx, butr->ymin+20, dx, 20, &c->fstrength, 0.0f, 1.0f, 100, 0, "Alpha Gain");
-//
-//	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;
 }
 
 static void node_composit_buts_color_matte(uiLayout *layout, PointerRNA *ptr)
@@ -1406,7 +1385,9 @@
 }
 
 static void node_composit_buts_channel_matte(uiLayout *layout, PointerRNA *ptr)
-{
+{	
+	uiLayout *col, *row;
+	
 	uiBlock *block= uiLayoutAbsoluteBlock(layout);
 	bNode *node= ptr->data;
 	rctf *butr= &node->butr;
@@ -1415,16 +1396,9 @@
 	NodeChroma *c=node->storage;
 	char *c1, *c2, *c3;
 
-	/*color space selectors*/
-	uiBlockBeginAlign(block);
-	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");
+	/*color space selector*/
+	row= uiLayoutRow(layout, 0);
+	uiItemR(row, NULL, 0, ptr, "color_space", UI_ITEM_R_EXPAND);
 
 	if (node->custom1==1) {
 		c1="R"; c2="G"; c3="B";
@@ -1440,48 +1414,30 @@
 	}
 
 	/*channel selector */
+	row= uiLayoutRow(layout, 0);
+	uiBlockBeginAlign(block);
 	uiDefButS(block, ROW, B_NODE_EXEC, c1,
 		butr->xmin,butr->ymin+40,cx,20,&node->custom2,1, 1, 0, 0, "Channel 1");
 	uiDefButS(block, ROW, B_NODE_EXEC, c2,
 		butr->xmin+cx,butr->ymin+40,cx,20,&node->custom2,1, 2, 0, 0, "Channel 2");
 	uiDefButS(block, ROW, B_NODE_EXEC, c3,
 		butr->xmin+cx+cx,butr->ymin+40,cx,20,&node->custom2, 1, 3, 0, 0, "Channel 3");
+	uiBlockEndAlign(block);
 
 	/*tolerance sliders */
-	uiDefButF(block, NUMSLI, B_NODE_EXEC, "High ", 
-		butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20,
-		&c->t1, 0.0f, 1.0f, 100, 0, "Values higher than this setting are 100% opaque");
-	uiDefButF(block, NUMSLI, B_NODE_EXEC, "Low ", 
-		butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
-		&c->t2, 0.0f, 1.0f, 100, 0, "Values lower than this setting are 100% keyed");
-	uiBlockEndAlign(block);
+	col =uiLayoutColumn(layout, 1);
+	uiItemR(col, NULL, 0, ptr, "high", UI_ITEM_R_SLIDER);
+	uiItemR(col, NULL, 0, ptr, "low", UI_ITEM_R_SLIDER);
 
-	/*keep t2 (low) less than t1 (high) */
-	if(c->t2 > c->t1) {
-		c->t2=c->t1;
-	}
 }
 
 static void node_composit_buts_luma_matte(uiLayout *layout, PointerRNA *ptr)
 {
-	uiBlock *block= uiLayoutAbsoluteBlock(layout);
-	bNode *node= ptr->data;
-	rctf *butr= &node->butr;
-	NodeChroma *c=node->storage;
-
-	/*tolerance sliders */
-	uiDefButF(block, NUMSLI, B_NODE_EXEC, "High ", 
-		butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20,
-		&c->t1, 0.0f, 1.0f, 100, 0, "Values higher than this setting are 100% opaque");
-	uiDefButF(block, NUMSLI, B_NODE_EXEC, "Low ", 
-		butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
-		&c->t2, 0.0f, 1.0f, 100, 0, "Values lower than this setting are 100% keyed");
-	uiBlockEndAlign(block);
-
-	/*keep t2 (low) less than t1 (high) */
-	if(c->t2 > c->t1) {
-		c->t2=c->t1;
-	}
+	uiLayout *col;
+	
+	col= uiLayoutColumn(layout, 1);
+	uiItemR(col, NULL, 0, ptr, "high", UI_ITEM_R_SLIDER);
+	uiItemR(col, NULL, 0, ptr, "low", UI_ITEM_R_SLIDER);
 }
 
 static void node_composit_buts_map_uv(uiLayout *layout, PointerRNA *ptr)

Modified: trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2009-10-27 13:40:41 UTC (rev 24111)
+++ trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2009-10-27 13:46:02 UTC (rev 24112)
@@ -157,6 +157,29 @@
 	return 0;
 }
 
+/* Button Set Funcs for Matte Nodes */
+static void rna_Matte_t1_set(PointerRNA *ptr, float value)
+{
+	bNode *node= (bNode*)ptr->data;
+	NodeChroma *chroma = node->storage;
+	
+	chroma->t1 = value;
+	
+	if(value < chroma->t2) 
+		chroma->t2 = value;
+}
+
+static void rna_Matte_t2_set(PointerRNA *ptr, float value)
+{
+	bNode *node= (bNode*)ptr->data;
+	NodeChroma *chroma = node->storage;
+	
+	if(value > chroma->t1) 
+		value = chroma->t1;
+	
+	chroma->t2 = value;
+}
+
 static void rna_Node_update(bContext *C, PointerRNA *ptr)
 {
 	Main *bmain= CTX_data_main(C);
@@ -948,17 +971,17 @@
 	PropertyRNA *prop;
 
 	RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
-
-	/* TODO: nicer wrapping for tolerances */	
 	
 	prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "t1");
+	RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed.");
 	RNA_def_property_update(prop, 0, "rna_Node_update");
 	
 	prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "t2");
+	RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Falloff", "Color distances below this additional threshold are partially keyed.");
 	RNA_def_property_update(prop, 0, "rna_Node_update");
@@ -969,9 +992,7 @@
 	PropertyRNA *prop;
 	
 	RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
-	
-	/* TODO: nicer wrapping for tolerances */
-	
+
 	prop = RNA_def_property(srna, "h", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "t1");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
@@ -997,16 +1018,16 @@
 	
 	RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
 	
-	/* TODO: nicer wrapping for tolerances */
-	
 	prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "t1");
+	RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed.");
 	RNA_def_property_update(prop, 0, "rna_Node_update");
 	
 	prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "t2");
+	RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Falloff", "Color distances below this additional threshold are partially keyed.");
 	RNA_def_property_update(prop, 0, "rna_Node_update");
@@ -1038,6 +1059,27 @@
 	RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
+static void def_cmp_luma_matte(StructRNA *srna)
+{
+	PropertyRNA *prop;
+	
+	RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
+	
+	prop = RNA_def_property(srna, "high", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "t1");
+	RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
+	RNA_def_property_range(prop, 0.0f, 1.0f);
+	RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
+	RNA_def_property_update(prop, 0, "rna_Node_update");
+	
+	prop = RNA_def_property(srna, "low", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "t2");
+	RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
+	RNA_def_property_range(prop, 0.0f, 1.0f);
+	RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
+	RNA_def_property_update(prop, 0, "rna_Node_update");
+}
+
 static void def_cmp_chroma_matte(StructRNA *srna)
 {
 	PropertyRNA *prop;
@@ -1046,12 +1088,14 @@
 	
 	prop = RNA_def_property(srna, "acceptance", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "t1");
+	RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
 	RNA_def_property_range(prop, 1.0f, 80.0f);
 	RNA_def_property_ui_text(prop, "Acceptance", "Tolerance for a color to be considered a keying color");
 	RNA_def_property_update(prop, 0, "rna_Node_update");
 	
 	prop = RNA_def_property(srna, "cutoff", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "t2");
+	RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
 	RNA_def_property_range(prop, 0.0f, 30.0f);
 	RNA_def_property_ui_text(prop, "Cutoff", "Tolerance below which colors will be considered as exact matches");
 	RNA_def_property_update(prop, 0, "rna_Node_update");
@@ -1073,11 +1117,6 @@
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Shadow Adjust", "Adjusts the brightness of any shadows captured");
 	RNA_def_property_update(prop, 0, "rna_Node_update");
-	
-	/* TODO: 
-		if(c->t2 > c->t1)
-			c->t2=c->t1;
-	*/
 }
 
 static void def_cmp_channel_matte(StructRNA *srna)
@@ -1085,10 +1124,10 @@

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list