mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[haxe] Port of commit 7facce3: Draw order folder timeline property ID per slot with "all" special case.
This commit is contained in:
parent
a056f01029
commit
9df5f9e4de
@ -283,7 +283,7 @@ class AnimationState {
|
|||||||
|
|
||||||
for (ii in 0...timelineCount) {
|
for (ii in 0...timelineCount) {
|
||||||
var timeline:Timeline = timelines[ii];
|
var timeline:Timeline = timelines[ii];
|
||||||
var timelineBlend:MixBlend = timelineMode[ii] == SUBSEQUENT ? current.mixBlendblend : MixBlend.setup;
|
var timelineBlend:MixBlend = timelineMode[ii] == SUBSEQUENT ? current.mixBlend : MixBlend.setup;
|
||||||
if (!shortestRotation && Std.isOfType(timeline, RotateTimeline)) {
|
if (!shortestRotation && Std.isOfType(timeline, RotateTimeline)) {
|
||||||
this.applyRotateTimeline(cast(timeline, RotateTimeline), skeleton, applyTime, alpha, timelineBlend, current.timelinesRotation,
|
this.applyRotateTimeline(cast(timeline, RotateTimeline), skeleton, applyTime, alpha, timelineBlend, current.timelinesRotation,
|
||||||
ii << 1, firstFrame);
|
ii << 1, firstFrame);
|
||||||
@ -875,7 +875,10 @@ class AnimationState {
|
|||||||
|
|
||||||
if (to != null && to.holdPrevious) {
|
if (to != null && to.holdPrevious) {
|
||||||
for (i in 0...timelinesCount) {
|
for (i in 0...timelinesCount) {
|
||||||
timelineMode[i] = propertyIDs.addAll(timelines[i].propertyIds) ? HOLD_FIRST : HOLD_SUBSEQUENT;
|
var first = propertyIDs.addAll(timelines[i].propertyIds);
|
||||||
|
if (first && Std.isOfType(timelines[i], DrawOrderFolderTimeline) && propertyIDs.contains(DrawOrderTimeline.propertyID))
|
||||||
|
first = false; // DrawOrderTimeline changed.
|
||||||
|
timelineMode[i] = first ? HOLD_FIRST : HOLD_SUBSEQUENT;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -885,9 +888,11 @@ class AnimationState {
|
|||||||
continueOuter = false;
|
continueOuter = false;
|
||||||
var timeline:Timeline = timelines[i];
|
var timeline:Timeline = timelines[i];
|
||||||
var ids:Array<String> = timeline.propertyIds;
|
var ids:Array<String> = timeline.propertyIds;
|
||||||
if (!propertyIDs.addAll(ids)) {
|
if (!propertyIDs.addAll(ids))
|
||||||
timelineMode[i] = SUBSEQUENT;
|
timelineMode[i] = SUBSEQUENT;
|
||||||
} else if (to == null
|
else if (Std.isOfType(timeline, DrawOrderFolderTimeline) && propertyIDs.contains(DrawOrderTimeline.propertyID))
|
||||||
|
timelineMode[i] = SUBSEQUENT; // DrawOrderTimeline changed.
|
||||||
|
else if (to == null
|
||||||
|| Std.isOfType(timeline, AttachmentTimeline)
|
|| Std.isOfType(timeline, AttachmentTimeline)
|
||||||
|| Std.isOfType(timeline, DrawOrderTimeline)
|
|| Std.isOfType(timeline, DrawOrderTimeline)
|
||||||
|| Std.isOfType(timeline, DrawOrderFolderTimeline)
|
|| Std.isOfType(timeline, DrawOrderFolderTimeline)
|
||||||
|
|||||||
@ -42,7 +42,7 @@ class DrawOrderFolderTimeline extends Timeline {
|
|||||||
/** @param slots spine.Skeleton.slots indices controlled by this timeline, in setup order.
|
/** @param slots spine.Skeleton.slots indices controlled by this timeline, in setup order.
|
||||||
* @param slotCount The maximum number of slots in the skeleton. */
|
* @param slotCount The maximum number of slots in the skeleton. */
|
||||||
public function new(frameCount:Int, slots:Array<Int>, slotCount:Int) {
|
public function new(frameCount:Int, slots:Array<Int>, slotCount:Int) {
|
||||||
super(frameCount, Property.drawOrder);
|
super(frameCount, ...DrawOrderFolderTimeline.getPropertyIds(slots));
|
||||||
this.slots = slots;
|
this.slots = slots;
|
||||||
drawOrders = new Array<Array<Int>>();
|
drawOrders = new Array<Array<Int>>();
|
||||||
drawOrders.resize(frameCount);
|
drawOrders.resize(frameCount);
|
||||||
@ -54,6 +54,14 @@ class DrawOrderFolderTimeline extends Timeline {
|
|||||||
inFolder[i] = true;
|
inFolder[i] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static function getPropertyIds(slots:Array<Int>):Array<String> {
|
||||||
|
var n = slots.length;
|
||||||
|
var ids = new Array();
|
||||||
|
for (i in 0...n)
|
||||||
|
ids[i] = "d" + slots[i];
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
|
||||||
public var frameCount(get, never):Int;
|
public var frameCount(get, never):Int;
|
||||||
|
|
||||||
private function get_frameCount():Int {
|
private function get_frameCount():Int {
|
||||||
@ -82,9 +90,11 @@ class DrawOrderFolderTimeline extends Timeline {
|
|||||||
public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array<Event>, alpha:Float, blend:MixBlend, direction:MixDirection,
|
public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array<Event>, alpha:Float, blend:MixBlend, direction:MixDirection,
|
||||||
appliedPose:Bool) {
|
appliedPose:Bool) {
|
||||||
if (direction == MixDirection.mixOut) {
|
if (direction == MixDirection.mixOut) {
|
||||||
if (blend == MixBlend.setup) setupApply(skeleton);
|
if (blend == MixBlend.setup)
|
||||||
|
setupApply(skeleton);
|
||||||
} else if (time < frames[0]) {
|
} else if (time < frames[0]) {
|
||||||
if (blend == MixBlend.setup || blend == MixBlend.first) setupApply(skeleton);
|
if (blend == MixBlend.setup || blend == MixBlend.first)
|
||||||
|
setupApply(skeleton);
|
||||||
} else {
|
} else {
|
||||||
var order = drawOrders[Timeline.search1(frames, time)];
|
var order = drawOrders[Timeline.search1(frames, time)];
|
||||||
if (order == null)
|
if (order == null)
|
||||||
@ -103,7 +113,8 @@ class DrawOrderFolderTimeline extends Timeline {
|
|||||||
if (inFolder[drawOrder[i].data.index]) {
|
if (inFolder[drawOrder[i].data.index]) {
|
||||||
drawOrder[i] = allSlots[slots[found]];
|
drawOrder[i] = allSlots[slots[found]];
|
||||||
found++;
|
found++;
|
||||||
if (found == done) break;
|
if (found == done)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -118,7 +129,8 @@ class DrawOrderFolderTimeline extends Timeline {
|
|||||||
if (inFolder[drawOrder[i].data.index]) {
|
if (inFolder[drawOrder[i].data.index]) {
|
||||||
drawOrder[i] = allSlots[slots[order[found]]];
|
drawOrder[i] = allSlots[slots[order[found]]];
|
||||||
found++;
|
found++;
|
||||||
if (found == done) break;
|
if (found == done)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,6 +35,8 @@ import spine.Slot;
|
|||||||
|
|
||||||
/** Changes a skeleton's Skeleton#drawOrder. */
|
/** Changes a skeleton's Skeleton#drawOrder. */
|
||||||
class DrawOrderTimeline extends Timeline {
|
class DrawOrderTimeline extends Timeline {
|
||||||
|
public static final propertyID = Property.drawOrder;
|
||||||
|
|
||||||
/** The draw order for each frame. See setFrame(). */
|
/** The draw order for each frame. See setFrame(). */
|
||||||
public var drawOrders:Array<Array<Int>>;
|
public var drawOrders:Array<Array<Int>>;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user