mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[all] Fixed AnimationState#addEmptyAnimation when the track is empty.
http://esotericsoftware.com/forum/Spine-4-change-in-behavior-with-EmptyAnimation-16176
This commit is contained in:
parent
bfce11f043
commit
8d99332f7f
@ -549,10 +549,10 @@ package spine.animation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function addEmptyAnimation(trackIndex : int, mixDuration : Number, delay : Number) : TrackEntry {
|
public function addEmptyAnimation(trackIndex : int, mixDuration : Number, delay : Number) : TrackEntry {
|
||||||
var entry : TrackEntry = addAnimation(trackIndex, emptyAnimation, false, delay <= 0 ? 1 : delay);
|
var entry : TrackEntry = addAnimation(trackIndex, emptyAnimation, false, delay);
|
||||||
|
if (delay <= 0) entry.delay += entry.mixDuration - mixDuration;
|
||||||
entry.mixDuration = mixDuration;
|
entry.mixDuration = mixDuration;
|
||||||
entry.trackEnd = mixDuration;
|
entry.trackEnd = mixDuration;
|
||||||
if (delay <= 0 && entry.previous != null) entry.delay = entry.previous.getTrackComplete() - entry.mixDuration + delay;
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -868,12 +868,10 @@ spTrackEntry *spAnimationState_setEmptyAnimation(spAnimationState *self, int tra
|
|||||||
|
|
||||||
spTrackEntry *
|
spTrackEntry *
|
||||||
spAnimationState_addEmptyAnimation(spAnimationState *self, int trackIndex, float mixDuration, float delay) {
|
spAnimationState_addEmptyAnimation(spAnimationState *self, int trackIndex, float mixDuration, float delay) {
|
||||||
spTrackEntry *entry;
|
spTrackEntry *entry = spAnimationState_addAnimation(self, trackIndex, SP_EMPTY_ANIMATION, 0, delay);
|
||||||
entry = spAnimationState_addAnimation(self, trackIndex, SP_EMPTY_ANIMATION, 0, delay <= 0 ? 1 : delay);
|
if (delay <= 0) entry->delay += entry->mixDuration - mixDuration;
|
||||||
entry->mixDuration = mixDuration;
|
entry->mixDuration = mixDuration;
|
||||||
entry->trackEnd = mixDuration;
|
entry->trackEnd = mixDuration;
|
||||||
if (delay <= 0 && entry->previous != NULL)
|
|
||||||
entry->delay = spTrackEntry_getTrackComplete(entry->previous) - entry->mixDuration + delay;
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -606,11 +606,10 @@ TrackEntry *AnimationState::setEmptyAnimation(size_t trackIndex, float mixDurati
|
|||||||
}
|
}
|
||||||
|
|
||||||
TrackEntry *AnimationState::addEmptyAnimation(size_t trackIndex, float mixDuration, float delay) {
|
TrackEntry *AnimationState::addEmptyAnimation(size_t trackIndex, float mixDuration, float delay) {
|
||||||
TrackEntry *entry = addAnimation(trackIndex, AnimationState::getEmptyAnimation(), false, delay <= 0 ? 1 : delay);
|
TrackEntry *entry = addAnimation(trackIndex, AnimationState::getEmptyAnimation(), false, delay);
|
||||||
|
if (delay <= 0) entry->_delay += entry->_mixDuration - mixDuration;
|
||||||
entry->_mixDuration = mixDuration;
|
entry->_mixDuration = mixDuration;
|
||||||
entry->_trackEnd = mixDuration;
|
entry->_trackEnd = mixDuration;
|
||||||
if (delay <= 0 && entry->_previous != NULL)
|
|
||||||
entry->_delay = entry->_previous->getTrackComplete() - entry->_mixDuration + delay;
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -769,10 +769,10 @@ namespace Spine {
|
|||||||
/// after the <see cref="AnimationState.Dispose"/> event occurs.
|
/// after the <see cref="AnimationState.Dispose"/> event occurs.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public TrackEntry AddEmptyAnimation (int trackIndex, float mixDuration, float delay) {
|
public TrackEntry AddEmptyAnimation (int trackIndex, float mixDuration, float delay) {
|
||||||
TrackEntry entry = AddAnimation(trackIndex, AnimationState.EmptyAnimation, false, delay <= 0 ? 1 : delay);
|
TrackEntry entry = AddAnimation(trackIndex, AnimationState.EmptyAnimation, false, delay);
|
||||||
|
if (delay <= 0) entry.delay += entry.mixDuration - mixDuration;
|
||||||
entry.mixDuration = mixDuration;
|
entry.mixDuration = mixDuration;
|
||||||
entry.trackEnd = mixDuration;
|
entry.trackEnd = mixDuration;
|
||||||
if (delay <= 0 && entry.previous != null) entry.delay = entry.previous.TrackComplete - entry.mixDuration + delay;
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -666,10 +666,10 @@ public class AnimationState {
|
|||||||
* @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
* @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
||||||
* after the {@link AnimationStateListener#dispose(TrackEntry)} event occurs. */
|
* after the {@link AnimationStateListener#dispose(TrackEntry)} event occurs. */
|
||||||
public TrackEntry addEmptyAnimation (int trackIndex, float mixDuration, float delay) {
|
public TrackEntry addEmptyAnimation (int trackIndex, float mixDuration, float delay) {
|
||||||
TrackEntry entry = addAnimation(trackIndex, emptyAnimation, false, delay <= 0 ? 1 : delay);
|
TrackEntry entry = addAnimation(trackIndex, emptyAnimation, false, delay);
|
||||||
|
if (delay <= 0) entry.delay += entry.mixDuration - mixDuration;
|
||||||
entry.mixDuration = mixDuration;
|
entry.mixDuration = mixDuration;
|
||||||
entry.trackEnd = mixDuration;
|
entry.trackEnd = mixDuration;
|
||||||
if (delay <= 0 && entry.previous != null) entry.delay = entry.previous.getTrackComplete() - entry.mixDuration + delay;
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -789,14 +789,12 @@ function AnimationState:setEmptyAnimation (trackIndex, mixDuration)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function AnimationState:addEmptyAnimation (trackIndex, mixDuration, delay)
|
function AnimationState:addEmptyAnimation (trackIndex, mixDuration, delay)
|
||||||
local addDelay = 1
|
local entry = self:addAnimation(trackIndex, EMPTY_ANIMATION, false, delay)
|
||||||
if delay > 0 then addDelay = delay end
|
if delay <= 0 then
|
||||||
local entry = self:addAnimation(trackIndex, EMPTY_ANIMATION, false, addDelay)
|
entry.delay = entry.delay + entry.mixDuration - mixDuration
|
||||||
|
end
|
||||||
entry.mixDuration = mixDuration
|
entry.mixDuration = mixDuration
|
||||||
entry.trackEnd = mixDuration
|
entry.trackEnd = mixDuration
|
||||||
if delay <= 0 and entry.previous then
|
|
||||||
entry.delay = entry.previous:getTrackComplete() - entry.mixDuration + delay
|
|
||||||
end
|
|
||||||
return entry
|
return entry
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -609,10 +609,10 @@ module spine {
|
|||||||
* @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
* @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
||||||
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
||||||
addEmptyAnimation (trackIndex: number, mixDuration: number = 0, delay: number = 0) {
|
addEmptyAnimation (trackIndex: number, mixDuration: number = 0, delay: number = 0) {
|
||||||
let entry = this.addAnimationWith(trackIndex, AnimationState.emptyAnimation(), false, delay <= 0 ? 1 : delay);
|
let entry = this.addAnimationWith(trackIndex, AnimationState.emptyAnimation(), false, delay);
|
||||||
|
if (delay <= 0) entry.delay += entry.mixDuration - mixDuration;
|
||||||
entry.mixDuration = mixDuration;
|
entry.mixDuration = mixDuration;
|
||||||
entry.trackEnd = mixDuration;
|
entry.trackEnd = mixDuration;
|
||||||
if (delay <= 0 && entry.previous) entry.delay = entry.previous.getTrackComplete() - entry.mixDuration + delay;
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user