Browse Source

Fixed scale of constrained bones with transform constraint relative + local.

Nathan Sweet 4 years ago
parent
commit
efac69ee7a

+ 2 - 2
spine-as3/spine-as3/src/spine/TransformConstraint.as

@@ -263,8 +263,8 @@ package spine {
 				var rotation : Number = bone.arotation + (target.arotation + _data.offsetRotation) * mixRotate;
 				var x : Number = bone.ax + (target.ax + _data.offsetX) * mixX;
 				var y : Number = bone.ay + (target.ay + _data.offsetY) * mixY;
-				var scaleX : Number = (bone.ascaleX * ((target.ascaleX - 1 + _data.offsetScaleX) * mixScaleX) + 1);
-				var scaleY : Number = (bone.ascaleY * ((target.ascaleY - 1 + _data.offsetScaleY) * mixScaleY) + 1);
+				var scaleX : Number = bone.ascaleX * (((target.ascaleX - 1 + _data.offsetScaleX) * mixScaleX) + 1);
+				var scaleY : Number = bone.ascaleY * (((target.ascaleY - 1 + _data.offsetScaleY) * mixScaleY) + 1);
 				var shearY : Number = bone.ashearY + (target.ashearY + _data.offsetShearY) * mixShearY;
 
 				bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);

+ 2 - 2
spine-c/spine-c/src/spine/TransformConstraint.c

@@ -231,8 +231,8 @@ void _spTransformConstraint_applyRelativeLocal(spTransformConstraint *self) {
 		rotation = bone->arotation + (target->arotation + self->data->offsetRotation) * mixRotate;
 		x = bone->ax + (target->ax + self->data->offsetX) * mixX;
 		y = bone->ay + (target->ay + self->data->offsetY) * mixY;
-		scaleX = (bone->ascaleX * ((target->ascaleX - 1 + self->data->offsetScaleX) * mixScaleX) + 1);
-		scaleY = (bone->ascaleY * ((target->ascaleY - 1 + self->data->offsetScaleY) * mixScaleY) + 1);
+		scaleX = bone->ascaleX * (((target->ascaleX - 1 + self->data->offsetScaleX) * mixScaleX) + 1);
+		scaleY = bone->ascaleY * (((target->ascaleY - 1 + self->data->offsetScaleY) * mixScaleY) + 1);
 		shearY = bone->ashearY + (target->ashearY + self->data->offsetShearY) * mixShearY;
 
 		spBone_updateWorldTransformWith(bone, x, y, rotation, scaleX, scaleY, bone->ashearX, shearY);

+ 2 - 2
spine-cpp/spine-cpp/src/spine/TransformConstraint.cpp

@@ -327,8 +327,8 @@ void TransformConstraint::applyRelativeLocal() {
 		float rotation = bone._arotation + (target._arotation + _data._offsetRotation) * mixRotate;
 		float x = bone._ax + (target._ax + _data._offsetX) * mixX;
 		float y = bone._ay + (target._ay + _data._offsetY) * mixY;
-		float scaleX = (bone._ascaleX * ((target._ascaleX - 1 + _data._offsetScaleX) * mixScaleX) + 1);
-		float scaleY = (bone._ascaleY * ((target._ascaleY - 1 + _data._offsetScaleY) * mixScaleY) + 1);
+		float scaleX = bone._ascaleX * (((target._ascaleX - 1 + _data._offsetScaleX) * mixScaleX) + 1);
+		float scaleY = bone._ascaleY * (((target._ascaleY - 1 + _data._offsetScaleY) * mixScaleY) + 1);
 		float shearY = bone._ashearY + (target._ashearY + _data._offsetShearY) * mixShearY;
 
 		bone.updateWorldTransform(x, y, rotation, scaleX, scaleY, bone._ashearX, shearY);

+ 2 - 2
spine-csharp/src/TransformConstraint.cs

@@ -276,8 +276,8 @@ namespace Spine {
 				float rotation = bone.arotation + (target.arotation + data.offsetRotation) * mixRotate;
 				float x = bone.ax + (target.ax + data.offsetX) * mixX;
 				float y = bone.ay + (target.ay + data.offsetY) * mixY;
-				float scaleX = (bone.ascaleX * ((target.ascaleX - 1 + data.offsetScaleX) * mixScaleX) + 1);
-				float scaleY = (bone.ascaleY * ((target.ascaleY - 1 + data.offsetScaleY) * mixScaleY) + 1);
+				float scaleX = bone.ascaleX * (((target.ascaleX - 1 + data.offsetScaleX) * mixScaleX) + 1);
+				float scaleY = bone.ascaleY * (((target.ascaleY - 1 + data.offsetScaleY) * mixScaleY) + 1);
 				float shearY = bone.ashearY + (target.ashearY + data.offsetShearY) * mixShearY;
 
 				bone.UpdateWorldTransform(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);

+ 2 - 2
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraint.java

@@ -278,8 +278,8 @@ public class TransformConstraint implements Updatable {
 			float rotation = bone.arotation + (target.arotation + data.offsetRotation) * mixRotate;
 			float x = bone.ax + (target.ax + data.offsetX) * mixX;
 			float y = bone.ay + (target.ay + data.offsetY) * mixY;
-			float scaleX = (bone.ascaleX * ((target.ascaleX - 1 + data.offsetScaleX) * mixScaleX) + 1);
-			float scaleY = (bone.ascaleY * ((target.ascaleY - 1 + data.offsetScaleY) * mixScaleY) + 1);
+			float scaleX = bone.ascaleX * (((target.ascaleX - 1 + data.offsetScaleX) * mixScaleX) + 1);
+			float scaleY = bone.ascaleY * (((target.ascaleY - 1 + data.offsetScaleY) * mixScaleY) + 1);
 			float shearY = bone.ashearY + (target.ashearY + data.offsetShearY) * mixShearY;
 
 			bone.updateWorldTransform(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);

+ 2 - 2
spine-lua/spine-lua/TransformConstraint.lua

@@ -309,8 +309,8 @@ function TransformConstraint:applyRelativeLocal ()
 		local rotation = bone.arotation + (target.arotation + self.data.offsetRotation) * mixRotate
 		local x = bone.ax + (target.ax + self.data.offsetX) * mixX
 		local y = bone.ay + (target.ay + self.data.offsetY) * mixY
-		local scaleX = (bone.ascaleX * ((target.ascaleX - 1 + self.data.offsetScaleX) * mixScaleX) + 1)
-		local scaleY = (bone.ascaleY * ((target.ascaleY - 1 + self.data.offsetScaleY) * mixScaleY) + 1)
+		local scaleX = bone.ascaleX * (((target.ascaleX - 1 + self.data.offsetScaleX) * mixScaleX) + 1)
+		local scaleY = bone.ascaleY * (((target.ascaleY - 1 + self.data.offsetScaleY) * mixScaleY) + 1)
 		local shearY = bone.ashearY + (target.ashearY + self.data.offsetShearY) * mixShearY
 		bone:updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY)
 	end