mirror of
https://github.com/godotengine/godot.git
synced 2024-11-23 04:33:29 +00:00
Merge pull request #12107 from RandomShaper/fix-anim-before-first-key
Fix animation before first key
This commit is contained in:
commit
08ebbc90a8
@ -405,6 +405,10 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
|
||||
if (a->value_track_get_update_mode(i) == Animation::UPDATE_CONTINUOUS || (p_delta == 0 && a->value_track_get_update_mode(i) == Animation::UPDATE_DISCRETE)) { //delta == 0 means seek
|
||||
|
||||
Variant value = a->value_track_interpolate(i, p_time);
|
||||
|
||||
if (value == Variant())
|
||||
continue;
|
||||
|
||||
//thanks to trigger mode, this should be solved now..
|
||||
/*
|
||||
if (p_delta==0 && value.get_type()==Variant::STRING)
|
||||
|
@ -1171,9 +1171,7 @@ T Animation::_interpolate(const Vector<TKey<T> > &p_keys, float p_time, Interpol
|
||||
|
||||
ERR_FAIL_COND_V(idx == -2, T());
|
||||
|
||||
if (p_ok)
|
||||
*p_ok = true;
|
||||
|
||||
bool result = true;
|
||||
int next = 0;
|
||||
float c = 0;
|
||||
// prepare for all cases of interpolation
|
||||
@ -1243,10 +1241,19 @@ T Animation::_interpolate(const Vector<TKey<T> > &p_keys, float p_time, Interpol
|
||||
|
||||
} else if (idx < 0) {
|
||||
|
||||
idx = next = 0;
|
||||
// only allow extending first key to anim start if looping
|
||||
if (loop)
|
||||
idx = next = 0;
|
||||
else
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (p_ok)
|
||||
*p_ok = result;
|
||||
if (!result)
|
||||
return T();
|
||||
|
||||
float tr = p_keys[idx].transition;
|
||||
|
||||
if (tr == 0 || idx == next) {
|
||||
@ -1298,7 +1305,7 @@ Error Animation::transform_track_interpolate(int p_track, float p_time, Vector3
|
||||
|
||||
TransformKey tk = _interpolate(tt->transforms, p_time, tt->interpolation, tt->loop_wrap, &ok);
|
||||
|
||||
if (!ok) // ??
|
||||
if (!ok)
|
||||
return ERR_UNAVAILABLE;
|
||||
|
||||
if (r_loc)
|
||||
|
Loading…
Reference in New Issue
Block a user