mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
Merge branch '3.7' into 3.8-beta
This commit is contained in:
commit
2a1b39ee59
Binary file not shown.
@ -177,7 +177,7 @@ package spine.animation {
|
||||
var timelineCount : int = current.animation.timelines.length;
|
||||
var timelines : Vector.<Timeline> = current.animation.timelines;
|
||||
var ii : int = 0;
|
||||
if (i == 0 && (mix == 1 || blend == MixBlend.add)) {
|
||||
if ((i == 0 && mix == 1) || blend == MixBlend.add) {
|
||||
for (ii = 0; ii < timelineCount; ii++)
|
||||
Timeline(timelines[ii]).apply(skeleton, animationLast, animationTime, events, mix, blend, MixDirection.In);
|
||||
} else {
|
||||
|
||||
@ -379,7 +379,7 @@ int spAnimationState_apply (spAnimationState* self, spSkeleton* skeleton) {
|
||||
animationLast = current->animationLast; animationTime = spTrackEntry_getAnimationTime(current);
|
||||
timelineCount = current->animation->timelinesCount;
|
||||
timelines = current->animation->timelines;
|
||||
if (i == 0 && (mix == 1 || blend == SP_MIX_BLEND_ADD)) {
|
||||
if ((i == 0 && mix == 1) || blend == SP_MIX_BLEND_ADD) {
|
||||
for (ii = 0; ii < timelineCount; ii++)
|
||||
spTimeline_apply(timelines[ii], skeleton, animationLast, animationTime, internal->events, &internal->eventsCount, mix, blend, SP_MIX_DIRECTION_IN);
|
||||
} else {
|
||||
|
||||
@ -420,7 +420,7 @@ bool AnimationState::apply(Skeleton &skeleton) {
|
||||
float animationLast = current._animationLast, animationTime = current.getAnimationTime();
|
||||
size_t timelineCount = current._animation->_timelines.size();
|
||||
Vector<Timeline *> &timelines = current._animation->_timelines;
|
||||
if (i == 0 && (mix == 1 || blend == MixBlend_Add)) {
|
||||
if ((i == 0 && mix == 1) || blend == MixBlend_Add) {
|
||||
for (size_t ii = 0; ii < timelineCount; ++ii) {
|
||||
timelines[ii]->apply(skeleton, animationLast, animationTime, &_events, mix, blend,
|
||||
MixDirection_In);
|
||||
|
||||
@ -77,7 +77,7 @@ namespace Spine {
|
||||
protected AnimationStateData data;
|
||||
private readonly ExposedList<TrackEntry> tracks = new ExposedList<TrackEntry>();
|
||||
private readonly ExposedList<Event> events = new ExposedList<Event>();
|
||||
|
||||
|
||||
// difference to libgdx reference: delegates are used for event callbacks instead of 'Array<AnimationStateListener> listeners'.
|
||||
internal void OnStart (TrackEntry entry) { if (Start != null) Start(entry); }
|
||||
internal void OnInterrupt (TrackEntry entry) { if (Interrupt != null) Interrupt(entry); }
|
||||
@ -228,7 +228,7 @@ namespace Spine {
|
||||
int timelineCount = current.animation.timelines.Count;
|
||||
var timelines = current.animation.timelines;
|
||||
var timelinesItems = timelines.Items;
|
||||
if (i == 0 && (mix == 1 || blend == MixBlend.Add)) {
|
||||
if ((i == 0 && mix == 1) || blend == MixBlend.Add) {
|
||||
for (int ii = 0; ii < timelineCount; ii++)
|
||||
timelinesItems[ii].Apply(skeleton, animationLast, animationTime, events, mix, blend, MixDirection.In);
|
||||
} else {
|
||||
|
||||
@ -224,7 +224,7 @@ public class AnimationState {
|
||||
float animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||
int timelineCount = current.animation.timelines.size;
|
||||
Object[] timelines = current.animation.timelines.items;
|
||||
if (i == 0 && (mix == 1 || blend == MixBlend.add)) {
|
||||
if ((i == 0 && mix == 1) || blend == MixBlend.add) {
|
||||
for (int ii = 0; ii < timelineCount; ii++)
|
||||
((Timeline)timelines[ii]).apply(skeleton, animationLast, animationTime, events, mix, blend, MixDirection.in);
|
||||
} else {
|
||||
@ -238,8 +238,8 @@ public class AnimationState {
|
||||
Timeline timeline = (Timeline)timelines[ii];
|
||||
MixBlend timelineBlend = (timelineMode[ii] & NOT_LAST - 1) == SUBSEQUENT ? blend : MixBlend.setup;
|
||||
if (timeline instanceof RotateTimeline) {
|
||||
applyRotateTimeline(timeline, skeleton, animationTime, mix, timelineBlend, timelinesRotation, ii << 1,
|
||||
firstFrame);
|
||||
applyRotateTimeline((RotateTimeline)timeline, skeleton, animationTime, mix, timelineBlend, timelinesRotation,
|
||||
ii << 1, firstFrame);
|
||||
} else
|
||||
timeline.apply(skeleton, animationLast, animationTime, events, mix, timelineBlend, MixDirection.in);
|
||||
}
|
||||
@ -315,8 +315,8 @@ public class AnimationState {
|
||||
}
|
||||
from.totalAlpha += alpha;
|
||||
if (timeline instanceof RotateTimeline) {
|
||||
applyRotateTimeline(timeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation, i << 1,
|
||||
firstFrame);
|
||||
applyRotateTimeline((RotateTimeline)timeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation,
|
||||
i << 1, firstFrame);
|
||||
} else {
|
||||
if (timelineBlend == MixBlend.setup) {
|
||||
if (timeline instanceof AttachmentTimeline) {
|
||||
@ -338,7 +338,7 @@ public class AnimationState {
|
||||
return mix;
|
||||
}
|
||||
|
||||
private void applyRotateTimeline (Timeline timeline, Skeleton skeleton, float time, float alpha, MixBlend blend,
|
||||
private void applyRotateTimeline (RotateTimeline timeline, Skeleton skeleton, float time, float alpha, MixBlend blend,
|
||||
float[] timelinesRotation, int i, boolean firstFrame) {
|
||||
|
||||
if (firstFrame) timelinesRotation[i] = 0;
|
||||
@ -348,9 +348,8 @@ public class AnimationState {
|
||||
return;
|
||||
}
|
||||
|
||||
RotateTimeline rotateTimeline = (RotateTimeline)timeline;
|
||||
Bone bone = skeleton.bones.get(rotateTimeline.boneIndex);
|
||||
float[] frames = rotateTimeline.frames;
|
||||
Bone bone = skeleton.bones.get(timeline.boneIndex);
|
||||
float[] frames = timeline.frames;
|
||||
float r1, r2;
|
||||
if (time < frames[0]) { // Time is before first frame.
|
||||
switch (blend) {
|
||||
@ -372,7 +371,7 @@ public class AnimationState {
|
||||
int frame = Animation.binarySearch(frames, time, ENTRIES);
|
||||
float prevRotation = frames[frame + PREV_ROTATION];
|
||||
float frameTime = frames[frame];
|
||||
float percent = rotateTimeline.getCurvePercent((frame >> 1) - 1,
|
||||
float percent = timeline.getCurvePercent((frame >> 1) - 1,
|
||||
1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
r2 = frames[frame + ROTATION] - prevRotation;
|
||||
|
||||
@ -101,6 +101,12 @@ public class Skin {
|
||||
if (entry.key.slotIndex == slotIndex) attachments.add(entry.value);
|
||||
}
|
||||
|
||||
public void getAttachments (Array<Attachment> attachments) {
|
||||
if (attachments == null) throw new IllegalArgumentException("attachments cannot be null.");
|
||||
for (Attachment attachment : this.attachments.values())
|
||||
attachments.add(attachment);
|
||||
}
|
||||
|
||||
public void clear () {
|
||||
for (Key key : attachments.keys())
|
||||
keyPool.free(key);
|
||||
|
||||
@ -347,7 +347,7 @@ function AnimationState:apply (skeleton)
|
||||
local animationLast = current.animationLast
|
||||
local animationTime = current:getAnimationTime()
|
||||
local timelines = current.animation.timelines
|
||||
if i == 0 and (mix == 1 or blend == MixBlend.add) then
|
||||
if (i == 0 and mix == 1) or blend == MixBlend.add then
|
||||
for i,timeline in ipairs(timelines) do
|
||||
timeline:apply(skeleton, animationLast, animationTime, events, mix, blend, MixDirection._in)
|
||||
end
|
||||
|
||||
@ -384,7 +384,6 @@ void owl (SkeletonData* skeletonData, Atlas* atlas) {
|
||||
spTrackEntry* down = AnimationState_setAnimationByName(drawable->state, 5, "down", true);
|
||||
|
||||
left->alpha = 0;
|
||||
left->mixBlend = SP_MIX_BLEND_ADD;
|
||||
right->alpha = 0;
|
||||
right->mixBlend = SP_MIX_BLEND_ADD;
|
||||
up->alpha = 0;
|
||||
|
||||
@ -399,11 +399,11 @@ void owl (SkeletonData* skeletonData, Atlas* atlas) {
|
||||
skeleton->updateWorldTransform();
|
||||
|
||||
drawable.state->setAnimation(0, "idle", true);
|
||||
drawable.state->setAnimation(1, "blink", true);
|
||||
TrackEntry* left = drawable.state->setAnimation(2, "left", true);
|
||||
TrackEntry* right = drawable.state->setAnimation(3, "right", true);
|
||||
TrackEntry* up = drawable.state->setAnimation(4, "up", true);
|
||||
TrackEntry* down = drawable.state->setAnimation(5, "down", true);
|
||||
|
||||
TrackEntry* left = drawable.state->setAnimation(1, "left", true);
|
||||
TrackEntry* right = drawable.state->setAnimation(2, "right", true);
|
||||
TrackEntry* up = drawable.state->setAnimation(3, "up", true);
|
||||
TrackEntry* down = drawable.state->setAnimation(4, "down", true);
|
||||
|
||||
left->setAlpha(0);
|
||||
left->setMixBlend(MixBlend_Add);
|
||||
@ -414,6 +414,8 @@ void owl (SkeletonData* skeletonData, Atlas* atlas) {
|
||||
down->setAlpha(0);
|
||||
down->setMixBlend(MixBlend_Add);
|
||||
|
||||
// drawable.state->setAnimation(5, "blink", true);
|
||||
|
||||
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - owl");
|
||||
window.setFramerateLimit(60);
|
||||
sf::Event event;
|
||||
@ -465,12 +467,11 @@ int main () {
|
||||
DebugExtension dbgExtension(SpineExtension::getInstance());
|
||||
SpineExtension::setInstance(&dbgExtension);
|
||||
|
||||
testcase(owl, "data/owl-pro.json", "data/owl-pro.skel", "data/owl-pma.atlas", 0.5f);
|
||||
testcase(spineboy, "data/spineboy-pro.json", "data/spineboy-pro.skel", "data/spineboy-pma.atlas", 0.6f);
|
||||
testcase(stretchymanStrechyIk, "data/stretchyman-stretchy-ik-pro.json", "data/stretchyman-stretchy-ik-pro.skel", "data/stretchyman-pma.atlas", 0.6f);
|
||||
testcase(spineboy, "data/spineboy-pro.json", "data/spineboy-pro.skel", "data/spineboy-pma.atlas", 0.6f);
|
||||
testcase(raptor, "data/raptor-pro.json", "data/raptor-pro.skel", "data/raptor-pma.atlas", 0.5f);
|
||||
testcase(coin, "data/coin-pro.json", "data/coin-pro.skel", "data/coin-pma.atlas", 0.5f);
|
||||
testcase(owl, "data/owl-pro.json", "data/owl-pro.skel", "data/owl-pma.atlas", 0.5f);
|
||||
testcase(vine, "data/vine-pro.json", "data/vine-pro.skel", "data/vine-pma.atlas", 0.5f);
|
||||
testcase(tank, "data/tank-pro.json", "data/tank-pro.skel", "data/tank-pma.atlas", 0.2f);
|
||||
testcase(raptor, "data/raptor-pro.json", "data/raptor-pro.skel", "data/raptor-pma.atlas", 0.5f);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -1403,7 +1403,7 @@ var spine;
|
||||
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||
var timelineCount = current.animation.timelines.length;
|
||||
var timelines = current.animation.timelines;
|
||||
if (i == 0 && (mix == 1 || blend == spine.MixBlend.add)) {
|
||||
if ((i == 0 && mix == 1) || blend == spine.MixBlend.add) {
|
||||
for (var ii = 0; ii < timelineCount; ii++)
|
||||
timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, spine.MixDirection["in"]);
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1403,7 +1403,7 @@ var spine;
|
||||
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||
var timelineCount = current.animation.timelines.length;
|
||||
var timelines = current.animation.timelines;
|
||||
if (i == 0 && (mix == 1 || blend == spine.MixBlend.add)) {
|
||||
if ((i == 0 && mix == 1) || blend == spine.MixBlend.add) {
|
||||
for (var ii = 0; ii < timelineCount; ii++)
|
||||
timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, spine.MixDirection["in"]);
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1403,7 +1403,7 @@ var spine;
|
||||
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||
var timelineCount = current.animation.timelines.length;
|
||||
var timelines = current.animation.timelines;
|
||||
if (i == 0 && (mix == 1 || blend == spine.MixBlend.add)) {
|
||||
if ((i == 0 && mix == 1) || blend == spine.MixBlend.add) {
|
||||
for (var ii = 0; ii < timelineCount; ii++)
|
||||
timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, spine.MixDirection["in"]);
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1403,7 +1403,7 @@ var spine;
|
||||
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||
var timelineCount = current.animation.timelines.length;
|
||||
var timelines = current.animation.timelines;
|
||||
if (i == 0 && (mix == 1 || blend == spine.MixBlend.add)) {
|
||||
if ((i == 0 && mix == 1) || blend == spine.MixBlend.add) {
|
||||
for (var ii = 0; ii < timelineCount; ii++)
|
||||
timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, spine.MixDirection["in"]);
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1403,7 +1403,7 @@ var spine;
|
||||
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||
var timelineCount = current.animation.timelines.length;
|
||||
var timelines = current.animation.timelines;
|
||||
if (i == 0 && (mix == 1 || blend == spine.MixBlend.add)) {
|
||||
if ((i == 0 && mix == 1) || blend == spine.MixBlend.add) {
|
||||
for (var ii = 0; ii < timelineCount; ii++)
|
||||
timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, spine.MixDirection["in"]);
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1403,7 +1403,7 @@ var spine;
|
||||
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||
var timelineCount = current.animation.timelines.length;
|
||||
var timelines = current.animation.timelines;
|
||||
if (i == 0 && (mix == 1 || blend == spine.MixBlend.add)) {
|
||||
if ((i == 0 && mix == 1) || blend == spine.MixBlend.add) {
|
||||
for (var ii = 0; ii < timelineCount; ii++)
|
||||
timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, spine.MixDirection["in"]);
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -160,7 +160,7 @@ module spine {
|
||||
let animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||
let timelineCount = current.animation.timelines.length;
|
||||
let timelines = current.animation.timelines;
|
||||
if (i == 0 && (mix == 1 || blend == MixBlend.add)) {
|
||||
if ((i == 0 && mix == 1) || blend == MixBlend.add) {
|
||||
for (let ii = 0; ii < timelineCount; ii++)
|
||||
timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, MixDirection.in);
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user