diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-01-14 03:40:09 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-01-14 03:50:08 +0300 |
commit | f64746177f43735101eb230c59c78ed2994e5bea (patch) | |
tree | 9cab69c847b55ddb9813aee4d57fee54cfe01646 /source | |
parent | 5804bf25bdfe2a29f8c763ab1015e89752baa195 (diff) |
Fix add-object tool snap placement when activated from tweak event
When activating add-object from from a tweak event (default keymap),
the snap gizmo could snap to a new location while dragging.
Workaround this by re-calculating the snap position where the tweak
event starts.
Reported T57210#1077747
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_placement.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/editors/space_view3d/view3d_placement.c b/source/blender/editors/space_view3d/view3d_placement.c index 810693f4bff..881541aac6e 100644 --- a/source/blender/editors/space_view3d/view3d_placement.c +++ b/source/blender/editors/space_view3d/view3d_placement.c @@ -946,6 +946,24 @@ static void view3d_interactive_add_begin(bContext *C, wmOperator *op, const wmEv } } + /* For tweak events the snap target may have changed since dragging, + * update the snap target at the cursor location where tweak began. + * + * NOTE: we could investigating solving this in a more generic way, + * so each operator doesn't have to account for it. */ + if (ISTWEAK(event->type)) { + if (ipd->snap_gizmo != NULL) { + ED_gizmotypes_snap_3d_update(ipd->snap_gizmo, + CTX_data_ensure_evaluated_depsgraph(C), + ipd->region, + ipd->v3d, + G_MAIN->wm.first, + mval_fl, + NULL, + NULL); + } + } + ipd->launch_event = WM_userdef_event_type_from_keymap_type(event->type); view3d_interactive_add_calc_plane(C, |