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.
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user