diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-01-16 03:39:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-01-16 03:39:34 +0300 |
commit | 7573631d69e46d8fc063c41eec14d8dfa58b04f8 (patch) | |
tree | fbacb368301790d26319db2d39d8bd5db5a63cc4 | |
parent | d4ffccbeae90e9a41e74e4a720e2f623e1fa0c2e (diff) | |
parent | ecffd231a0086310dd4ff268bab4d52110b72d7a (diff) |
Merge branch 'blender-v2.92-release'
-rw-r--r-- | release/scripts/startup/bl_ui/space_toolsystem_toolbar.py | 1 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_placement.c | 21 |
2 files changed, 21 insertions, 1 deletions
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index 2700a29f908..0ee68e911c5 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -473,6 +473,7 @@ class _defs_view3d_add: layout.use_property_split = True layout.row().prop(props, "plane_axis", expand=True) layout.row().prop(props, "plane_origin", expand=True) + layout.row().prop(props, "use_fixed_aspect") @ToolDef.from_fn def cube_add(): diff --git a/source/blender/editors/space_view3d/view3d_placement.c b/source/blender/editors/space_view3d/view3d_placement.c index ab2aebe2657..b3662c66ebc 100644 --- a/source/blender/editors/space_view3d/view3d_placement.c +++ b/source/blender/editors/space_view3d/view3d_placement.c @@ -167,6 +167,9 @@ struct InteractivePlaceData { /** The tool option, if we start centered, invert toggling behavior. */ bool is_centered_init; + /** The tool option, if we start fixed, invert toggling behavior. */ + bool is_fixed_aspect_init; + bool use_snap, is_snap_found, is_snap_invert; float snap_co[3]; @@ -997,6 +1000,7 @@ static void view3d_interactive_add_begin(bContext *C, wmOperator *op, const wmEv const enum ePlace_Depth plane_depth = RNA_enum_get(op->ptr, "plane_depth"); const enum ePlace_Origin plane_origin = RNA_enum_get(op->ptr, "plane_origin"); const enum ePlace_Orient plane_orient = RNA_enum_get(op->ptr, "plane_orientation"); + const bool use_fixed_aspect = RNA_boolean_get(op->ptr, "use_fixed_aspect"); const float mval_fl[2] = {UNPACK2(event->mval)}; @@ -1052,8 +1056,11 @@ static void view3d_interactive_add_begin(bContext *C, wmOperator *op, const wmEv ipd->orient_axis = plane_axis; ipd->is_centered_init = (plane_origin == PLACE_ORIGIN_CENTER); + ipd->is_fixed_aspect_init = use_fixed_aspect; ipd->step[0].is_centered = ipd->is_centered_init; ipd->step[1].is_centered = ipd->is_centered_init; + ipd->step[0].is_fixed_aspect = ipd->is_fixed_aspect_init; + ipd->step[1].is_fixed_aspect = ipd->is_fixed_aspect_init; ipd->step_index = STEP_BASE; ipd->snap_to = snap_to; @@ -1279,7 +1286,7 @@ static int view3d_interactive_add_modal(bContext *C, wmOperator *op, const wmEve ATTR_FALLTHROUGH; } case PLACE_MODAL_FIXED_ASPECT_OFF: { - ipd->step[ipd->step_index].is_fixed_aspect = is_fallthrough; + ipd->step[ipd->step_index].is_fixed_aspect = is_fallthrough ^ ipd->is_fixed_aspect_init; do_redraw = true; break; } @@ -1354,6 +1361,11 @@ static int view3d_interactive_add_modal(bContext *C, wmOperator *op, const wmEve /* Keep these values from the previous step. */ ipd->step[1].is_centered = ipd->step[0].is_centered; ipd->step[1].is_fixed_aspect = ipd->step[0].is_fixed_aspect; + if (ipd->is_fixed_aspect_init) { + /* Keep this false, as it locks to a single size, which feels a bit strange. */ + ipd->step[1].is_fixed_aspect = false; + ipd->is_fixed_aspect_init = false; + } } } } @@ -1640,6 +1652,13 @@ void VIEW3D_OT_interactive_add(struct wmOperatorType *ot) RNA_def_property_enum_items(prop, snap_to_items); RNA_def_property_flag(prop, PROP_SKIP_SAVE); + prop = RNA_def_boolean(ot->srna, + "use_fixed_aspect", + false, + "Fixed Aspect", + "Constraint the initial plane to a fixed aspect"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); + /* When not accessed via a tool. */ prop = RNA_def_boolean(ot->srna, "wait_for_input", true, "Wait for Input", ""); RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); |