Transform: Improve 'absolute grid snap' support detection

The solution supposedly listed all cases that `absolute grid snapping`
was supported. But it ignored some occasions like: Editing Surface
objects, Texture Space.

List now only the cases where this feature should not be supported.
This commit is contained in:
Germano Cavalcante 2022-03-28 13:40:28 -03:00
parent 4c66021ccc
commit 39df927b4a
2 changed files with 13 additions and 15 deletions

View File

@ -63,7 +63,6 @@ void createTransTexspace(TransInfo *t)
}
td->flag = TD_SELECTED;
copy_v3_v3(td->center, ob->obmat[3]);
td->ob = ob;
copy_m3_m4(td->mtx, ob->obmat);
@ -77,6 +76,7 @@ void createTransTexspace(TransInfo *t)
}
copy_v3_v3(td->iloc, td->loc);
copy_v3_v3(td->center, td->loc);
copy_v3_v3(td->ext->isize, td->ext->size);
}

View File

@ -598,21 +598,19 @@ static short snap_mode_from_spacetype(TransInfo *t)
return SEQ_tool_settings_snap_mode_get(t->scene);
}
if ((t->spacetype == SPACE_VIEW3D) && !(t->options & CTX_CAMERA)) {
/* All obedit types will match. */
const int obedit_type = t->obedit_type;
if ((t->options & (CTX_GPENCIL_STROKES | CTX_CURSOR | CTX_OBMODE_XFORM_OBDATA)) ||
ELEM(obedit_type, OB_MESH, OB_ARMATURE, OB_CURVES_LEGACY, OB_LATTICE, OB_MBALL, -1)) {
short snap_mode = ts->snap_mode;
if ((snap_mode & SCE_SNAP_MODE_INCREMENT) && (ts->snap_flag & SCE_SNAP_ABS_GRID) &&
(t->mode == TFM_TRANSLATION)) {
/* Special case in which snap to increments is transformed to snap to grid. */
snap_mode &= ~SCE_SNAP_MODE_INCREMENT;
snap_mode |= SCE_SNAP_MODE_GRID;
}
return snap_mode;
if (t->spacetype == SPACE_VIEW3D) {
if (t->options & (CTX_CAMERA | CTX_EDGE_DATA | CTX_PAINT_CURVE)) {
return SCE_SNAP_MODE_INCREMENT;
}
return SCE_SNAP_MODE_INCREMENT;
short snap_mode = ts->snap_mode;
if ((snap_mode & SCE_SNAP_MODE_INCREMENT) && (ts->snap_flag & SCE_SNAP_ABS_GRID) &&
(t->mode == TFM_TRANSLATION)) {
/* Special case in which snap to increments is transformed to snap to grid. */
snap_mode &= ~SCE_SNAP_MODE_INCREMENT;
snap_mode |= SCE_SNAP_MODE_GRID;
}
return snap_mode;
}
if (ELEM(t->spacetype, SPACE_ACTION, SPACE_NLA)) {