[csharp] Port of commit 7facce3: Draw order folder timeline property ID per slot with "all" special case.

This commit is contained in:
Harald Csaszar 2026-03-17 20:55:01 +01:00
parent 965e074dd8
commit 556509adc8
2 changed files with 19 additions and 5 deletions

View File

@ -2018,7 +2018,8 @@ namespace Spine {
/// <summary>Changes a skeleton's <see cref="Skeleton.DrawOrder"/>.</summary>
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 {
/// <param name="slots"><see cref="Skeleton.Slots"/> indices controlled by this timeline, in setup order.</param>
/// <param name="slotCount">The maximum number of slots in the skeleton.</param>
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; }
}

View File

@ -909,9 +909,12 @@ namespace Spine {
HashSet<string> 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)) {