diff options
Diffstat (limited to 'scene/animation/animation_blend_tree.cpp')
-rw-r--r-- | scene/animation/animation_blend_tree.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp index b85d4e541e..5b413737a9 100644 --- a/scene/animation/animation_blend_tree.cpp +++ b/scene/animation/animation_blend_tree.cpp @@ -40,12 +40,11 @@ StringName AnimationNodeAnimation::get_animation() const { return animation; } -float AnimationNodeAnimation::get_playback_time() const { - return time; -} - Vector<String> (*AnimationNodeAnimation::get_editable_animation_list)() = NULL; +void AnimationNodeAnimation::get_parameter_list(List<PropertyInfo> *r_list) const { + r_list->push_back(PropertyInfo(Variant::REAL, time, PROPERTY_HINT_NONE, "", 0)); +} void AnimationNodeAnimation::_validate_property(PropertyInfo &property) const { if (property.name == "animation" && get_editable_animation_list) { @@ -70,6 +69,8 @@ float AnimationNodeAnimation::process(float p_time, bool p_seek) { AnimationPlayer *ap = state->player; ERR_FAIL_COND_V(!ap, 0); + float time = get_parameter(this->time); + if (!ap->has_animation(animation)) { AnimationNodeBlendTree *tree = Object::cast_to<AnimationNodeBlendTree>(parent); @@ -86,6 +87,8 @@ float AnimationNodeAnimation::process(float p_time, bool p_seek) { Ref<Animation> anim = ap->get_animation(animation); + float step; + if (p_seek) { time = p_time; step = 0; @@ -109,6 +112,8 @@ float AnimationNodeAnimation::process(float p_time, bool p_seek) { blend_animation(animation, time, step, p_seek, 1.0); + set_parameter(this->time, time); + return anim_size - time; } @@ -120,16 +125,13 @@ void AnimationNodeAnimation::_bind_methods() { ClassDB::bind_method(D_METHOD("set_animation", "name"), &AnimationNodeAnimation::set_animation); ClassDB::bind_method(D_METHOD("get_animation"), &AnimationNodeAnimation::get_animation); - ClassDB::bind_method(D_METHOD("get_playback_time"), &AnimationNodeAnimation::get_playback_time); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "animation"), "set_animation", "get_animation"); } AnimationNodeAnimation::AnimationNodeAnimation() { last_version = 0; skip = false; - time = 0; - step = 0; + time = "time"; } //////////////////////////////////////////////////////// @@ -266,7 +268,6 @@ float AnimationNodeOneShot::process(float p_time, bool p_seek) { if (do_start) { remaining = os_rem; - do_start = false; } if (!p_seek) { @@ -699,7 +700,7 @@ String AnimationNodeTransition::get_input_caption(int p_input) const { if (tree.is_valid() && current >= 0) { prev = current; - prev_xfading = xfade; + prev_xfading = xfade; time = 0; current = p_current; switched = true; @@ -770,8 +771,6 @@ float AnimationNodeTransition::process(float p_time, bool p_seek) { rem = blend_input(current, p_time, p_seek, 1.0 - blend, FILTER_IGNORE, false); } - switched = false; - if (p_seek) { // don't seek prev animation blend_input(prev, 0, false, blend, FILTER_IGNORE, false); time = p_time; |