Skip to content

Commit 2f4b110

Browse files
committed
Add _snap_transform gizmo hook to enable jerk-free live snapping during drag
1 parent 8fce6ae commit 2f4b110

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎editor/scene/3d/node_3d_editor_plugin.cpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6657,6 +6657,13 @@ void Node3DEditorViewport::apply_transform(Vector3 p_motion, double p_snap) {
66576657
}
66586658
} else {
66596659
Transform3D new_xform = _compute_transform(_edit.mode, se->original, se->original_local, p_motion, p_snap, local_coords, sp->get_rotation_edit_mode() != Node3D::ROTATION_EDIT_MODE_BASIS && _edit.plane != TRANSFORM_VIEW, is_global_view_plane);
6660+
if (sp->has_meta("_snap_transform")) {
6661+
Callable snap_fn = sp->get_meta("_snap_transform");
6662+
Variant result = snap_fn.call(new_xform);
6663+
if (result.get_type() == Variant::TRANSFORM3D) {
6664+
new_xform = result;
6665+
}
6666+
}
66606667
_transform_gizmo_apply(se->sp, new_xform, local_coords);
66616668
}
66626669
}

0 commit comments

Comments
 (0)