Browse Source

Clean up.

NathanSweet 9 years ago
parent
commit
1410f0e16f

+ 6 - 5
spine-c/src/spine/IkConstraint.c

@@ -76,11 +76,12 @@ void spIkConstraint_apply1 (spBone* bone, float targetX, float targetY, float al
 		rotationIK = 360 - rotationIK;
 	if (rotationIK > 180) rotationIK -= 360;
 	else if (rotationIK < -180) rotationIK += 360;
-	spBone_updateWorldTransformWith(bone, bone->x, bone->y, rotation + (rotationIK - rotation) * alpha, bone->scaleX, bone->scaleY);
+	spBone_updateWorldTransformWith(bone, bone->x, bone->y, rotation + (rotationIK - rotation) * alpha, bone->appliedScaleX,
+		bone->appliedScaleY);
 }
 
 void spIkConstraint_apply2 (spBone* parent, spBone* child, float targetX, float targetY, int bendDir, float alpha) {
-	float px = parent->x, py = parent->y, psx = parent->scaleX, psy = parent->scaleY;
+	float px = parent->x, py = parent->y, psx = parent->appliedScaleX, psy = parent->appliedScaleY;
 	float cx = child->x, cy = child->y, csx = child->appliedScaleX, cwx = child->worldX, cwy = child->worldY;
 	int o1, o2, s2, u;
 	spBone* pp = parent->parent;
@@ -198,9 +199,9 @@ void spIkConstraint_apply2 (spBone* parent, spBone* child, float targetX, float
 		}
 	}
 	outer: {
-		float offset = ATAN2(cy, child->x) * s2;
-		a1 = (a1 - offset) * RAD_DEG + o1;
-		a2 = (a2 + offset) * RAD_DEG * s2 + o2;
+		float os = ATAN2(cy, cx) * s2;
+		a1 = (a1 - os) * RAD_DEG + o1;
+		a2 = (a2 + os) * RAD_DEG * s2 + o2;
 		if (a1 > 180) a1 -= 360;
 		else if (a1 < -180) a1 += 360;
 		if (a2 > 180) a2 -= 360;

+ 3 - 3
spine-csharp/src/IkConstraint.cs

@@ -90,7 +90,7 @@ namespace Spine {
 				rotationIK = 360 - rotationIK;
 			if (rotationIK > 180) rotationIK -= 360;
 			else if (rotationIK < -180) rotationIK += 360;
-			bone.UpdateWorldTransform(bone.x, bone.y, rotation + (rotationIK - rotation) * alpha, bone.scaleX, bone.scaleY);
+			bone.UpdateWorldTransform(bone.x, bone.y, rotation + (rotationIK - rotation) * alpha, bone.appliedScaleX, bone.appliedScaleY);
 		}
 
 		/// <summary>Adjusts the parent and child bone rotations so the tip of the child is as close to the target position as
@@ -98,7 +98,7 @@ namespace Spine {
 		/// <param name="child">A direct descendant of the parent bone.</param>
 		static public void Apply (Bone parent, Bone child, float targetX, float targetY, int bendDir, float alpha) {
 			if (alpha == 0) return;
-			float px = parent.x, py = parent.y, psx = parent.scaleX, psy = parent.scaleY;
+			float px = parent.x, py = parent.y, psx = parent.appliedScaleX, psy = parent.appliedScaleY;
 			int os1, os2, s2;
 			if (psx < 0) {
 				psx = -psx;
@@ -112,7 +112,7 @@ namespace Spine {
 				psy = -psy;
 				s2 = -s2;
 			}
-			float cx = child.x, cy = child.y, csx = child.scaleX;
+			float cx = child.x, cy = child.y, csx = child.appliedScaleX;
 			bool u = Math.Abs(psx - psy) <= 0.0001f;
 			if (!u && cy != 0) {
 				child.worldX = parent.a * cx + parent.worldX;

+ 6 - 5
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java

@@ -129,7 +129,8 @@ public class IkConstraint implements Updatable {
 		if (rotationIK > 180)
 			rotationIK -= 360;
 		else if (rotationIK < -180) rotationIK += 360;
-		bone.updateWorldTransform(bone.x, bone.y, rotation + (rotationIK - rotation) * alpha, bone.scaleX, bone.scaleY);
+		bone.updateWorldTransform(bone.x, bone.y, rotation + (rotationIK - rotation) * alpha, bone.appliedScaleX,
+			bone.appliedScaleY);
 	}
 
 	/** Adjusts the parent and child bone rotations so the tip of the child is as close to the target position as possible. The
@@ -137,7 +138,7 @@ public class IkConstraint implements Updatable {
 	 * @param child A direct descendant of the parent bone. */
 	static public void apply (Bone parent, Bone child, float targetX, float targetY, int bendDir, float alpha) {
 		if (alpha == 0) return;
-		float px = parent.x, py = parent.y, psx = parent.scaleX, psy = parent.scaleY;
+		float px = parent.x, py = parent.y, psx = parent.appliedScaleX, psy = parent.appliedScaleY;
 		int os1, os2, s2;
 		if (psx < 0) {
 			psx = -psx;
@@ -248,9 +249,9 @@ public class IkConstraint implements Updatable {
 				a2 = maxAngle * bendDir;
 			}
 		}
-		float o = atan2(cy, cx) * s2;
-		a1 = (a1 - o) * radDeg + os1;
-		a2 = (a2 + o) * radDeg * s2 + os2;
+		float os = atan2(cy, cx) * s2;
+		a1 = (a1 - os) * radDeg + os1;
+		a2 = (a2 + os) * radDeg * s2 + os2;
 		if (a1 > 180)
 			a1 -= 360;
 		else if (a1 < -180) a1 += 360;

+ 0 - 1
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonJson.java

@@ -594,7 +594,6 @@ public class SkeletonJson {
 		Attachment mesh;
 
 		public LinkedMesh (Attachment mesh, String skin, int slotIndex, String parent) {
-			super();
 			this.mesh = mesh;
 			this.skin = skin;
 			this.slotIndex = slotIndex;