[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23354] trunk/blender/source/blender: More Nodes wrapped to Layout Engine:

Thomas Dinges dingto at gmx.de
Sat Sep 19 21:57:30 CEST 2009


Revision: 23354
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23354
Author:   dingto
Date:     2009-09-19 21:57:30 +0200 (Sat, 19 Sep 2009)

Log Message:
-----------
More Nodes wrapped to Layout Engine:

* Map Value, Alpha Over, Hue Saturation, Dilate/Erode
* RNA fixes and additions. 

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

Modified: trunk/blender/source/blender/editors/space_node/drawnode.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/drawnode.c	2009-09-19 19:40:38 UTC (rev 23353)
+++ trunk/blender/source/blender/editors/space_node/drawnode.c	2009-09-19 19:57:30 UTC (rev 23354)
@@ -1348,72 +1348,49 @@
 
 static void node_composit_buts_map_value(uiLayout *layout, PointerRNA *ptr)
 {
-	uiBlock *block= uiLayoutFreeBlock(layout);
-	bNode *node= ptr->data;
-	rctf *butr= &node->butr;
-	TexMapping *texmap= node->storage;
-	short xstart= (short)butr->xmin;
-	short dy= (short)(butr->ymax-19.0f);
-	short dx= (short)(butr->xmax-butr->xmin)/2;
+	uiLayout *sub, *col;
 	
-	uiBlockBeginAlign(block);
-	uiDefButF(block, NUM, B_NODE_EXEC, "Offs:", xstart, dy, 2*dx, 19, texmap->loc, -1000.0f, 1000.0f, 10, 2, "");
-	dy-= 19;
-	uiDefButF(block, NUM, B_NODE_EXEC, "Size:", xstart, dy, 2*dx, 19, texmap->size, -1000.0f, 1000.0f, 10, 3, "");
-	dy-= 23;
-	uiBlockBeginAlign(block);
-	uiDefButBitI(block, TOG, TEXMAP_CLIP_MIN, B_NODE_EXEC, "Min", xstart, dy, dx, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
-	uiDefButF(block, NUM, B_NODE_EXEC, "", xstart+dx, dy, dx, 19, texmap->min, -1000.0f, 1000.0f, 10, 2, "");
-	dy-= 19;
-	uiDefButBitI(block, TOG, TEXMAP_CLIP_MAX, B_NODE_EXEC, "Max", xstart, dy, dx, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
-	uiDefButF(block, NUM, B_NODE_EXEC, "", xstart+dx, dy, dx, 19, texmap->max, -1000.0f, 1000.0f, 10, 2, "");
+	col =uiLayoutColumn(layout, 1);
+	uiItemR(col, NULL, 0, ptr, "offset", 0);
+	uiItemR(col, NULL, 0, ptr, "size", 0);
+	
+	col =uiLayoutColumn(layout, 1);
+	uiItemR(col, NULL, 0, ptr, "use_min", 0);
+	sub =uiLayoutColumn(col, 0);
+	uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_min"));
+	uiItemR(sub, "", 0, ptr, "min", 0);
+	
+	col =uiLayoutColumn(layout, 1);
+	uiItemR(col, NULL, 0, ptr, "use_max", 0);
+	sub =uiLayoutColumn(col, 0);
+	uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_max"));
+	uiItemR(sub, "", 0, ptr, "max", 0);
 }
 
 static void node_composit_buts_alphaover(uiLayout *layout, PointerRNA *ptr)
-{
-	uiBlock *block= uiLayoutFreeBlock(layout);
-	bNode *node= ptr->data;
-	rctf *butr= &node->butr;
-	NodeTwoFloats *ntf= node->storage;
+{	
+	uiLayout *col;
 	
+	col =uiLayoutColumn(layout, 1);
 	/* alpha type */
-	uiDefButS(block, TOG, B_NODE_EXEC, "ConvertPremul",
-			  butr->xmin, butr->ymin+19, butr->xmax-butr->xmin, 19, 
-			  &node->custom1, 0, 0, 0, 0, "");
+	uiItemR(col, NULL, 0, ptr, "convert_premul", 0);
 	/* mix factor */
-	uiDefButF(block, NUM, B_NODE_EXEC, "Premul: ",
-			  butr->xmin, butr->ymin, butr->xmax-butr->xmin, 19, 
-			  &ntf->x, 0.0f, 1.0f, 100, 0, "");
+	uiItemR(col, NULL, 0, ptr, "premul", 0);
 }
 
 static void node_composit_buts_hue_sat(uiLayout *layout, PointerRNA *ptr)
 {
-	uiBlock *block= uiLayoutFreeBlock(layout);
-	bNode *node= ptr->data;
-	rctf *butr= &node->butr;
-	NodeHueSat *nhs= node->storage;
+	uiLayout *col;
 	
-	uiBlockBeginAlign(block);
-	uiDefButF(block, NUMSLI, B_NODE_EXEC, "Hue: ",
-			  butr->xmin, butr->ymin+40.0f, butr->xmax-butr->xmin, 20, 
-			  &nhs->hue, 0.0f, 1.0f, 100, 0, "");
-	uiDefButF(block, NUMSLI, B_NODE_EXEC, "Sat: ",
-			  butr->xmin, butr->ymin+20.0f, butr->xmax-butr->xmin, 20, 
-			  &nhs->sat, 0.0f, 2.0f, 100, 0, "");
-	uiDefButF(block, NUMSLI, B_NODE_EXEC, "Val: ",
-			  butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, 
-			  &nhs->val, 0.0f, 2.0f, 100, 0, "");
+	col =uiLayoutColumn(layout, 1);
+	uiItemR(col, NULL, 0, ptr, "hue", UI_ITEM_R_SLIDER);
+	uiItemR(col, NULL, 0, ptr, "sat", UI_ITEM_R_SLIDER);
+	uiItemR(col, NULL, 0, ptr, "val", UI_ITEM_R_SLIDER);
 }
 
 static void node_composit_buts_dilateerode(uiLayout *layout, PointerRNA *ptr)
 {
-	uiBlock *block= uiLayoutFreeBlock(layout);
-	bNode *node= ptr->data;
-	rctf *butr= &node->butr;
-
-	uiDefButS(block, NUM, B_NODE_EXEC, "Distance:",
-			  butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, 
-			  &node->custom2, -100, 100, 0, 0, "Distance to grow/shrink (number of iterations)");
+	uiItemR(layout, NULL, 0, ptr, "distance", 0);
 }
 
 static void node_composit_buts_diff_matte(uiLayout *layout, PointerRNA *ptr)

Modified: trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2009-09-19 19:40:38 UTC (rev 23353)
+++ trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2009-09-19 19:57:30 UTC (rev 23354)
@@ -473,10 +473,11 @@
 static void def_cmp_alpha_over(StructRNA *srna)
 {
 	PropertyRNA *prop;
-
+	
+	// XXX: Tooltip
 	prop = RNA_def_property(srna, "convert_premul", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
-	RNA_def_property_ui_text(prop, "convert_premul", "TODO: don't know what this is");
+	RNA_def_property_ui_text(prop, "Convert Premul", "");
 	RNA_def_property_update(prop, 0, "rna_Node_update");
 	
 	RNA_def_struct_sdna_from(srna, "NodeTwoFloats", "storage");
@@ -488,6 +489,31 @@
 	RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
+static void def_cmp_hue_saturation(StructRNA *srna)
+{
+	PropertyRNA *prop;
+
+	RNA_def_struct_sdna_from(srna, "NodeHueSat", "storage");
+	
+	prop = RNA_def_property(srna, "hue", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "hue");
+	RNA_def_property_range(prop, 0.0f, 1.0f);
+	RNA_def_property_ui_text(prop, "Hue", "");
+	RNA_def_property_update(prop, 0, "rna_Node_update");
+	
+	prop = RNA_def_property(srna, "sat", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "sat");
+	RNA_def_property_range(prop, 0.0f, 2.0f);
+	RNA_def_property_ui_text(prop, "Saturation", "");
+	RNA_def_property_update(prop, 0, "rna_Node_update");
+	
+	prop = RNA_def_property(srna, "val", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "val");
+	RNA_def_property_range(prop, 0.0f, 2.0f);
+	RNA_def_property_ui_text(prop, "Value", "");
+	RNA_def_property_update(prop, 0, "rna_Node_update");
+}
+
 static void def_cmp_blur(StructRNA *srna)
 {
 	PropertyRNA *prop;
@@ -605,12 +631,14 @@
 	
 	prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "loc");
+	RNA_def_property_array(prop, 1);
 	RNA_def_property_range(prop, -1000.0f, 1000.0f);
 	RNA_def_property_ui_text(prop, "Offset", "");
 	RNA_def_property_update(prop, 0, "rna_Node_update");
 	
 	prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "size");
+	RNA_def_property_array(prop, 1);
 	RNA_def_property_range(prop, -1000.0f, 1000.0f);
 	RNA_def_property_ui_text(prop, "Size", "");
 	RNA_def_property_update(prop, 0, "rna_Node_update");
@@ -627,12 +655,14 @@
 	
 	prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "min");
+	RNA_def_property_array(prop, 1);
 	RNA_def_property_range(prop, -1000.0f, 1000.0f);
 	RNA_def_property_ui_text(prop, "Minimum", "");
 	RNA_def_property_update(prop, 0, "rna_Node_update");
 	
 	prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "max");
+	RNA_def_property_array(prop, 1);
 	RNA_def_property_range(prop, -1000.0f, 1000.0f);
 	RNA_def_property_ui_text(prop, "Maximum", "");
 	RNA_def_property_update(prop, 0, "rna_Node_update");
@@ -837,6 +867,7 @@
 	
 	prop = RNA_def_property(srna, "distance", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "custom2");
+	RNA_def_property_range(prop, -100, 100);
 	RNA_def_property_ui_text(prop, "Distance", "Distance to grow/shrink (number of iterations)");
 	RNA_def_property_update(prop, 0, "rna_Node_update");
 }

Modified: trunk/blender/source/blender/makesrna/intern/rna_nodetree_types.h
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_nodetree_types.h	2009-09-19 19:40:38 UTC (rev 23353)
+++ trunk/blender/source/blender/makesrna/intern/rna_nodetree_types.h	2009-09-19 19:57:30 UTC (rev 23354)
@@ -64,7 +64,7 @@
 DefNode( CompositorNode, CMP_NODE_SEPRGBA,        0,                      "SEPRGBA",        SepRGBA,          "Separate RGBA",     ""              )
 DefNode( CompositorNode, CMP_NODE_SEPHSVA,        0,                      "SEPHSVA",        SepHSVA,          "Separate HSVA",     ""              )
 DefNode( CompositorNode, CMP_NODE_SETALPHA,       0,                      "SETALPHA",       SetAlpha,         "Set Alpha",         ""              )
-DefNode( CompositorNode, CMP_NODE_HUE_SAT,        0,                      "HUE_SAT",        HueSat,           "Hue/Saturation",    ""              )
+DefNode( CompositorNode, CMP_NODE_HUE_SAT,        def_cmp_hue_saturation,                      "HUE_SAT",        HueSat,           "Hue/Saturation",    ""              )
 DefNode( CompositorNode, CMP_NODE_IMAGE,          def_cmp_image,          "IMAGE",          Image,            "Image",             ""              )
 DefNode( CompositorNode, CMP_NODE_R_LAYERS,       def_cmp_render_layers,  "R_LAYERS",       RLayers,          "Render Layers",     ""              )
 DefNode( CompositorNode, CMP_NODE_COMPOSITE,      0,                      "COMPOSITE",      Composite,        "Composite",         ""              )





More information about the Bf-blender-cvs mailing list