From a56a97576020766a178abc2708e51f1d93324bb2 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Tue, 12 Mar 2024 14:29:46 -0300 Subject: [PATCH] UV: Enable 'Set Snap Base' feature Just like for objects in 3D View, UVs can also benefit from the `Set Snap Base` feature (key `B`). --- source/blender/editors/transform/transform.cc | 2 +- .../blender/editors/transform/transform_mode_snapsource.cc | 5 ++++- source/blender/editors/transform/transform_snap.cc | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/transform/transform.cc b/source/blender/editors/transform/transform.cc index 81ac200ac84..680820d6eca 100644 --- a/source/blender/editors/transform/transform.cc +++ b/source/blender/editors/transform/transform.cc @@ -710,7 +710,7 @@ static bool transform_modal_item_poll(const wmOperator *op, int value) case TFM_MODAL_EDIT_SNAP_SOURCE_OFF: return false; case TFM_MODAL_EDIT_SNAP_SOURCE_ON: { - if (t->spacetype != SPACE_VIEW3D) { + if (!ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE)) { return false; } if (!ELEM( diff --git a/source/blender/editors/transform/transform_mode_snapsource.cc b/source/blender/editors/transform/transform_mode_snapsource.cc index 51b2fd002e0..c7cfeaa3505 100644 --- a/source/blender/editors/transform/transform_mode_snapsource.cc +++ b/source/blender/editors/transform/transform_mode_snapsource.cc @@ -194,10 +194,13 @@ void transform_mode_snap_source_init(TransInfo *t, wmOperator * /*op*/) } t->mode_info = &TransMode_snapsource; - t->flag |= T_DRAW_SNAP_SOURCE; t->tsnap.target_operation = SCE_SNAP_TARGET_ALL; t->tsnap.status &= ~SNAP_SOURCE_FOUND; + if (t->spacetype == SPACE_VIEW3D) { + t->flag |= T_DRAW_SNAP_SOURCE; + } + customdata->snap_mode_confirm = t->tsnap.mode; t->tsnap.mode &= ~(SCE_SNAP_TO_EDGE_PERPENDICULAR | SCE_SNAP_INDIVIDUAL_PROJECT | SCE_SNAP_INDIVIDUAL_NEAREST); diff --git a/source/blender/editors/transform/transform_snap.cc b/source/blender/editors/transform/transform_snap.cc index 404b116fdc8..5e9693d3c93 100644 --- a/source/blender/editors/transform/transform_snap.cc +++ b/source/blender/editors/transform/transform_snap.cc @@ -1788,7 +1788,9 @@ float transform_snap_increment_get(const TransInfo *t) void tranform_snap_source_restore_context(TransInfo *t) { - snap_object_context_init(t); + if (t->spacetype == SPACE_VIEW3D) { + snap_object_context_init(t); + } snap_multipoints_free(t); }