diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraint.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraint.java index 0eb696679..3be706bfa 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraint.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraint.java @@ -52,7 +52,7 @@ public class PathConstraint implements Updatable { final PathConstraintData data; final Array bones; - Slot target; + Slot slot; float position, spacing, mixRotate, mixX, mixY; boolean active; @@ -70,7 +70,7 @@ public class PathConstraint implements Updatable { for (BoneData boneData : data.bones) bones.add(skeleton.bones.get(boneData.index)); - target = skeleton.slots.get(data.target.index); + slot = skeleton.slots.get(data.slot.index); position = data.position; spacing = data.spacing; @@ -101,7 +101,7 @@ public class PathConstraint implements Updatable { /** Applies the constraint to the constrained bones. */ public void update (Physics physics) { - if (!(target.attachment instanceof PathAttachment pathAttachment)) return; + if (!(slot.attachment instanceof PathAttachment pathAttachment)) return; float mixRotate = this.mixRotate, mixX = this.mixX, mixY = this.mixY; if (mixRotate == 0 && mixX == 0 && mixY == 0) return; @@ -172,7 +172,7 @@ public class PathConstraint implements Updatable { tip = data.rotateMode == RotateMode.chain; else { tip = false; - Bone p = target.bone; + Bone p = slot.bone; offsetRotation *= p.a * p.d - p.b * p.c > 0 ? degRad : -degRad; } for (int i = 0, p = 3; i < boneCount; i++, p += 3) { @@ -224,7 +224,7 @@ public class PathConstraint implements Updatable { } float[] computeWorldPositions (PathAttachment path, int spacesCount, boolean tangents) { - Slot target = this.target; + Slot slot = this.slot; float position = this.position; float[] spaces = this.spaces.items, out = this.positions.setSize(spacesCount * 3 + 2), world; boolean closed = path.getClosed(); @@ -256,14 +256,14 @@ public class PathConstraint implements Updatable { } else if (p < 0) { if (prevCurve != BEFORE) { prevCurve = BEFORE; - path.computeWorldVertices(target, 2, 4, world, 0, 2); + path.computeWorldVertices(slot, 2, 4, world, 0, 2); } addBeforePosition(p, world, 0, out, o); continue; } else if (p > pathLength) { if (prevCurve != AFTER) { prevCurve = AFTER; - path.computeWorldVertices(target, verticesLength - 6, 4, world, 0, 2); + path.computeWorldVertices(slot, verticesLength - 6, 4, world, 0, 2); } addAfterPosition(p - pathLength, world, 0, out, o); continue; @@ -284,10 +284,10 @@ public class PathConstraint implements Updatable { if (curve != prevCurve) { prevCurve = curve; if (closed && curve == curveCount) { - path.computeWorldVertices(target, verticesLength - 4, 4, world, 0, 2); - path.computeWorldVertices(target, 0, 4, world, 4, 2); + path.computeWorldVertices(slot, verticesLength - 4, 4, world, 0, 2); + path.computeWorldVertices(slot, 0, 4, world, 4, 2); } else - path.computeWorldVertices(target, curve * 6 + 2, 8, world, 0, 2); + path.computeWorldVertices(slot, curve * 6 + 2, 8, world, 0, 2); } addCurvePosition(p, world[0], world[1], world[2], world[3], world[4], world[5], world[6], world[7], out, o, tangents || (i > 0 && space < epsilon)); @@ -299,15 +299,15 @@ public class PathConstraint implements Updatable { if (closed) { verticesLength += 2; world = this.world.setSize(verticesLength); - path.computeWorldVertices(target, 2, verticesLength - 4, world, 0, 2); - path.computeWorldVertices(target, 0, 2, world, verticesLength - 4, 2); + path.computeWorldVertices(slot, 2, verticesLength - 4, world, 0, 2); + path.computeWorldVertices(slot, 0, 2, world, verticesLength - 4, 2); world[verticesLength - 2] = world[0]; world[verticesLength - 1] = world[1]; } else { curveCount--; verticesLength -= 4; world = this.world.setSize(verticesLength); - path.computeWorldVertices(target, 2, verticesLength, world, 0, 2); + path.computeWorldVertices(slot, 2, verticesLength, world, 0, 2); } // Curve lengths. @@ -532,13 +532,13 @@ public class PathConstraint implements Updatable { } /** The slot whose path attachment will be used to constrained the bones. */ - public Slot getTarget () { - return target; + public Slot getSlot () { + return slot; } - public void setTarget (Slot target) { - if (target == null) throw new IllegalArgumentException("target cannot be null."); - this.target = target; + public void setSlot (Slot slot) { + if (slot == null) throw new IllegalArgumentException("slot cannot be null."); + this.slot = slot; } public boolean isActive () { diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraintData.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraintData.java index 746420699..392f87a18 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraintData.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraintData.java @@ -36,7 +36,7 @@ import com.badlogic.gdx.utils.Array; * See Path constraints in the Spine User Guide. */ public class PathConstraintData extends ConstraintData { final Array bones = new Array(); - SlotData target; + SlotData slot; PositionMode positionMode; SpacingMode spacingMode; RotateMode rotateMode; @@ -53,13 +53,13 @@ public class PathConstraintData extends ConstraintData { } /** The slot whose path attachment will be used to constrained the bones. */ - public SlotData getTarget () { - return target; + public SlotData getSlot () { + return slot; } - public void setTarget (SlotData target) { - if (target == null) throw new IllegalArgumentException("target cannot be null."); - this.target = target; + public void setSlot (SlotData slot) { + if (slot == null) throw new IllegalArgumentException("slot cannot be null."); + this.slot = slot; } /** The mode for positioning the first bone on the path. */ diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skeleton.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skeleton.java index e8cfd9692..691eb9dc3 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skeleton.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skeleton.java @@ -238,8 +238,7 @@ public class Skeleton { && (!constraint.data.skinRequired || (skin != null && skin.constraints.contains(constraint.data, true))); if (!constraint.active) return; - Bone target = constraint.target; - sortBone(target); + sortBone(constraint.target); Array constrained = constraint.bones; Bone parent = constrained.first(); @@ -259,15 +258,15 @@ public class Skeleton { } private void sortTransformConstraint (TransformConstraint constraint) { - constraint.active = constraint.target.active + constraint.active = constraint.source.active && (!constraint.data.skinRequired || (skin != null && skin.constraints.contains(constraint.data, true))); if (!constraint.active) return; - sortBone(constraint.target); + sortBone(constraint.source); Object[] constrained = constraint.bones.items; int boneCount = constraint.bones.size; - if (constraint.data.localFrom) { + if (constraint.data.localSource) { for (int i = 0; i < boneCount; i++) { var child = (Bone)constrained[i]; sortBone(child.parent); @@ -287,11 +286,11 @@ public class Skeleton { } private void sortPathConstraint (PathConstraint constraint) { - constraint.active = constraint.target.bone.active + constraint.active = constraint.slot.bone.active && (!constraint.data.skinRequired || (skin != null && skin.constraints.contains(constraint.data, true))); if (!constraint.active) return; - Slot slot = constraint.target; + Slot slot = constraint.slot; int slotIndex = slot.getData().index; Bone slotBone = slot.bone; if (skin != null) sortPathConstraintAttachment(skin, slotIndex, slotBone); diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java index 271fb57e1..cf183226c 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java @@ -280,11 +280,11 @@ public class SkeletonBinary extends SkeletonLoader { Object[] constraintBones = data.bones.setSize(nn = input.readInt(true)); for (int ii = 0; ii < nn; ii++) constraintBones[ii] = bones[input.readInt(true)]; - data.target = (BoneData)bones[input.readInt(true)]; + data.source = (BoneData)bones[input.readInt(true)]; int flags = input.read(); data.skinRequired = (flags & 1) != 0; - data.localFrom = (flags & 2) != 0; - data.localTo = (flags & 4) != 0; + data.localSource = (flags & 2) != 0; + data.localTarget = (flags & 4) != 0; data.relative = (flags & 8) != 0; data.clamp = (flags & 16) != 0; Object[] froms = data.properties.setSize(nn = flags >> 5); @@ -336,7 +336,7 @@ public class SkeletonBinary extends SkeletonLoader { Object[] constraintBones = data.bones.setSize(nn = input.readInt(true)); for (int ii = 0; ii < nn; ii++) constraintBones[ii] = bones[input.readInt(true)]; - data.target = (SlotData)slots[input.readInt(true)]; + data.slot = (SlotData)slots[input.readInt(true)]; int flags = input.read(); data.positionMode = PositionMode.values[flags & 1]; data.spacingMode = SpacingMode.values[(flags >> 1) & 3]; diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonJson.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonJson.java index 697ff4a0d..9550c85d6 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonJson.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonJson.java @@ -252,12 +252,12 @@ public class SkeletonJson extends SkeletonLoader { data.bones.add(bone); } - String targetName = constraintMap.getString("target"); - data.target = skeletonData.findBone(targetName); - if (data.target == null) throw new SerializationException("Transform constraint target bone not found: " + targetName); + String sourceName = constraintMap.getString("source"); + data.source = skeletonData.findBone(sourceName); + if (data.source == null) throw new SerializationException("Transform constraint source bone not found: " + sourceName); - data.localFrom = constraintMap.getBoolean("localFrom", false); - data.localTo = constraintMap.getBoolean("localTo", false); + data.localSource = constraintMap.getBoolean("localSource", false); + data.localTarget = constraintMap.getBoolean("localTarget", false); data.relative = constraintMap.getBoolean("relative", false); data.clamp = constraintMap.getBoolean("clamp", false); @@ -312,9 +312,9 @@ public class SkeletonJson extends SkeletonLoader { data.bones.add(bone); } - String targetName = constraintMap.getString("target"); - data.target = skeletonData.findSlot(targetName); - if (data.target == null) throw new SerializationException("Path target slot not found: " + targetName); + String slotName = constraintMap.getString("slot"); + data.slot = skeletonData.findSlot(slotName); + if (data.slot == null) throw new SerializationException("Path slot not found: " + slotName); data.positionMode = PositionMode.valueOf(constraintMap.getString("positionMode", "percent")); data.spacingMode = SpacingMode.valueOf(constraintMap.getString("spacingMode", "length")); diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraint.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraint.java index bf132afa4..5582d8d6c 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraint.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraint.java @@ -39,13 +39,13 @@ import com.esotericsoftware.spine.TransformConstraintData.FromProperty; import com.esotericsoftware.spine.TransformConstraintData.ToProperty; /** Stores the current pose for a transform constraint. A transform constraint adjusts the world transform of the constrained - * bones to match that of the target bone. + * bones to match that of the source bone. *

* See Transform constraints in the Spine User Guide. */ public class TransformConstraint implements Updatable { final TransformConstraintData data; final Array bones; - Bone target; + Bone source; float mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY; boolean active; @@ -60,7 +60,7 @@ public class TransformConstraint implements Updatable { for (BoneData boneData : data.bones) bones.add(skeleton.bones.get(boneData.index)); - target = skeleton.bones.get(data.target.index); + source = skeleton.bones.get(data.source.index); mixRotate = data.mixRotate; mixX = data.mixX; @@ -96,8 +96,8 @@ public class TransformConstraint implements Updatable { public void update (Physics physics) { if (mixRotate == 0 && mixX == 0 && mixY == 0 && mixScaleX == 0 && mixScaleY == 0 && mixShearY == 0) return; - boolean localFrom = data.localFrom, localTo = data.localTo, relative = data.relative, clamp = data.clamp; - Bone target = this.target; + boolean localFrom = data.localSource, localTarget = data.localTarget, relative = data.relative, clamp = data.clamp; + Bone source = this.source; Object[] fromItems = data.properties.items; int fn = data.properties.size; Object[] bones = this.bones.items; @@ -107,7 +107,7 @@ public class TransformConstraint implements Updatable { var from = (FromProperty)fromItems[f]; float mix = from.mix(this); if (mix != 0) { - float value = from.value(target, localFrom) - from.offset; + float value = from.value(source, localFrom) - from.offset; Object[] toItems = from.to.items; for (int t = 0, tn = from.to.size; t < tn; t++) { var to = (ToProperty)toItems[t]; @@ -118,11 +118,11 @@ public class TransformConstraint implements Updatable { else clamped = clamp(clamped, to.max, to.offset); } - to.apply(bone, clamped, localTo, relative, mix); + to.apply(bone, clamped, localTarget, relative, mix); } } } - if (localTo) + if (localTarget) bone.update(null); else bone.updateAppliedTransform(); @@ -134,14 +134,14 @@ public class TransformConstraint implements Updatable { return bones; } - /** The target bone whose world transform will be copied to the constrained bones. */ - public Bone getTarget () { - return target; + /** The bone whose world transform will be copied to the constrained bones. */ + public Bone getSource () { + return source; } - public void setTarget (Bone target) { - if (target == null) throw new IllegalArgumentException("target cannot be null."); - this.target = target; + public void setSource (Bone source) { + if (source == null) throw new IllegalArgumentException("source cannot be null."); + this.source = source; } /** A percentage (0-1) that controls the mix between the constrained and unconstrained rotation. */ diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraintData.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraintData.java index 95437ec4b..4ec46cda3 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraintData.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraintData.java @@ -38,9 +38,9 @@ import com.badlogic.gdx.utils.Array; * See Transform constraints in the Spine User Guide. */ public class TransformConstraintData extends ConstraintData { final Array bones = new Array(); - BoneData target; + BoneData source; float mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY; - boolean localFrom, localTo, relative, clamp; + boolean localSource, localTarget, relative, clamp; final Array properties = new Array(); public TransformConstraintData (String name) { @@ -52,14 +52,14 @@ public class TransformConstraintData extends ConstraintData { return bones; } - /** The target bone whose world transform will be copied to the constrained bones. */ - public BoneData getTarget () { - return target; + /** The bone whose world transform will be copied to the constrained bones. */ + public BoneData getSource () { + return source; } - public void setTarget (BoneData target) { - if (target == null) throw new IllegalArgumentException("target cannot be null."); - this.target = target; + public void setSource (BoneData source) { + if (source == null) throw new IllegalArgumentException("source cannot be null."); + this.source = source; } /** The mapping of transform properties to other transform properties. */ @@ -121,25 +121,25 @@ public class TransformConstraintData extends ConstraintData { this.mixShearY = mixShearY; } - /** Reads the target bone's local transform instead of its world transform. */ - public boolean getLocalFrom () { - return localFrom; + /** Reads the source bone's local transform instead of its world transform. */ + public boolean getLocalSource () { + return localSource; } - public void setLocalFrom (boolean localFrom) { - this.localFrom = localFrom; + public void setLocalSource (boolean localSource) { + this.localSource = localSource; } /** Sets the constrained bones' local transforms instead of their world transforms. */ - public boolean getLocalTo () { - return localTo; + public boolean getLocalTarget () { + return localTarget; } - public void setLocalTo (boolean localTo) { - this.localTo = localTo; + public void setLocalTarget (boolean localTarget) { + this.localTarget = localTarget; } - /** Adds the target bone transform to the constrained bones instead of setting it absolutely. */ + /** Adds the source bone transform to the constrained bones instead of setting it absolutely. */ public boolean getRelative () { return relative; } @@ -165,11 +165,11 @@ public class TransformConstraintData extends ConstraintData { /** Constrained properties. */ public final Array to = new Array(); - /** Reads this property from the specified bone. */ - abstract public float value (Bone target, boolean local); - /** Reads the mix for this property from the specified constraint. */ abstract public float mix (TransformConstraint constraint); + + /** Reads this property from the specified bone. */ + abstract public float value (Bone source, boolean local); } /** Constrained property for a {@link TransformConstraint}. */ @@ -184,26 +184,26 @@ public class TransformConstraintData extends ConstraintData { public float scale; /** Applies the value to this property. */ - abstract public void apply (Bone bone, float value, boolean local, boolean relative, float mix); + abstract public void apply (Bone target, float value, boolean local, boolean relative, float mix); } static public class FromRotate extends FromProperty { - public float value (Bone target, boolean local) { - return local ? target.arotation : atan2(target.c, target.a) * radDeg; - } - public float mix (TransformConstraint constraint) { return constraint.mixRotate; } + + public float value (Bone source, boolean local) { + return local ? source.arotation : atan2(source.c, source.a) * radDeg; + } } static public class ToRotate extends ToProperty { - public void apply (Bone bone, float value, boolean local, boolean relative, float mix) { + public void apply (Bone target, float value, boolean local, boolean relative, float mix) { if (local) { - if (!relative) value -= bone.arotation; - bone.arotation += value * mix; + if (!relative) value -= target.arotation; + target.arotation += value * mix; } else { - float a = bone.a, b = bone.b, c = bone.c, d = bone.d; + float a = target.a, b = target.b, c = target.c, d = target.d; value *= degRad; if (!relative) value -= atan2(c, a); if (value > PI) @@ -212,142 +212,142 @@ public class TransformConstraintData extends ConstraintData { value += PI2; value *= mix; float cos = cos(value), sin = sin(value); - bone.a = cos * a - sin * c; - bone.b = cos * b - sin * d; - bone.c = sin * a + cos * c; - bone.d = sin * b + cos * d; + target.a = cos * a - sin * c; + target.b = cos * b - sin * d; + target.c = sin * a + cos * c; + target.d = sin * b + cos * d; } } } static public class FromX extends FromProperty { - public float value (Bone target, boolean local) { - return local ? target.ax : target.worldX; - } - public float mix (TransformConstraint constraint) { return constraint.mixX; } + + public float value (Bone source, boolean local) { + return local ? source.ax : source.worldX; + } } static public class ToX extends ToProperty { - public void apply (Bone bone, float value, boolean local, boolean relative, float mix) { + public void apply (Bone target, float value, boolean local, boolean relative, float mix) { if (local) { - if (!relative) value -= bone.ax; - bone.ax += value * mix; + if (!relative) value -= target.ax; + target.ax += value * mix; } else { - if (!relative) value -= bone.worldX; - bone.worldX += value * mix; + if (!relative) value -= target.worldX; + target.worldX += value * mix; } } } static public class FromY extends FromProperty { - public float value (Bone target, boolean local) { - return local ? target.ay : target.worldY; - } - public float mix (TransformConstraint constraint) { return constraint.mixY; } + + public float value (Bone source, boolean local) { + return local ? source.ay : source.worldY; + } } static public class ToY extends ToProperty { - public void apply (Bone bone, float value, boolean local, boolean relative, float mix) { + public void apply (Bone target, float value, boolean local, boolean relative, float mix) { if (local) { - if (!relative) value -= bone.ay; - bone.ay += value * mix; + if (!relative) value -= target.ay; + target.ay += value * mix; } else { - if (!relative) value -= bone.worldY; - bone.worldY += value * mix; + if (!relative) value -= target.worldY; + target.worldY += value * mix; } } } static public class FromScaleX extends FromProperty { - public float value (Bone target, boolean local) { - return local ? target.ascaleX : (float)Math.sqrt(target.a * target.a + target.c * target.c); - } - public float mix (TransformConstraint constraint) { return constraint.mixScaleX; } + + public float value (Bone source, boolean local) { + return local ? source.ascaleX : (float)Math.sqrt(source.a * source.a + source.c * source.c); + } } static public class ToScaleX extends ToProperty { - public void apply (Bone bone, float value, boolean local, boolean relative, float mix) { + public void apply (Bone target, float value, boolean local, boolean relative, float mix) { if (local) { if (relative) - bone.ascaleX *= 1 + ((value - 1) * mix); - else if (bone.ascaleX != 0) // - bone.ascaleX = 1 + (value / bone.ascaleX - 1) * mix; + target.ascaleX *= 1 + ((value - 1) * mix); + else if (target.ascaleX != 0) // + target.ascaleX = 1 + (value / target.ascaleX - 1) * mix; } else { float s; if (relative) s = 1 + (value - 1) * mix; else { - s = (float)Math.sqrt(bone.a * bone.a + bone.c * bone.c); + s = (float)Math.sqrt(target.a * target.a + target.c * target.c); if (s != 0) s = 1 + (value / s - 1) * mix; } - bone.a *= s; - bone.c *= s; + target.a *= s; + target.c *= s; } } } static public class FromScaleY extends FromProperty { - public float value (Bone target, boolean local) { - return local ? target.ascaleY : (float)Math.sqrt(target.b * target.b + target.d * target.d); - } - public float mix (TransformConstraint constraint) { return constraint.mixScaleY; } + + public float value (Bone source, boolean local) { + return local ? source.ascaleY : (float)Math.sqrt(source.b * source.b + source.d * source.d); + } } static public class ToScaleY extends ToProperty { - public void apply (Bone bone, float value, boolean local, boolean relative, float mix) { + public void apply (Bone target, float value, boolean local, boolean relative, float mix) { if (local) { if (relative) - bone.ascaleY *= 1 + ((value - 1) * mix); - else if (bone.ascaleY != 0) // - bone.ascaleY = 1 + (value / bone.ascaleY - 1) * mix; + target.ascaleY *= 1 + ((value - 1) * mix); + else if (target.ascaleY != 0) // + target.ascaleY = 1 + (value / target.ascaleY - 1) * mix; } else { float s; if (relative) s = 1 + (value - 1) * mix; else { - s = (float)Math.sqrt(bone.b * bone.b + bone.d * bone.d); + s = (float)Math.sqrt(target.b * target.b + target.d * target.d); if (s != 0) s = 1 + (value / s - 1) * mix; } - bone.b *= s; - bone.d *= s; + target.b *= s; + target.d *= s; } } } static public class FromShearY extends FromProperty { - public float value (Bone target, boolean local) { - return local ? target.ashearY : (atan2(target.d, target.b) - atan2(target.c, target.a)) * radDeg - 90; - } - public float mix (TransformConstraint constraint) { return constraint.mixShearY; } + + public float value (Bone source, boolean local) { + return local ? source.ashearY : (atan2(source.d, source.b) - atan2(source.c, source.a)) * radDeg - 90; + } } static public class ToShearY extends ToProperty { - public void apply (Bone bone, float value, boolean local, boolean relative, float mix) { + public void apply (Bone target, float value, boolean local, boolean relative, float mix) { if (local) { - if (!relative) value -= bone.ashearY; - bone.ashearY += value * mix; + if (!relative) value -= target.ashearY; + target.ashearY += value * mix; } else { - float b = bone.b, d = bone.d, by = atan2(d, b); + float b = target.b, d = target.d, by = atan2(d, b); value = (value + 90) * degRad; if (relative) value -= PI / 2; else { - value -= by - atan2(bone.c, bone.a); + value -= by - atan2(target.c, target.a); if (value > PI) value -= PI2; else if (value < -PI) // @@ -355,8 +355,8 @@ public class TransformConstraintData extends ConstraintData { } value = by + value * mix; float s = (float)Math.sqrt(b * b + d * d); - bone.b = cos(value) * s; - bone.d = sin(value) * s; + target.b = cos(value) * s; + target.d = sin(value) * s; } } } diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/SkeletonDrawable.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/SkeletonDrawable.java index 257f4990c..4826db903 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/SkeletonDrawable.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/SkeletonDrawable.java @@ -34,8 +34,8 @@ import com.badlogic.gdx.scenes.scene2d.utils.BaseDrawable; import com.esotericsoftware.spine.AnimationState; import com.esotericsoftware.spine.Skeleton; -import com.esotericsoftware.spine.SkeletonRenderer; import com.esotericsoftware.spine.Skeleton.Physics; +import com.esotericsoftware.spine.SkeletonRenderer; /** A scene2d drawable that draws a skeleton. The animation state and skeleton must be updated each frame, or * {@link #update(float)} called each frame. */