diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Posed.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Posed.java index 7f76cee50..7b2eb254c 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Posed.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Posed.java @@ -36,14 +36,6 @@ abstract public class Posed< // return applied; } - void setConstrained (boolean constrained) { - applied = constrained ? this.constrained : (A)pose; - } - - void resetAppliedPose () { - applied.set(pose); - } - public String toString () { return data.name; } 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 77dd7b296..9581b58d2 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skeleton.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skeleton.java @@ -154,13 +154,19 @@ public class Skeleton { updateCache.clear(); resetCache.clear(); + Slot[] slots = this.slots.items; + for (int i = 0, n = this.slots.size; i < n; i++) { + Slot slot = slots[i]; + slot.applied = slot.pose; + } + int boneCount = bones.size; Bone[] bones = this.bones.items; for (int i = 0; i < boneCount; i++) { Bone bone = bones[i]; bone.sorted = bone.data.skinRequired; bone.active = !bone.sorted; - bone.setConstrained(false); + bone.applied = (BonePose)bone.pose; } if (skin != null) { BoneData[] skinBones = skin.bones.items; @@ -176,8 +182,10 @@ public class Skeleton { Constraint[] constraints = this.constraints.items; int n = this.constraints.size; - for (int i = 0; i < n; i++) - constraints[i].setConstrained(false); + for (int i = 0; i < n; i++) { + Constraint constraint = constraints[i]; + constraint.applied = constraint.pose; + } for (int i = 0; i < n; i++) { Constraint, ?, ?> constraint = constraints[i]; constraint.active = constraint.isSourceActive() @@ -196,7 +204,7 @@ public class Skeleton { void resetCache (Posed object) { if (object.pose == object.applied) { - object.setConstrained(true); + object.applied = object.constrained; resetCache.add(object); } } @@ -228,8 +236,10 @@ public class Skeleton { update++; Posed[] resetCache = this.resetCache.items; - for (int i = 0, n = this.resetCache.size; i < n; i++) - resetCache[i].resetAppliedPose(); + for (int i = 0, n = this.resetCache.size; i < n; i++) { + Posed object = resetCache[i]; + object.applied.set(object.pose); + } Object[] updateCache = this.updateCache.items; for (int i = 0, n = this.updateCache.size; i < n; i++) @@ -241,14 +251,16 @@ public class Skeleton { *
* See World transforms in the Spine
* Runtimes Guide. */
- public void updateWorldTransform (Physics physics, BonePose parent) {
+ public void updateWorldTransform (Physics physics, BonePose parent) { // Do not port.
if (parent == null) throw new IllegalArgumentException("parent cannot be null.");
update++;
Posed[] resetCache = this.resetCache.items;
- for (int i = 0, n = this.resetCache.size; i < n; i++)
- resetCache[i].resetAppliedPose();
+ for (int i = 0, n = this.resetCache.size; i < n; i++) {
+ Posed object = resetCache[i];
+ object.applied.set(object.pose);
+ }
// Apply the parent bone transform to the root bone. The root bone always inherits scale, rotation and reflection.
BonePose rootBone = getRootBone().applied;
diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Slot.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Slot.java
index f19569f76..d4c3cdb44 100644
--- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Slot.java
+++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Slot.java
@@ -46,7 +46,7 @@ public class Slot extends Posed