Fix Increment Snapping Without Constraints in Non-Axis-Aligned Views
The incremental snap was always operating in the local space, which in most cases is the VIEW type orientation. Use only local space when the operation is affected by constraint. Differential Revision: https://developer.blender.org/D10052
This commit is contained in:
parent
9db3d1951d
commit
08e44b5e3e
Notes:
blender-bot
2023-02-14 10:21:11 +01:00
Referenced by issue #83216, Potential candidates for corrective releases
|
@ -395,9 +395,9 @@ static void applyTranslation(TransInfo *t, const int UNUSED(mval[2]))
|
|||
}
|
||||
|
||||
float incr_dir[3];
|
||||
mul_v3_m3v3(incr_dir, t->spacemtx_inv, global_dir);
|
||||
if (!(activeSnap(t) && validSnap(t)) && transform_snap_increment(t, incr_dir)) {
|
||||
mul_v3_m3v3(incr_dir, t->spacemtx, incr_dir);
|
||||
copy_v3_v3(incr_dir, global_dir);
|
||||
if (!(activeSnap(t) && validSnap(t)) &&
|
||||
transform_snap_increment_ex(t, (t->con.mode & CON_APPLY) != 0, incr_dir)) {
|
||||
|
||||
/* Test for mixed snap with grid. */
|
||||
float snap_dist_sq = FLT_MAX;
|
||||
|
|
|
@ -1536,7 +1536,7 @@ static void snap_increment_apply(TransInfo *t,
|
|||
snap_increment_apply_ex(t, max_index, increment_dist, asp, r_val, r_val);
|
||||
}
|
||||
|
||||
bool transform_snap_increment(TransInfo *t, float *val)
|
||||
bool transform_snap_increment_ex(TransInfo *t, bool use_local_space, float *r_val)
|
||||
{
|
||||
if (!activeSnap(t)) {
|
||||
return false;
|
||||
|
@ -1552,12 +1552,26 @@ bool transform_snap_increment(TransInfo *t, float *val)
|
|||
return false;
|
||||
}
|
||||
|
||||
float increment_dist = (t->modifiers & MOD_PRECISION) ? t->snap[1] : t->snap[0];
|
||||
if (use_local_space) {
|
||||
BLI_assert(t->idx_max == 2);
|
||||
mul_m3_v3(t->spacemtx_inv, r_val);
|
||||
}
|
||||
|
||||
float increment_dist = (t->modifiers & MOD_PRECISION) ? t->snap[1] : t->snap[0];
|
||||
snap_increment_apply(t, t->idx_max, increment_dist, r_val);
|
||||
|
||||
if (use_local_space) {
|
||||
mul_m3_v3(t->spacemtx, r_val);
|
||||
}
|
||||
|
||||
snap_increment_apply(t, t->idx_max, increment_dist, val);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool transform_snap_increment(TransInfo *t, float *r_val)
|
||||
{
|
||||
return transform_snap_increment_ex(t, false, r_val);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
|
|
@ -54,6 +54,7 @@ void snapFrameTransform(struct TransInfo *t,
|
|||
|
||||
bool transformModeUseSnap(const TransInfo *t);
|
||||
|
||||
bool transform_snap_increment_ex(TransInfo *t, bool use_local_space, float *r_val);
|
||||
bool transform_snap_increment(TransInfo *t, float *val);
|
||||
bool transform_snap_grid(TransInfo *t, float *val);
|
||||
|
||||
|
|
Loading…
Reference in New Issue