[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40507] trunk/blender/source/blender/ editors/mesh/editmesh_add.c: Fix [#28729] World units not used for new object creation.

Bastien Montagne montagne29 at wanadoo.fr
Fri Sep 23 19:44:57 CEST 2011


Revision: 40507
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40507
Author:   mont29
Date:     2011-09-23 17:44:57 +0000 (Fri, 23 Sep 2011)
Log Message:
-----------
Fix [#28729] World units not used for new object creation.
Setting PROP_DISTANCE subtype for "size" properties of add mesh operators.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/mesh/editmesh_add.c

Modified: trunk/blender/source/blender/editors/mesh/editmesh_add.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_add.c	2011-09-23 17:38:52 UTC (rev 40506)
+++ trunk/blender/source/blender/editors/mesh/editmesh_add.c	2011-09-23 17:44:57 UTC (rev 40507)
@@ -1472,6 +1472,8 @@
 
 void MESH_OT_primitive_circle_add(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
 	ot->name= "Add Circle";
 	ot->description= "Construct a circle mesh";
@@ -1487,7 +1489,8 @@
 	
 	/* props */
 	RNA_def_int(ot->srna, "vertices", 32, 3, INT_MAX, "Vertices", "", 3, 500);
-	RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00);
+	prop = RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00);
+	RNA_def_property_subtype(prop, PROP_DISTANCE);
 	RNA_def_boolean(ot->srna, "fill", 0, "Fill", "");
 
 	ED_object_add_generic_props(ot, TRUE);
@@ -1513,6 +1516,8 @@
 
 void MESH_OT_primitive_cylinder_add(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
 	ot->name= "Add Cylinder";
 	ot->description= "Construct a cylinder mesh";
@@ -1528,8 +1533,10 @@
 	
 	/* props */
 	RNA_def_int(ot->srna, "vertices", 32, 2, INT_MAX, "Vertices", "", 2, 500);
-	RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00);
-	RNA_def_float(ot->srna, "depth", 2.0f, 0.0, FLT_MAX, "Depth", "", 0.001, 100.00);
+	prop = RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00);
+	RNA_def_property_subtype(prop, PROP_DISTANCE);
+	prop = RNA_def_float(ot->srna, "depth", 2.0f, 0.0, FLT_MAX, "Depth", "", 0.001, 100.00);
+	RNA_def_property_subtype(prop, PROP_DISTANCE);
 	RNA_def_boolean(ot->srna, "cap_ends", 1, "Cap Ends", "");
 
 	ED_object_add_generic_props(ot, TRUE);
@@ -1554,6 +1561,8 @@
 
 void MESH_OT_primitive_cone_add(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
 	ot->name= "Add Cone";
 	ot->description= "Construct a conic mesh (ends filled)";
@@ -1569,8 +1578,10 @@
 	
 	/* props */
 	RNA_def_int(ot->srna, "vertices", 32, 2, INT_MAX, "Vertices", "", 2, 500);
-	RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00);
-	RNA_def_float(ot->srna, "depth", 2.0f, 0.0, FLT_MAX, "Depth", "", 0.001, 100.00);
+	prop = RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00);
+	RNA_def_property_subtype(prop, PROP_DISTANCE);
+	prop = RNA_def_float(ot->srna, "depth", 2.0f, 0.0, FLT_MAX, "Depth", "", 0.001, 100.00);
+	RNA_def_property_subtype(prop, PROP_DISTANCE);
 	RNA_def_boolean(ot->srna, "cap_end", 1, "Cap End", "");
 
 	ED_object_add_generic_props(ot, TRUE);
@@ -1595,6 +1606,8 @@
 
 void MESH_OT_primitive_grid_add(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
 	ot->name= "Add Grid";
 	ot->description= "Construct a grid mesh";
@@ -1611,7 +1624,8 @@
 	/* props */
 	RNA_def_int(ot->srna, "x_subdivisions", 10, 3, INT_MAX, "X Subdivisions", "", 3, 1000);
 	RNA_def_int(ot->srna, "y_subdivisions", 10, 3, INT_MAX, "Y Subdivisions", "", 3, 1000);
-	RNA_def_float(ot->srna, "size", 1.0f, 0.0, FLT_MAX, "Size", "", 0.001, FLT_MAX);
+	prop = RNA_def_float(ot->srna, "size", 1.0f, 0.0, FLT_MAX, "Size", "", 0.001, FLT_MAX);
+	RNA_def_property_subtype(prop, PROP_DISTANCE);
 
 	ED_object_add_generic_props(ot, TRUE);
 }
@@ -1668,6 +1682,8 @@
 
 void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
 	ot->name= "Add UV Sphere";
 	ot->description= "Construct a UV sphere mesh";
@@ -1684,7 +1700,8 @@
 	/* props */
 	RNA_def_int(ot->srna, "segments", 32, 3, INT_MAX, "Segments", "", 3, 500);
 	RNA_def_int(ot->srna, "ring_count", 16, 3, INT_MAX, "Rings", "", 3, 500);
-	RNA_def_float(ot->srna, "size", 1.0f, 0.0, FLT_MAX, "Size", "", 0.001, 100.00);
+	prop = RNA_def_float(ot->srna, "size", 1.0f, 0.0, FLT_MAX, "Size", "", 0.001, 100.00);
+	RNA_def_property_subtype(prop, PROP_DISTANCE);
 
 	ED_object_add_generic_props(ot, TRUE);
 }
@@ -1707,6 +1724,8 @@
 
 void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
 	ot->name= "Add Ico Sphere";
 	ot->description= "Construct an Icosphere mesh";
@@ -1722,7 +1741,8 @@
 	
 	/* props */
 	RNA_def_int(ot->srna, "subdivisions", 2, 1, INT_MAX, "Subdivisions", "", 1, 8);
-	RNA_def_float(ot->srna, "size", 1.0f, 0.0f, FLT_MAX, "Size", "", 0.001f, 100.00);
+	prop = RNA_def_float(ot->srna, "size", 1.0f, 0.0f, FLT_MAX, "Size", "", 0.001f, 100.00);
+	RNA_def_property_subtype(prop, PROP_DISTANCE);
 
 	ED_object_add_generic_props(ot, TRUE);
 }




More information about the Bf-blender-cvs mailing list