diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Animation.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Animation.java index 8f3794d8b..6dd1faced 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Animation.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Animation.java @@ -1859,7 +1859,8 @@ public class Animation { /** Changes a skeleton's {@link Skeleton#getDrawOrder()}. */ static public class DrawOrderTimeline extends Timeline { - static private final String[] propertyIds = {Integer.toString(Property.drawOrder.ordinal())}; + static final String propertyID = Integer.toString(Property.drawOrder.ordinal()); + static private final String[] propertyIds = {propertyID}; private final int[][] drawOrders; @@ -1921,7 +1922,7 @@ public class Animation { /** @param slots {@link Skeleton#getSlots()} indices controlled by this timeline, in setup order. * @param slotCount The maximum number of slots in the skeleton. */ public DrawOrderFolderTimeline (int frameCount, int[] slots, int slotCount) { - super(frameCount, DrawOrderTimeline.propertyIds); + super(frameCount, propertyIds(slots)); this.slots = slots; drawOrders = new int[frameCount][]; inFolder = new boolean[slotCount]; @@ -1929,6 +1930,14 @@ public class Animation { inFolder[i] = true; } + static private String[] propertyIds (int[] slots) { + int n = slots.length; + String[] ids = new String[n]; + for (int i = 0; i < n; i++) + ids[i] = "d" + slots[i]; + return ids; + } + public int getFrameCount () { return frames.length; } diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java index 26e4e2b8f..37147697f 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java @@ -795,8 +795,12 @@ public class AnimationState { ObjectSet propertyIds = this.propertyIds; if (to != null && to.holdPrevious) { - for (int i = 0; i < timelinesCount; i++) - timelineMode[i] = propertyIds.addAll(timelines[i].getPropertyIds()) ? HOLD_FIRST : HOLD_SUBSEQUENT; + for (int i = 0; i < timelinesCount; i++) { + boolean first = propertyIds.addAll(timelines[i].getPropertyIds()); + if (first && timelines[i] instanceof DrawOrderFolderTimeline && propertyIds.contains(DrawOrderTimeline.propertyID)) + first = false; // DrawOrderTimeline changed. + timelineMode[i] = first ? HOLD_FIRST : HOLD_SUBSEQUENT; + } return; } @@ -806,6 +810,8 @@ public class AnimationState { String[] ids = timeline.getPropertyIds(); if (!propertyIds.addAll(ids)) timelineMode[i] = SUBSEQUENT; + else if (timeline instanceof DrawOrderFolderTimeline && propertyIds.contains(DrawOrderTimeline.propertyID)) + timelineMode[i] = SUBSEQUENT; // DrawOrderTimeline changed. else if (to == null || timeline instanceof AttachmentTimeline || timeline instanceof DrawOrderTimeline || timeline instanceof DrawOrderFolderTimeline || timeline instanceof EventTimeline || !to.animation.hasTimeline(ids)) {