Add Object Tool: use the drag-start location for initial placement

This commit is contained in:
Campbell Barton 2022-03-02 21:59:14 +11:00
parent c2e8e68b65
commit 721335553c
Notes: blender-bot 2023-08-18 19:45:34 +02:00
Referenced by commit 75aa5ecbda, Fix (unreported): Placement Tool not orienting the Object to normal
Referenced by pull request #111226, Fix #109454: Snapping from Tools doesn't work if Depth option is not 'Surface'
1 changed files with 11 additions and 0 deletions

View File

@ -727,6 +727,17 @@ static void view3d_interactive_add_begin(bContext *C, wmOperator *op, const wmEv
V3DSnapCursorState *snap_state_new = ED_view3d_cursor_snap_active();
if (snap_state_new) {
ipd->snap_state = snap_state = snap_state_new;
/* For drag events, update the location since it will be set from the drag-start.
* This is needed as cursor-drawing doesn't deal with drag events and will use
* the current cursor location instead of the drag-start. */
if (event->val == KM_CLICK_DRAG) {
/* Set this flag so snapping always updated. */
int flag_orig = snap_state_new->flag;
snap_state_new->flag |= V3D_SNAPCURSOR_TOGGLE_ALWAYS_TRUE;
ED_view3d_cursor_snap_data_get(snap_state_new, C, event->mval[0], event->mval[1]);
snap_state_new->flag = flag_orig;
}
}
snap_state->draw_point = true;