[Bf-blender-cvs] [f64746177f4] blender-v2.92-release: Fix add-object tool snap placement when activated from tweak event

Campbell Barton noreply at git.blender.org
Thu Jan 14 01:50:45 CET 2021


Commit: f64746177f43735101eb230c59c78ed2994e5bea
Author: Campbell Barton
Date:   Thu Jan 14 11:40:09 2021 +1100
Branches: blender-v2.92-release
https://developer.blender.org/rBf64746177f43735101eb230c59c78ed2994e5bea

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

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

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



More information about the Bf-blender-cvs mailing list