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
This commit is contained in:
Campbell Barton 2021-01-14 11:40:09 +11:00
parent 5804bf25bd
commit f64746177f
Notes: blender-bot 2023-02-14 09:21:21 +01:00
Referenced by issue #57210, Add Object Tools Todo
1 changed files with 18 additions and 0 deletions

View File

@ -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,