diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-11-15 09:44:50 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-11-15 09:44:50 +0300 |
commit | 49cd13768f4435ca4d109768e5a6a96db21404ee (patch) | |
tree | ab71d3734c20988219c8c1512304cc9a0fa6d4f1 /source/blender | |
parent | 7c0336586102f5ba860c632e762b9317a1bfec20 (diff) |
UI: 'Add Object' rename dimensions
D3943 by @Zachman w/ edits
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/curve/editcurve_add.c | 22 | ||||
-rw-r--r-- | source/blender/editors/include/ED_object.h | 3 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_add.c | 28 | ||||
-rw-r--r-- | source/blender/editors/object/object_add.c | 26 |
4 files changed, 43 insertions, 36 deletions
diff --git a/source/blender/editors/curve/editcurve_add.c b/source/blender/editors/curve/editcurve_add.c index 2dd3b21b875..7eabd9c96e8 100644 --- a/source/blender/editors/curve/editcurve_add.c +++ b/source/blender/editors/curve/editcurve_add.c @@ -564,7 +564,7 @@ void CURVE_OT_primitive_bezier_curve_add(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); ED_object_add_generic_props(ot, true); } @@ -587,7 +587,7 @@ void CURVE_OT_primitive_bezier_circle_add(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); ED_object_add_generic_props(ot, true); } @@ -610,7 +610,7 @@ void CURVE_OT_primitive_nurbs_curve_add(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); ED_object_add_generic_props(ot, true); } @@ -633,7 +633,7 @@ void CURVE_OT_primitive_nurbs_circle_add(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); ED_object_add_generic_props(ot, true); } @@ -656,7 +656,7 @@ void CURVE_OT_primitive_nurbs_path_add(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); ED_object_add_generic_props(ot, true); } @@ -680,7 +680,7 @@ void SURFACE_OT_primitive_nurbs_surface_curve_add(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); ED_object_add_generic_props(ot, true); } @@ -703,7 +703,7 @@ void SURFACE_OT_primitive_nurbs_surface_circle_add(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); ED_object_add_generic_props(ot, true); } @@ -726,7 +726,7 @@ void SURFACE_OT_primitive_nurbs_surface_surface_add(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); ED_object_add_generic_props(ot, true); } @@ -749,7 +749,7 @@ void SURFACE_OT_primitive_nurbs_surface_cylinder_add(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); ED_object_add_generic_props(ot, true); } @@ -772,7 +772,7 @@ void SURFACE_OT_primitive_nurbs_surface_sphere_add(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); ED_object_add_generic_props(ot, true); } @@ -795,6 +795,6 @@ void SURFACE_OT_primitive_nurbs_surface_torus_add(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); ED_object_add_generic_props(ot, true); } diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index afe037c92d1..4547aaae5d4 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -171,7 +171,8 @@ float ED_object_new_primitive_matrix( /* Avoid allowing too much insane values even by typing (typos can hang/crash Blender otherwise). */ #define OBJECT_ADD_SIZE_MAXF 1.0e12f -void ED_object_add_unit_props(struct wmOperatorType *ot); +void ED_object_add_unit_props_size(struct wmOperatorType *ot); +void ED_object_add_unit_props_radius(struct wmOperatorType *ot); void ED_object_add_generic_props(struct wmOperatorType *ot, bool do_editmode); void ED_object_add_mesh_props(struct wmOperatorType *ot); bool ED_object_add_generic_get_opts(struct bContext *C, struct wmOperator *op, const char view_align_axis, diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index ae9b8898eb2..dd16cb9e4ec 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -125,7 +125,7 @@ static int add_primitive_plane_exec(bContext *C, wmOperator *op) if (!EDBM_op_call_and_selectf( em, op, "verts.out", false, "create_grid x_segments=%i y_segments=%i size=%f matrix=%m4 calc_uvs=%b", - 1, 1, RNA_float_get(op->ptr, "radius"), creation_data.mat, calc_uvs)) + 1, 1, RNA_float_get(op->ptr, "size") / 2.0f, creation_data.mat, calc_uvs)) { return OPERATOR_CANCELLED; } @@ -149,7 +149,7 @@ void MESH_OT_primitive_plane_add(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - ED_object_add_unit_props(ot); + ED_object_add_unit_props_size(ot); ED_object_add_mesh_props(ot); ED_object_add_generic_props(ot, true); } @@ -175,7 +175,7 @@ static int add_primitive_cube_exec(bContext *C, wmOperator *op) if (!EDBM_op_call_and_selectf( em, op, "verts.out", false, "create_cube matrix=%m4 size=%f calc_uvs=%b", - creation_data.mat, RNA_float_get(op->ptr, "radius") * 2.0f, calc_uvs)) + creation_data.mat, RNA_float_get(op->ptr, "size"), calc_uvs)) { return OPERATOR_CANCELLED; } @@ -200,7 +200,7 @@ void MESH_OT_primitive_cube_add(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - ED_object_add_unit_props(ot); + ED_object_add_unit_props_size(ot); ED_object_add_mesh_props(ot); ED_object_add_generic_props(ot, true); } @@ -263,7 +263,7 @@ void MESH_OT_primitive_circle_add(wmOperatorType *ot) /* props */ RNA_def_int(ot->srna, "vertices", 32, 3, MESH_ADD_VERTS_MAXI, "Vertices", "", 3, 500); - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); RNA_def_enum(ot->srna, "fill_type", fill_type_items, 0, "Fill Type", ""); ED_object_add_mesh_props(ot); @@ -324,7 +324,7 @@ void MESH_OT_primitive_cylinder_add(wmOperatorType *ot) /* props */ RNA_def_int(ot->srna, "vertices", 32, 3, MESH_ADD_VERTS_MAXI, "Vertices", "", 3, 500); - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); RNA_def_float_distance(ot->srna, "depth", 2.0f, 0.0, OBJECT_ADD_SIZE_MAXF, "Depth", "", 0.001, 100.00); RNA_def_enum(ot->srna, "end_fill_type", fill_type_items, 1, "Cap Fill Type", ""); @@ -416,7 +416,7 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op) "create_grid x_segments=%i y_segments=%i size=%f matrix=%m4 calc_uvs=%b", RNA_int_get(op->ptr, "x_subdivisions"), RNA_int_get(op->ptr, "y_subdivisions"), - RNA_float_get(op->ptr, "radius"), creation_data.mat, calc_uvs)) + RNA_float_get(op->ptr, "size") / 2.0f, creation_data.mat, calc_uvs)) { return OPERATOR_CANCELLED; } @@ -445,8 +445,8 @@ void MESH_OT_primitive_grid_add(wmOperatorType *ot) * impossible values (10^12 vertices or so...). */ RNA_def_int(ot->srna, "x_subdivisions", 10, 2, MESH_ADD_VERTS_MAXI, "X Subdivisions", "", 2, 1000); RNA_def_int(ot->srna, "y_subdivisions", 10, 2, MESH_ADD_VERTS_MAXI, "Y Subdivisions", "", 2, 1000); - ED_object_add_unit_props(ot); + ED_object_add_unit_props_size(ot); ED_object_add_mesh_props(ot); ED_object_add_generic_props(ot, true); } @@ -465,7 +465,7 @@ static int add_primitive_monkey_exec(bContext *C, wmOperator *op) ED_object_add_generic_get_opts(C, op, 'Y', loc, rot, &enter_editmode, NULL); obedit = make_prim_init(C, CTX_DATA_(BLT_I18NCONTEXT_ID_MESH, "Suzanne"), loc, rot, &creation_data); - dia = RNA_float_get(op->ptr, "radius"); + dia = RNA_float_get(op->ptr, "size") / 2.0f; mul_mat3_m4_fl(creation_data.mat, dia); em = BKE_editmesh_from_object(obedit); @@ -498,10 +498,10 @@ void MESH_OT_primitive_monkey_add(wmOperatorType *ot) ot->poll = ED_operator_scene_editable; /* flags */ - ED_object_add_unit_props(ot); ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* props */ + ED_object_add_unit_props_size(ot); ED_object_add_mesh_props(ot); ED_object_add_generic_props(ot, true); } @@ -528,7 +528,7 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op) em, op, "verts.out", false, "create_uvsphere u_segments=%i v_segments=%i diameter=%f matrix=%m4 calc_uvs=%b", RNA_int_get(op->ptr, "segments"), RNA_int_get(op->ptr, "ring_count"), - RNA_float_get(op->ptr, "size"), creation_data.mat, calc_uvs)) + RNA_float_get(op->ptr, "radius"), creation_data.mat, calc_uvs)) { return OPERATOR_CANCELLED; } @@ -555,8 +555,8 @@ void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot) /* props */ RNA_def_int(ot->srna, "segments", 32, 3, MESH_ADD_VERTS_MAXI / 100, "Segments", "", 3, 500); RNA_def_int(ot->srna, "ring_count", 16, 3, MESH_ADD_VERTS_MAXI / 100, "Rings", "", 3, 500); - RNA_def_float_distance(ot->srna, "size", 1.0f, 0.0, OBJECT_ADD_SIZE_MAXF, "Size", "", 0.001, 100.00); + ED_object_add_unit_props_radius(ot); ED_object_add_mesh_props(ot); ED_object_add_generic_props(ot, true); } @@ -583,7 +583,7 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op) em, op, "verts.out", false, "create_icosphere subdivisions=%i diameter=%f matrix=%m4 calc_uvs=%b", RNA_int_get(op->ptr, "subdivisions"), - RNA_float_get(op->ptr, "size"), creation_data.mat, calc_uvs)) + RNA_float_get(op->ptr, "radius"), creation_data.mat, calc_uvs)) { return OPERATOR_CANCELLED; } @@ -609,8 +609,8 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot) /* props */ RNA_def_int(ot->srna, "subdivisions", 2, 1, 10, "Subdivisions", "", 1, 8); - RNA_def_float_distance(ot->srna, "size", 1.0f, 0.0f, OBJECT_ADD_SIZE_MAXF, "Size", "", 0.001f, 100.00); + ED_object_add_unit_props_radius(ot); ED_object_add_mesh_props(ot); ED_object_add_generic_props(ot, true); } diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 772199b8d91..0a16a62d788 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -30,6 +30,7 @@ #include <stdlib.h> #include <string.h> +#include <ctype.h> #include "MEM_guardedalloc.h" @@ -273,7 +274,12 @@ static void view_align_update(struct Main *UNUSED(main), struct Scene *UNUSED(sc RNA_struct_idprops_unset(ptr, "rotation"); } -void ED_object_add_unit_props(wmOperatorType *ot) +void ED_object_add_unit_props_size(wmOperatorType *ot) +{ + RNA_def_float_distance(ot->srna, "size", 2.0f, 0.0, OBJECT_ADD_SIZE_MAXF, "Size", "", 0.001, 100.00); +} + +void ED_object_add_unit_props_radius(wmOperatorType *ot) { RNA_def_float_distance(ot->srna, "radius", 1.0f, 0.0, OBJECT_ADD_SIZE_MAXF, "Radius", "", 0.001, 100.00); } @@ -457,7 +463,7 @@ void OBJECT_OT_add(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); RNA_def_enum(ot->srna, "type", rna_enum_object_type_items, 0, "Type", ""); ED_object_add_generic_props(ot, true); @@ -541,7 +547,7 @@ void OBJECT_OT_lightprobe_add(wmOperatorType *ot) /* properties */ ot->prop = RNA_def_enum(ot->srna, "type", lightprobe_type_items, 0, "Type", ""); - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); ED_object_add_generic_props(ot, true); } @@ -609,7 +615,7 @@ void OBJECT_OT_effector_add(wmOperatorType *ot) /* properties */ ot->prop = RNA_def_enum(ot->srna, "type", field_type_items, 0, "Type", ""); - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); ED_object_add_generic_props(ot, true); } @@ -725,7 +731,7 @@ void OBJECT_OT_metaball_add(wmOperatorType *ot) ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_metaelem_type_items, 0, "Primitive", ""); - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); ED_object_add_generic_props(ot, true); } @@ -767,7 +773,7 @@ void OBJECT_OT_text_add(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); ED_object_add_generic_props(ot, true); } @@ -827,7 +833,7 @@ void OBJECT_OT_armature_add(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); ED_object_add_generic_props(ot, true); } @@ -869,7 +875,7 @@ void OBJECT_OT_empty_add(wmOperatorType *ot) /* properties */ ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_object_empty_drawtype_items, 0, "Type", ""); - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); ED_object_add_generic_props(ot, false); } @@ -1051,7 +1057,7 @@ void OBJECT_OT_gpencil_add(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); ED_object_add_generic_props(ot, false); ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_object_gpencil_type_items, 0, "Type", ""); @@ -1130,7 +1136,7 @@ void OBJECT_OT_light_add(wmOperatorType *ot) ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_light_type_items, 0, "Type", ""); RNA_def_property_translation_context(ot->prop, BLT_I18NCONTEXT_ID_LAMP); - ED_object_add_unit_props(ot); + ED_object_add_unit_props_radius(ot); ED_object_add_generic_props(ot, false); } |