Fix T29153: Rotate & scale ignore snapping points

Checking for 'Closest' here isn't needed since
TransSnap.snapTarget callback is already ensuring the selected target is the closest.

Also don't reuse the pre-calculated distance,
since its only valid to do this when there are no snap points
and this isn't a significant gain to avoid the extra calculation - run once per update.
This commit is contained in:
Campbell Barton 2016-01-18 12:03:43 +11:00
parent b4146a04bc
commit 8573c1a847
Notes: blender-bot 2023-02-14 14:21:41 +01:00
Referenced by issue #29153, Snapping control points are not taken into account during Scaling/Rotating
1 changed files with 8 additions and 18 deletions

View File

@ -803,29 +803,19 @@ static void ApplySnapTranslation(TransInfo *t, float vec[3])
static void ApplySnapRotation(TransInfo *t, float *value)
{
if (t->tsnap.target == SCE_SNAP_TARGET_CLOSEST) {
*value = t->tsnap.dist;
}
else {
float point[3];
getSnapPoint(t, point);
*value = RotationBetween(t, t->tsnap.snapTarget, point);
}
float point[3];
getSnapPoint(t, point);
float dist = RotationBetween(t, t->tsnap.snapTarget, point);
*value = dist;
}
static void ApplySnapResize(TransInfo *t, float vec[3])
{
float dist;
if (t->tsnap.target == SCE_SNAP_TARGET_CLOSEST) {
dist = t->tsnap.dist;
}
else {
float point[3];
getSnapPoint(t, point);
dist = ResizeBetween(t, t->tsnap.snapTarget, point);
}
float point[3];
getSnapPoint(t, point);
float dist = ResizeBetween(t, t->tsnap.snapTarget, point);
copy_v3_fl(vec, dist);
}