[Bf-blender-cvs] [8573c1a] master: Fix T29153: Rotate & scale ignore snapping points

Campbell Barton noreply at git.blender.org
Mon Jan 18 04:08:39 CET 2016


Commit: 8573c1a84728546e949ced6e6f198afd16ac4dc4
Author: Campbell Barton
Date:   Mon Jan 18 12:03:43 2016 +1100
Branches: master
https://developer.blender.org/rB8573c1a84728546e949ced6e6f198afd16ac4dc4

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.

===================================================================

M	source/blender/editors/transform/transform_snap.c

===================================================================

diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 869f03e..ea07193 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -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);
 }




More information about the Bf-blender-cvs mailing list