Fix #147246: Translate with absolute increment snap fails

Snap translation to the world grid when absolute grid increments is
enabled. Previously, absolute increment snap shifted in perspective
view, causing objects to misaligned with the world grid.

Resolves regression introduced since 3.6.

Ref !147246
This commit is contained in:
tariqsulley
2025-10-12 10:34:11 +00:00
committed by Campbell Barton
parent f8a592a7f0
commit 2db54c43d8

View File

@@ -729,8 +729,15 @@ static eSnapMode snap_mode_from_spacetype(TransInfo *t)
if (t->options & (CTX_CAMERA | CTX_EDGE_DATA | CTX_PAINT_CURVE)) {
return SCE_SNAP_TO_INCREMENT;
}
return eSnapMode(ts->snap_mode);
eSnapMode snap_mode = eSnapMode(ts->snap_mode);
if (t->mode == TFM_TRANSLATION) {
/* Use grid-snap for absolute snap while translating, see: #147246. */
if ((snap_mode & SCE_SNAP_TO_INCREMENT) && (ts->snap_flag & SCE_SNAP_ABS_GRID)) {
snap_mode &= ~SCE_SNAP_TO_INCREMENT;
snap_mode |= SCE_SNAP_TO_GRID;
}
}
return snap_mode;
}
if (ELEM(t->spacetype, SPACE_ACTION, SPACE_NLA)) {