[Bf-blender-cvs] [721335553cc] master: Add Object Tool: use the drag-start location for initial placement

Campbell Barton noreply at git.blender.org
Wed Mar 2 12:29:54 CET 2022


Commit: 721335553ccb5ce4f7a374b958b7d65befa319df
Author: Campbell Barton
Date:   Wed Mar 2 21:59:14 2022 +1100
Branches: master
https://developer.blender.org/rB721335553ccb5ce4f7a374b958b7d65befa319df

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

===================================================================

M	source/blender/editors/space_view3d/view3d_placement.c

===================================================================

diff --git a/source/blender/editors/space_view3d/view3d_placement.c b/source/blender/editors/space_view3d/view3d_placement.c
index 06b848571d8..98fb914cda9 100644
--- a/source/blender/editors/space_view3d/view3d_placement.c
+++ b/source/blender/editors/space_view3d/view3d_placement.c
@@ -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;



More information about the Bf-blender-cvs mailing list