Skip to content

Drag Snap

Modal point-to-point snap for the active object in Object Mode. Pick a source vertex under the cursor, then pick a target vertex on any mesh under the cursor; the active object (and the rest of the selection) is translated globally by the resulting delta. With Ctrl on the second click the distance is copied to the clipboard instead of moving anything.

bl_idname: iops.object_drag_snap Mode: Object Context: VIEW_3D Modal: yes HUD: yes

Overview

The operator raycasts under the mouse, then within the hit mesh finds the nearest vertex in screen space (within SNAP_THRESHOLD_PX). The first LMB click stores that vertex as the source, the second click stores the target and runs bpy.ops.transform.translate with the target - source delta in GLOBAL orientation. If source and target end up equal, the 3D cursor is moved to that point instead.

Use it for fast align-by-vertex operations between objects where Blender's built-in snap-during-transform is more clicks than necessary. It does not enter Edit Mode and does not modify mesh data.

Usage

  • Requires VIEW_3D, Object Mode, at least one selected object.
  • Default keymap: Ctrl+Alt+Shift+S.
  • Move the cursor over a mesh; the candidate vertex is highlighted as a point.
  • LMB to lock the source point.
  • Move to the target vertex on any mesh, then LMB to translate the active selection, or Ctrl+LMB to copy the source-to-target distance into the system clipboard.
  • RMB or Esc cancels.
Key Action
MouseMove Update nearest-vertex preview; once source is set, also update target preview
LMB (press, no source) Set source vertex
LMB (press, source set) Set target and translate the selection (finish)
Ctrl+LMB (source set) Copy length(target - source) to the clipboard as a string, then finish
LMB (release, no source under cursor) Cancel with "WRONG SOURCE OR TARGET" warning
LMB (release, source set, no target) Re-arm: replace source with the current nearest vertex, prompt for target
MMB / WheelUp / WheelDown Pass through (viewport navigation)
RMB / Esc Cancel
H Toggle help / HUD (handled by the shared HUD overlay)
Drag on HUD / Help panel Reposition the overlay (handled by the shared HUD overlay)

HUD

On-screen overlay shows: - Title Drag Snap. - Help section listing: pick source / snap target (LMB), copy distance (Ctrl+LMB), cancel (Esc / RMB), help toggle (H). - A preview line between source and current candidate target, plus point markers at both. Both use viewport draw roles: Role.PREVIEW_LINE for the line and Role.ACTIVE_POINT for the markers. Colours come from the addon theme.

Notes

  • The translate call is a real transform.translate operator invocation, so undo behaves as a single transform step.
  • When the resolved target equals the source, the operator moves scene.cursor.location instead of running translate.
  • Snapping always picks the closest mesh vertex under the mouse via raycast plus screen-space nearest-vertex search; edges, faces, grid, and non-mesh objects are not snap targets despite legacy doc text.
  • Ctrl+LMB writes str(distance) (a raw Python float) into WindowManager.clipboard.
  • The operator only registers IOPS_OT_DragSnap; no panels or property groups are added by this file.