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

This commit is contained in:
Nathan Sweet 2021-09-06 19:54:10 -06:00
parent 68413182fb
commit efac69ee7a
6 changed files with 12 additions and 12 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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