diff --git a/spine-csharp/src/Animation.cs b/spine-csharp/src/Animation.cs index c45a263dc..dac6bf6c5 100644 --- a/spine-csharp/src/Animation.cs +++ b/spine-csharp/src/Animation.cs @@ -2018,7 +2018,8 @@ namespace Spine { /// Changes a skeleton's . public class DrawOrderTimeline : Timeline { - internal static readonly string[] propertyIds = { ((int)Property.DrawOrder).ToString() }; + internal static readonly string propertyID = ((int)Property.DrawOrder).ToString(); + internal static readonly string[] propertyIds = { propertyID }; readonly int[][] drawOrders; @@ -2082,7 +2083,7 @@ namespace Spine { /// indices controlled by this timeline, in setup order. /// The maximum number of slots in the skeleton. public DrawOrderFolderTimeline (int frameCount, int[] slots, int slotCount) - : base(frameCount, DrawOrderTimeline.propertyIds) { + : base(frameCount, PropertyIdsFromSlots(slots)) { this.slots = slots; drawOrders = new int[frameCount][]; inFolder = new bool[slotCount]; @@ -2090,6 +2091,14 @@ namespace Spine { inFolder[i] = true; } + static private string[] PropertyIdsFromSlots (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; + } + override public int FrameCount { get { return frames.Length; } } diff --git a/spine-csharp/src/AnimationState.cs b/spine-csharp/src/AnimationState.cs index 7e3bd95f6..8c6542278 100644 --- a/spine-csharp/src/AnimationState.cs +++ b/spine-csharp/src/AnimationState.cs @@ -909,9 +909,12 @@ namespace Spine { HashSet propertyIds = this.propertyIds; if (to != null && to.holdPrevious) { - for (int i = 0; i < timelinesCount; i++) - timelineMode[i] = propertyIds.AddAll(timelines[i].PropertyIds) ? AnimationState.HoldFirst : AnimationState.HoldSubsequent; - + for (int i = 0; i < timelinesCount; i++) { + bool first = propertyIds.AddAll(timelines[i].PropertyIds); + if (first && timelines[i] is DrawOrderFolderTimeline && propertyIds.Contains(DrawOrderTimeline.propertyID)) + first = false; // DrawOrderTimeline changed. + timelineMode[i] = first ? AnimationState.HoldFirst : AnimationState.HoldSubsequent; + } return; } @@ -921,6 +924,8 @@ namespace Spine { String[] ids = timeline.PropertyIds; if (!propertyIds.AddAll(ids)) timelineMode[i] = AnimationState.Subsequent; + else if (timeline is DrawOrderFolderTimeline && propertyIds.Contains(DrawOrderTimeline.propertyID)) + timelineMode[i] = AnimationState.Subsequent; // DrawOrderTimeline changed. else if (to == null || timeline is AttachmentTimeline || timeline is DrawOrderTimeline || timeline is DrawOrderFolderTimeline || timeline is EventTimeline || !to.animation.HasTimeline(ids)) {