Merge branch '3.7' into 3.8-beta

This commit is contained in:
badlogic 2019-04-04 14:58:35 +02:00
commit 2a1b39ee59
25 changed files with 42 additions and 37 deletions

View File

@ -177,7 +177,7 @@ package spine.animation {
var timelineCount : int = current.animation.timelines.length; var timelineCount : int = current.animation.timelines.length;
var timelines : Vector.<Timeline> = current.animation.timelines; var timelines : Vector.<Timeline> = current.animation.timelines;
var ii : int = 0; 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++) for (ii = 0; ii < timelineCount; ii++)
Timeline(timelines[ii]).apply(skeleton, animationLast, animationTime, events, mix, blend, MixDirection.In); Timeline(timelines[ii]).apply(skeleton, animationLast, animationTime, events, mix, blend, MixDirection.In);
} else { } else {

View File

@ -379,7 +379,7 @@ int spAnimationState_apply (spAnimationState* self, spSkeleton* skeleton) {
animationLast = current->animationLast; animationTime = spTrackEntry_getAnimationTime(current); animationLast = current->animationLast; animationTime = spTrackEntry_getAnimationTime(current);
timelineCount = current->animation->timelinesCount; timelineCount = current->animation->timelinesCount;
timelines = current->animation->timelines; 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++) for (ii = 0; ii < timelineCount; ii++)
spTimeline_apply(timelines[ii], skeleton, animationLast, animationTime, internal->events, &internal->eventsCount, mix, blend, SP_MIX_DIRECTION_IN); spTimeline_apply(timelines[ii], skeleton, animationLast, animationTime, internal->events, &internal->eventsCount, mix, blend, SP_MIX_DIRECTION_IN);
} else { } else {

View File

@ -420,7 +420,7 @@ bool AnimationState::apply(Skeleton &skeleton) {
float animationLast = current._animationLast, animationTime = current.getAnimationTime(); float animationLast = current._animationLast, animationTime = current.getAnimationTime();
size_t timelineCount = current._animation->_timelines.size(); size_t timelineCount = current._animation->_timelines.size();
Vector<Timeline *> &timelines = current._animation->_timelines; 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) { for (size_t ii = 0; ii < timelineCount; ++ii) {
timelines[ii]->apply(skeleton, animationLast, animationTime, &_events, mix, blend, timelines[ii]->apply(skeleton, animationLast, animationTime, &_events, mix, blend,
MixDirection_In); MixDirection_In);

View File

@ -228,7 +228,7 @@ namespace Spine {
int timelineCount = current.animation.timelines.Count; int timelineCount = current.animation.timelines.Count;
var timelines = current.animation.timelines; var timelines = current.animation.timelines;
var timelinesItems = timelines.Items; 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++) for (int ii = 0; ii < timelineCount; ii++)
timelinesItems[ii].Apply(skeleton, animationLast, animationTime, events, mix, blend, MixDirection.In); timelinesItems[ii].Apply(skeleton, animationLast, animationTime, events, mix, blend, MixDirection.In);
} else { } else {

View File

@ -224,7 +224,7 @@ public class AnimationState {
float animationLast = current.animationLast, animationTime = current.getAnimationTime(); float animationLast = current.animationLast, animationTime = current.getAnimationTime();
int timelineCount = current.animation.timelines.size; int timelineCount = current.animation.timelines.size;
Object[] timelines = current.animation.timelines.items; 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++) for (int ii = 0; ii < timelineCount; ii++)
((Timeline)timelines[ii]).apply(skeleton, animationLast, animationTime, events, mix, blend, MixDirection.in); ((Timeline)timelines[ii]).apply(skeleton, animationLast, animationTime, events, mix, blend, MixDirection.in);
} else { } else {
@ -238,8 +238,8 @@ public class AnimationState {
Timeline timeline = (Timeline)timelines[ii]; Timeline timeline = (Timeline)timelines[ii];
MixBlend timelineBlend = (timelineMode[ii] & NOT_LAST - 1) == SUBSEQUENT ? blend : MixBlend.setup; MixBlend timelineBlend = (timelineMode[ii] & NOT_LAST - 1) == SUBSEQUENT ? blend : MixBlend.setup;
if (timeline instanceof RotateTimeline) { if (timeline instanceof RotateTimeline) {
applyRotateTimeline(timeline, skeleton, animationTime, mix, timelineBlend, timelinesRotation, ii << 1, applyRotateTimeline((RotateTimeline)timeline, skeleton, animationTime, mix, timelineBlend, timelinesRotation,
firstFrame); ii << 1, firstFrame);
} else } else
timeline.apply(skeleton, animationLast, animationTime, events, mix, timelineBlend, MixDirection.in); timeline.apply(skeleton, animationLast, animationTime, events, mix, timelineBlend, MixDirection.in);
} }
@ -315,8 +315,8 @@ public class AnimationState {
} }
from.totalAlpha += alpha; from.totalAlpha += alpha;
if (timeline instanceof RotateTimeline) { if (timeline instanceof RotateTimeline) {
applyRotateTimeline(timeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation, i << 1, applyRotateTimeline((RotateTimeline)timeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation,
firstFrame); i << 1, firstFrame);
} else { } else {
if (timelineBlend == MixBlend.setup) { if (timelineBlend == MixBlend.setup) {
if (timeline instanceof AttachmentTimeline) { if (timeline instanceof AttachmentTimeline) {
@ -338,7 +338,7 @@ public class AnimationState {
return mix; 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) { float[] timelinesRotation, int i, boolean firstFrame) {
if (firstFrame) timelinesRotation[i] = 0; if (firstFrame) timelinesRotation[i] = 0;
@ -348,9 +348,8 @@ public class AnimationState {
return; return;
} }
RotateTimeline rotateTimeline = (RotateTimeline)timeline; Bone bone = skeleton.bones.get(timeline.boneIndex);
Bone bone = skeleton.bones.get(rotateTimeline.boneIndex); float[] frames = timeline.frames;
float[] frames = rotateTimeline.frames;
float r1, r2; float r1, r2;
if (time < frames[0]) { // Time is before first frame. if (time < frames[0]) { // Time is before first frame.
switch (blend) { switch (blend) {
@ -372,7 +371,7 @@ public class AnimationState {
int frame = Animation.binarySearch(frames, time, ENTRIES); int frame = Animation.binarySearch(frames, time, ENTRIES);
float prevRotation = frames[frame + PREV_ROTATION]; float prevRotation = frames[frame + PREV_ROTATION];
float frameTime = frames[frame]; 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)); 1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
r2 = frames[frame + ROTATION] - prevRotation; r2 = frames[frame + ROTATION] - prevRotation;

View File

@ -101,6 +101,12 @@ public class Skin {
if (entry.key.slotIndex == slotIndex) attachments.add(entry.value); 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 () { public void clear () {
for (Key key : attachments.keys()) for (Key key : attachments.keys())
keyPool.free(key); keyPool.free(key);

View File

@ -347,7 +347,7 @@ function AnimationState:apply (skeleton)
local animationLast = current.animationLast local animationLast = current.animationLast
local animationTime = current:getAnimationTime() local animationTime = current:getAnimationTime()
local timelines = current.animation.timelines 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 for i,timeline in ipairs(timelines) do
timeline:apply(skeleton, animationLast, animationTime, events, mix, blend, MixDirection._in) timeline:apply(skeleton, animationLast, animationTime, events, mix, blend, MixDirection._in)
end end

View File

@ -384,7 +384,6 @@ void owl (SkeletonData* skeletonData, Atlas* atlas) {
spTrackEntry* down = AnimationState_setAnimationByName(drawable->state, 5, "down", true); spTrackEntry* down = AnimationState_setAnimationByName(drawable->state, 5, "down", true);
left->alpha = 0; left->alpha = 0;
left->mixBlend = SP_MIX_BLEND_ADD;
right->alpha = 0; right->alpha = 0;
right->mixBlend = SP_MIX_BLEND_ADD; right->mixBlend = SP_MIX_BLEND_ADD;
up->alpha = 0; up->alpha = 0;

View File

@ -399,11 +399,11 @@ void owl (SkeletonData* skeletonData, Atlas* atlas) {
skeleton->updateWorldTransform(); skeleton->updateWorldTransform();
drawable.state->setAnimation(0, "idle", true); drawable.state->setAnimation(0, "idle", true);
drawable.state->setAnimation(1, "blink", true);
TrackEntry* left = drawable.state->setAnimation(2, "left", true); TrackEntry* left = drawable.state->setAnimation(1, "left", true);
TrackEntry* right = drawable.state->setAnimation(3, "right", true); TrackEntry* right = drawable.state->setAnimation(2, "right", true);
TrackEntry* up = drawable.state->setAnimation(4, "up", true); TrackEntry* up = drawable.state->setAnimation(3, "up", true);
TrackEntry* down = drawable.state->setAnimation(5, "down", true); TrackEntry* down = drawable.state->setAnimation(4, "down", true);
left->setAlpha(0); left->setAlpha(0);
left->setMixBlend(MixBlend_Add); left->setMixBlend(MixBlend_Add);
@ -414,6 +414,8 @@ void owl (SkeletonData* skeletonData, Atlas* atlas) {
down->setAlpha(0); down->setAlpha(0);
down->setMixBlend(MixBlend_Add); down->setMixBlend(MixBlend_Add);
// drawable.state->setAnimation(5, "blink", true);
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - owl"); sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - owl");
window.setFramerateLimit(60); window.setFramerateLimit(60);
sf::Event event; sf::Event event;
@ -465,12 +467,11 @@ int main () {
DebugExtension dbgExtension(SpineExtension::getInstance()); DebugExtension dbgExtension(SpineExtension::getInstance());
SpineExtension::setInstance(&dbgExtension); 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(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(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(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(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(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(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); testcase(raptor, "data/raptor-pro.json", "data/raptor-pro.skel", "data/raptor-pma.atlas", 0.5f);

View File

@ -1403,7 +1403,7 @@ var spine;
var animationLast = current.animationLast, animationTime = current.getAnimationTime(); var animationLast = current.animationLast, animationTime = current.getAnimationTime();
var timelineCount = current.animation.timelines.length; var timelineCount = current.animation.timelines.length;
var timelines = current.animation.timelines; 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++) for (var ii = 0; ii < timelineCount; ii++)
timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, spine.MixDirection["in"]); timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, spine.MixDirection["in"]);
} }

File diff suppressed because one or more lines are too long

View File

@ -1403,7 +1403,7 @@ var spine;
var animationLast = current.animationLast, animationTime = current.getAnimationTime(); var animationLast = current.animationLast, animationTime = current.getAnimationTime();
var timelineCount = current.animation.timelines.length; var timelineCount = current.animation.timelines.length;
var timelines = current.animation.timelines; 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++) for (var ii = 0; ii < timelineCount; ii++)
timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, spine.MixDirection["in"]); timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, spine.MixDirection["in"]);
} }

File diff suppressed because one or more lines are too long

View File

@ -1403,7 +1403,7 @@ var spine;
var animationLast = current.animationLast, animationTime = current.getAnimationTime(); var animationLast = current.animationLast, animationTime = current.getAnimationTime();
var timelineCount = current.animation.timelines.length; var timelineCount = current.animation.timelines.length;
var timelines = current.animation.timelines; 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++) for (var ii = 0; ii < timelineCount; ii++)
timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, spine.MixDirection["in"]); timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, spine.MixDirection["in"]);
} }

File diff suppressed because one or more lines are too long

View File

@ -1403,7 +1403,7 @@ var spine;
var animationLast = current.animationLast, animationTime = current.getAnimationTime(); var animationLast = current.animationLast, animationTime = current.getAnimationTime();
var timelineCount = current.animation.timelines.length; var timelineCount = current.animation.timelines.length;
var timelines = current.animation.timelines; 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++) for (var ii = 0; ii < timelineCount; ii++)
timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, spine.MixDirection["in"]); timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, spine.MixDirection["in"]);
} }

File diff suppressed because one or more lines are too long

View File

@ -1403,7 +1403,7 @@ var spine;
var animationLast = current.animationLast, animationTime = current.getAnimationTime(); var animationLast = current.animationLast, animationTime = current.getAnimationTime();
var timelineCount = current.animation.timelines.length; var timelineCount = current.animation.timelines.length;
var timelines = current.animation.timelines; 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++) for (var ii = 0; ii < timelineCount; ii++)
timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, spine.MixDirection["in"]); timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, spine.MixDirection["in"]);
} }

File diff suppressed because one or more lines are too long

View File

@ -1403,7 +1403,7 @@ var spine;
var animationLast = current.animationLast, animationTime = current.getAnimationTime(); var animationLast = current.animationLast, animationTime = current.getAnimationTime();
var timelineCount = current.animation.timelines.length; var timelineCount = current.animation.timelines.length;
var timelines = current.animation.timelines; 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++) for (var ii = 0; ii < timelineCount; ii++)
timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, spine.MixDirection["in"]); timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, spine.MixDirection["in"]);
} }

File diff suppressed because one or more lines are too long

View File

@ -160,7 +160,7 @@ module spine {
let animationLast = current.animationLast, animationTime = current.getAnimationTime(); let animationLast = current.animationLast, animationTime = current.getAnimationTime();
let timelineCount = current.animation.timelines.length; let timelineCount = current.animation.timelines.length;
let timelines = current.animation.timelines; 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++) for (let ii = 0; ii < timelineCount; ii++)
timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, MixDirection.in); timelines[ii].apply(skeleton, animationLast, animationTime, events, mix, blend, MixDirection.in);
} else { } else {