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`).
This commit is contained in:
Germano Cavalcante
2024-03-12 14:29:46 -03:00
parent 06bb8bce26
commit a56a975760
3 changed files with 8 additions and 3 deletions
@@ -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(
@@ -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);
@@ -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);
}