diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java index 8f128925c..9254b9c84 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java @@ -67,8 +67,8 @@ public class Bone extends PosedActive { } void resetUpdate (Skeleton skeleton) { - if (applied.update != skeleton.update) return; - applied.update = 0; + if (applied.world != skeleton.update) return; + applied.world = 0; Bone[] children = this.children.items; for (int i = 0, n = this.children.size; i < n; i++) children[i].resetUpdate(skeleton); diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/BonePose.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/BonePose.java index b7bdbc876..38ff9cf62 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/BonePose.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/BonePose.java @@ -15,12 +15,11 @@ public class BonePose extends BoneLocal implements Update { Bone bone; float a, b, worldX; float c, d, worldY; - int update; - boolean localDirty; + int world, local; /** Called by {@link Skeleton#updateCache()} to compute the world transform, if needed. */ public void update (Skeleton skeleton, Physics physics) { - if (update != skeleton.update) updateWorldTransform(skeleton); + if (world != skeleton.update) updateWorldTransform(skeleton); } /** Computes the world transform using the parent bone's applied pose and this pose. Child bones are not updated. @@ -28,8 +27,10 @@ public class BonePose extends BoneLocal implements Update { * See World transforms in the Spine * Runtimes Guide. */ public void updateWorldTransform (Skeleton skeleton) { - update = skeleton.update; - localDirty = false; + if (local == skeleton.update) + updateLocalTransform(skeleton); + else + world = skeleton.update; if (bone.parent == null) { // Root bone. float sx = skeleton.scaleX, sy = skeleton.scaleY; @@ -138,8 +139,8 @@ public class BonePose extends BoneLocal implements Update { * Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. The local transform after * calling this method is equivalent to the local transform used to compute the world transform, but may not be identical. */ public void updateLocalTransform (Skeleton skeleton) { - update = skeleton.update; - localDirty = false; + world = skeleton.update; + local = 0; if (bone.parent == null) { x = worldX - skeleton.x; @@ -220,8 +221,8 @@ public class BonePose extends BoneLocal implements Update { /** When true, the world transform has been modified and the local transform no longer matches. Call * {@link #updateLocalTransform(Skeleton)} before using the local transform. */ - public boolean isLocalDirty () { - return localDirty; + public boolean isLocalDirty (Skeleton skeleton) { + return local == skeleton.update; } /** Part of the world transform matrix for the X axis. If changed, {@link #updateLocalTransform(Skeleton)} should be called. */ diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java index b360422a0..11508ed58 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java @@ -114,7 +114,7 @@ public class IkConstraint extends Constraint { if (timelines[i] instanceof BoneTimeline timeline) { Bone bone = bones[timeline.getBoneIndex()]; bone.resetUpdate(skeleton); - if (bone.applied.localDirty) bone.applied.updateLocalTransform(skeleton); + if (bone.applied.local == skeleton.update) bone.applied.updateLocalTransform(skeleton); } } } 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 692b9a238..aa6ce3b17 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraint.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraint.java @@ -70,13 +70,14 @@ public class TransformConstraint extends Constraint