[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23981] trunk/blender: Consolidate tube and cylinder primitives.

Martin Poirier theeth at yahoo.com
Mon Oct 19 21:16:19 CEST 2009


Revision: 23981
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23981
Author:   theeth
Date:     2009-10-19 21:16:15 +0200 (Mon, 19 Oct 2009)

Log Message:
-----------
Consolidate tube and cylinder primitives.

Removing old add tube operator and replacing it with add cylinder. The resulting operator is called add tube, since that's the name in the menu. Other people can debate about the name and change it later if they feel like it.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_info.py
    trunk/blender/source/blender/editors/mesh/editmesh_add.c
    trunk/blender/source/blender/editors/mesh/mesh_intern.h
    trunk/blender/source/blender/editors/mesh/mesh_ops.c

Modified: trunk/blender/release/scripts/ui/space_info.py
===================================================================
--- trunk/blender/release/scripts/ui/space_info.py	2009-10-19 18:49:04 UTC (rev 23980)
+++ trunk/blender/release/scripts/ui/space_info.py	2009-10-19 19:16:15 UTC (rev 23981)
@@ -133,7 +133,7 @@
 		layout.itemO("mesh.primitive_circle_add", icon='ICON_MESH_CIRCLE', text="Circle")
 		layout.itemO("mesh.primitive_uv_sphere_add", icon='ICON_MESH_UVSPHERE', text="UV Sphere")
 		layout.itemO("mesh.primitive_ico_sphere_add", icon='ICON_MESH_ICOSPHERE', text="Icosphere")
-		layout.itemO("mesh.primitive_cylinder_add", icon='ICON_MESH_TUBE', text="Tube")
+		layout.itemO("mesh.primitive_tube_add", icon='ICON_MESH_TUBE', text="Tube")
 		layout.itemO("mesh.primitive_cone_add", icon='ICON_MESH_CONE', text="Cone")
 		layout.itemS()
 		layout.itemO("mesh.primitive_grid_add", icon='ICON_MESH_GRID', text="Grid")

Modified: trunk/blender/source/blender/editors/mesh/editmesh_add.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_add.c	2009-10-19 18:49:04 UTC (rev 23980)
+++ trunk/blender/source/blender/editors/mesh/editmesh_add.c	2009-10-19 19:16:15 UTC (rev 23981)
@@ -1411,7 +1411,7 @@
 	RNA_def_boolean(ot->srna, "fill", 0, "Fill", "");
 }
 
-static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
+static int add_primitive_tube_exec(bContext *C, wmOperator *op)
 {
 	make_prim_ext(C, PRIM_CYLINDER, RNA_int_get(op->ptr, "vertices"), 0, 0,
 			RNA_float_get(op->ptr,"radius"),
@@ -1421,41 +1421,11 @@
 	return OPERATOR_FINISHED;
 }
 
-void MESH_OT_primitive_cylinder_add(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Add Cylinder";
-	ot->description= "Construct a cylindrical mesh (ends filled).";
-	ot->idname= "MESH_OT_primitive_cylinder_add";
-	
-	/* api callbacks */
-	ot->exec= add_primitive_cylinder_exec;
-	ot->poll= ED_operator_scene_editable;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-	
-	/* props */
-	RNA_def_int(ot->srna, "vertices", 32, INT_MIN, 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", 1.0f, 0.0, FLT_MAX, "Depth", "", 0.001, 100.00);
-	RNA_def_boolean(ot->srna, "cap_ends", 1, "Cap Ends", "");
-}
-
-static int add_primitive_tube_exec(bContext *C, wmOperator *op)
-{
-	make_prim_ext(C, PRIM_CYLINDER, RNA_int_get(op->ptr, "vertices"), 0, 0,
-			RNA_float_get(op->ptr,"radius"),
-			RNA_float_get(op->ptr, "depth"), 1, 0);
-
-	return OPERATOR_FINISHED;	
-}
-
 void MESH_OT_primitive_tube_add(wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name= "Add Tube";
-	ot->description= "Construct a cylindrical mesh (ends not filled).";
+	ot->description= "Construct a tube mesh.";
 	ot->idname= "MESH_OT_primitive_tube_add";
 	
 	/* api callbacks */
@@ -1469,6 +1439,7 @@
 	RNA_def_int(ot->srna, "vertices", 32, INT_MIN, 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", 1.0f, 0.0, FLT_MAX, "Depth", "", 0.001, 100.00);
+	RNA_def_boolean(ot->srna, "cap_ends", 1, "Cap Ends", "");
 }
 
 static int add_primitive_cone_exec(bContext *C, wmOperator *op)

Modified: trunk/blender/source/blender/editors/mesh/mesh_intern.h
===================================================================
--- trunk/blender/source/blender/editors/mesh/mesh_intern.h	2009-10-19 18:49:04 UTC (rev 23980)
+++ trunk/blender/source/blender/editors/mesh/mesh_intern.h	2009-10-19 19:16:15 UTC (rev 23981)
@@ -69,7 +69,6 @@
 void MESH_OT_primitive_plane_add(struct wmOperatorType *ot);
 void MESH_OT_primitive_cube_add(struct wmOperatorType *ot);
 void MESH_OT_primitive_circle_add(struct wmOperatorType *ot);
-void MESH_OT_primitive_cylinder_add(struct wmOperatorType *ot);
 void MESH_OT_primitive_tube_add(struct wmOperatorType *ot);
 void MESH_OT_primitive_cone_add(struct wmOperatorType *ot);
 void MESH_OT_primitive_grid_add(struct wmOperatorType *ot);

Modified: trunk/blender/source/blender/editors/mesh/mesh_ops.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/mesh_ops.c	2009-10-19 18:49:04 UTC (rev 23980)
+++ trunk/blender/source/blender/editors/mesh/mesh_ops.c	2009-10-19 19:16:15 UTC (rev 23981)
@@ -88,7 +88,6 @@
 	WM_operatortype_append(MESH_OT_primitive_plane_add);
 	WM_operatortype_append(MESH_OT_primitive_cube_add);
 	WM_operatortype_append(MESH_OT_primitive_circle_add);
-	WM_operatortype_append(MESH_OT_primitive_cylinder_add);
 	WM_operatortype_append(MESH_OT_primitive_tube_add);
 	WM_operatortype_append(MESH_OT_primitive_cone_add);
 	WM_operatortype_append(MESH_OT_primitive_grid_add);





More information about the Bf-blender-cvs mailing list