[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52938] trunk/blender/source/blender/ makesrna/intern/rna_nodetree.c: RNA properties for width and height of nodes.
Lukas Toenne
lukas.toenne at googlemail.com
Wed Dec 12 18:50:44 CET 2012
Revision: 52938
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52938
Author: lukastoenne
Date: 2012-12-12 17:50:44 +0000 (Wed, 12 Dec 2012)
Log Message:
-----------
RNA properties for width and height of nodes.
Note: For most node types the height is determined automatically.
Note2: There are two independent width values, one for regular nodes and one for the collapsed ("hidden") state.
Modified Paths:
--------------
trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
Modified: trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_nodetree.c 2012-12-12 17:50:35 UTC (rev 52937)
+++ trunk/blender/source/blender/makesrna/intern/rna_nodetree.c 2012-12-12 17:50:44 UTC (rev 52938)
@@ -499,6 +499,20 @@
BKE_all_animdata_fix_paths_rename(NULL, "nodes", oldname, node->name);
}
+static void rna_Node_width_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
+{
+ bNode *node = ptr->data;
+ *min = *softmin = node->typeinfo->minwidth;
+ *max = *softmax = node->typeinfo->maxwidth;
+}
+
+static void rna_Node_height_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
+{
+ bNode *node = ptr->data;
+ *min = *softmin = node->typeinfo->minheight;
+ *max = *softmax = node->typeinfo->maxheight;
+}
+
static void rna_NodeSocket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
bNodeTree *ntree = (bNodeTree *)ptr->id.data;
@@ -4609,6 +4623,24 @@
RNA_def_property_ui_text(prop, "Location", "");
RNA_def_property_update(prop, NC_NODE, "rna_Node_update");
+ prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "width");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_Node_width_range");
+ RNA_def_property_ui_text(prop, "Width", "Width of the node");
+ RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "width_hidden", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "miniwidth");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_Node_width_range");
+ RNA_def_property_ui_text(prop, "Width Hidden", "Width of the node in hidden state");
+ RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "height");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_Node_height_range");
+ RNA_def_property_ui_text(prop, "Height", "Height of the node");
+ RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
+
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(prop, "Name", "Unique node identifier");
RNA_def_struct_name_property(srna, prop);
More information about the Bf-blender-cvs
mailing list