Consolidate tube and cylinder primitives.
authorMartin Poirier <theeth@yahoo.com>
Mon, 19 Oct 2009 19:16:15 +0000 (19:16 +0000)
committerMartin Poirier <theeth@yahoo.com>
Mon, 19 Oct 2009 19:16:15 +0000 (19:16 +0000)
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.

release/scripts/ui/space_info.py
source/blender/editors/mesh/editmesh_add.c
source/blender/editors/mesh/mesh_intern.h
source/blender/editors/mesh/mesh_ops.c

index 634e9653da9d73a9e6dc1b837ec08bfe71acf3e5..6e5c4b9147dfd0b15b4feae52bb7294fe90cb915 100644 (file)
@@ -133,7 +133,7 @@ class INFO_MT_mesh_add(dynamic_menu.DynMenu):
                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")
index bb340c450d797bc8ee5578c56a3417cf76ce9855..1514f725705a132e514ed9d07c34e0f73a245cbf 100644 (file)
@@ -1411,7 +1411,7 @@ void MESH_OT_primitive_circle_add(wmOperatorType *ot)
        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 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
        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 @@ void MESH_OT_primitive_tube_add(wmOperatorType *ot)
        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)
index 98cfd2c8c924fde787fff429e6dda044f2290858..8615f97f58f00ad716d121008217b0a810d27740 100644 (file)
@@ -69,7 +69,6 @@ void MESH_OT_separate(struct wmOperatorType *ot);
 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);
index da2d45bcd002da8828a4acfd8b05f5245c6d7f45..e49dc0a5869b3acbb87bd2b4445601dc5df5552d 100644 (file)
@@ -88,7 +88,6 @@ void ED_operatortypes_mesh(void)
        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);