diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-05-12 17:16:11 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-05-12 17:16:11 +0400 |
commit | 127c39b8a44df962b1ac20578497b387319efe87 (patch) | |
tree | 7f928e590060350708d4160b1637994ca758c025 /source/blender/makesrna/intern/rna_space.c | |
parent | 5fcf9b1d2fe94798178beeea8e31f54faac31414 (diff) |
Fix for [#35224] Transform Orientation - order inconsistency
Fix turned out to remove as much "manual UI" from 3D view header as possible. Mode selector and all transform manipulators/orientations stuff are now RNA-based UI (leaving basically only edit mesh select modes with custom handlers, as they have some quite specific features).
To achieve this, four main modifications were done:
* enum-operator-generated menus are now MENU (i.e. dropdown lists) in headers too.
* All bit-flag enums expanded in ROW buttons now have a handling consistent with e.g. layers, or what we already have for transform manipulators, i.e. clicking select only one element, shift-click to select multiple ones.
* Consequently, the three RNA booleans manipulators flags are merged into a single bit-flag enum (yes, this is also an API change, though I doubt many scripts use it).
* Now the width of enum-based dropdown lists is computed from longest item name in enum, no more from a dummy place holder string (when no label/name is given).
All this allows to remove some code from 3DView/transform areas, that was actually mostly duplicating RNA/operator one.
Also done a few optimizations here and there (among others, do not pass &numitems to RNA_property_enum_items() when you do not need it, saves at least an iteration over enum items to count them).
Many thanks to Brecht for the reviews!
Diffstat (limited to 'source/blender/makesrna/intern/rna_space.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 44942db95b9..17543fa2ed1 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1581,7 +1581,7 @@ static void rna_def_space_view3d(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; const int matrix_dimsize[] = {4, 4}; - + static EnumPropertyItem pivot_items[] = { {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", "Pivot around bounding box center of selected object(s)"}, @@ -1594,6 +1594,16 @@ static void rna_def_space_view3d(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static EnumPropertyItem manipulators_items[] = { + {V3D_MANIP_TRANSLATE, "TRANSLATE", ICON_MAN_TRANS, "Manipulator Translate", + "Use the manipulator for movement transformations"}, + {V3D_MANIP_ROTATE, "ROTATE", ICON_MAN_ROT, "Manipulator Rotate", + "Use the manipulator for rotation transformations"}, + {V3D_MANIP_SCALE, "SCALE", ICON_MAN_SCALE, "Manipulator Scale", + "Use the manipulator for scale transformations"}, + {0, NULL, 0, NULL, NULL} + }; + static EnumPropertyItem rv3d_persp_items[] = { {RV3D_PERSP, "PERSP", 0, "Perspective", ""}, {RV3D_ORTHO, "ORTHO", 0, "Orthographic", ""}, @@ -1866,23 +1876,12 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Manipulator", "Use a 3D manipulator widget for controlling transforms"); RNA_def_property_ui_icon(prop, ICON_MANIPUL, 0); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); - - prop = RNA_def_property(srna, "use_manipulator_translate", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "twtype", V3D_MANIP_TRANSLATE); - RNA_def_property_ui_text(prop, "Manipulator Translate", "Use the manipulator for movement transformations"); - RNA_def_property_ui_icon(prop, ICON_MAN_TRANS, 0); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); - - prop = RNA_def_property(srna, "use_manipulator_rotate", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "twtype", V3D_MANIP_ROTATE); - RNA_def_property_ui_text(prop, "Manipulator Rotate", "Use the manipulator for rotation transformations"); - RNA_def_property_ui_icon(prop, ICON_MAN_ROT, 0); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); - - prop = RNA_def_property(srna, "use_manipulator_scale", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "twtype", V3D_MANIP_SCALE); - RNA_def_property_ui_text(prop, "Manipulator Scale", "Use the manipulator for scale transformations"); - RNA_def_property_ui_icon(prop, ICON_MAN_SCALE, 0); + + prop = RNA_def_property(srna, "transform_manipulators", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "twtype"); + RNA_def_property_enum_items(prop, manipulators_items); + RNA_def_property_flag(prop, PROP_ENUM_FLAG); + RNA_def_property_ui_text(prop, "Transform Manipulators", "Transformation manipulators"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "transform_orientation", PROP_ENUM, PROP_NONE); |