Fix T29153: Rotate & scale ignore snapping points
authorCampbell Barton <ideasman42@gmail.com>
Mon, 18 Jan 2016 01:03:43 +0000 (12:03 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 18 Jan 2016 03:01:20 +0000 (14:01 +1100)
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.

source/blender/editors/transform/transform_snap.c

index 869f03e416a7b03ec242c06eca3d743501e74d26..ea07193b85bfc663f6f0a908e6e203ae6ee39f9e 100644 (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);
 }