diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-14 14:11:17 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-14 14:17:55 +0300 |
commit | 2120c5af032831348412a2a8e6c61f82ba1b921c (patch) | |
tree | affb3acf7fd4c467aab6e7eac873dcf18d2d631a /source/blender/makesrna | |
parent | 90e760270aac6a1e995d8bfd629f9da1851a65c9 (diff) |
Gizmo: individual toggles for 3D view gizmos
The popover for displaying gizmos now has options for
empty, light & camera gizmos.
Transform toggles are now checkboxes, which has the advantage that it's
more obvious they can be mixed however changing from one to another now
uses 3x clicks instead of a single click-drag action.
We might need a faster way to switch between transform types.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 73 |
1 files changed, 52 insertions, 21 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index aab07061997..fda1d71d9db 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -513,14 +513,6 @@ static void rna_GPencil_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UN WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); } -static void rna_SpaceView3D_gizmo_flag_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) -{ - View3D *v3d = ptr->data; - if ((v3d->gizmo_type_mask & (V3D_GIZMO_TYPE_MASK_TRANSLATE | V3D_GIZMO_TYPE_MASK_ROTATE | V3D_GIZMO_TYPE_MASK_SCALE)) == 0) { - v3d->gizmo_type_mask |= V3D_GIZMO_TYPE_MASK_TRANSLATE; - } -} - /* Space 3D View */ static void rna_SpaceView3D_camera_update(Main *bmain, Scene *scene, PointerRNA *ptr) { @@ -3101,13 +3093,6 @@ static void rna_def_space_view3d(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}, }; - static const EnumPropertyItem rna_enum_gizmo_items[] = { - {V3D_GIZMO_TYPE_MASK_TRANSLATE, "TRANSLATE", 0, "Move", ""}, - {V3D_GIZMO_TYPE_MASK_ROTATE, "ROTATE", 0, "Rotate", ""}, - {V3D_GIZMO_TYPE_MASK_SCALE, "SCALE", 0, "Scale", ""}, - {0, NULL, 0, NULL, NULL}, - }; - srna = RNA_def_struct(brna, "SpaceView3D", "Space"); RNA_def_struct_sdna(srna, "View3D"); RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data"); @@ -3217,12 +3202,58 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Tool Gizmo", "Active tool gizmo"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); - prop = RNA_def_property(srna, "show_gizmo_transform", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "gizmo_type_mask"); - RNA_def_property_enum_items(prop, rna_enum_gizmo_items); - RNA_def_property_flag(prop, PROP_ENUM_FLAG); - RNA_def_property_ui_text(prop, "Gizmo Mode", ""); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_gizmo_flag_update"); + /* Per object type gizmo display flags. */ + + prop = RNA_def_property(srna, "show_gizmo_object_translate", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_object", V3D_GIZMO_SHOW_OBJECT_TRANSLATE); + RNA_def_property_ui_text(prop, "Show Object Location", "Gizmo to adjust location"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "show_gizmo_object_rotate", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_object", V3D_GIZMO_SHOW_OBJECT_ROTATE); + RNA_def_property_ui_text(prop, "Show Object Rotation", "Gizmo to adjust rotation"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "show_gizmo_object_scale", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_object", V3D_GIZMO_SHOW_OBJECT_SCALE); + RNA_def_property_ui_text(prop, "Show Object Scale", "Gizmo to adjust scale"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + /* Empty Object Data. */ + prop = RNA_def_property(srna, "show_gizmo_empty_image", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_empty", V3D_GIZMO_SHOW_EMPTY_IMAGE); + RNA_def_property_ui_text(prop, "Show Empty Image", "Gizmo to adjust image size and position"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "show_gizmo_empty_force_field", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_empty", V3D_GIZMO_SHOW_EMPTY_FORCE_FIELD); + RNA_def_property_ui_text(prop, "Show Empty Force Field", "Gizmo to adjust the force field"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + /* Light Object Data. */ + prop = RNA_def_property(srna, "show_gizmo_light_size", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_light", V3D_GIZMO_SHOW_LIGHT_SIZE); + RNA_def_property_ui_text(prop, "Show Light Size", "Gizmo to adjust spot and area size"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "show_gizmo_light_look_at", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_light", V3D_GIZMO_SHOW_LIGHT_LOOK_AT); + RNA_def_property_ui_text(prop, "Show Light Look-At", "Gizmo to adjust spot and area size"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + /* Camera Object Data. */ + prop = RNA_def_property(srna, "show_gizmo_camera_lens", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_camera", V3D_GIZMO_SHOW_CAMERA_LENS); + RNA_def_property_ui_text(prop, "Show Camera Lens", "Gizmo to adjust camera lens & ortho size"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "show_gizmo_camera_dof_distance", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_camera", V3D_GIZMO_SHOW_CAMERA_DOF_DIST); + RNA_def_property_ui_text( + prop, "Show Camera Focus Distance", "Gizmo to adjust camera focus distance " + "(depends on limits display)"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + prop = RNA_def_property(srna, "use_local_camera", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "scenelock", 1); |