diff options
author | Juan Linietsky <reduzio@gmail.com> | 2018-06-29 09:13:20 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2018-06-29 09:13:39 -0300 |
commit | 0ffec7daf762b74c7453aa22b71865e63660901c (patch) | |
tree | 5fc591fe1b15d6b4eefd47560bdfe65ad2c38415 | |
parent | b7f17a100d43af1df6ff11f2a81d1aeb170d2d69 (diff) |
Small fixes
-rw-r--r-- | scene/animation/animation_player.cpp | 18 | ||||
-rw-r--r-- | scene/animation/animation_tree.cpp | 4 | ||||
-rw-r--r-- | scene/resources/animation.cpp | 4 |
3 files changed, 21 insertions, 5 deletions
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 06aaeddf18..a4322bf713 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -419,14 +419,26 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float pa->capture = pa->object->get_indexed(pa->subpath); } - if (a->track_get_key_count(i) == 0) + int key_count = a->track_get_key_count(i); + if (key_count == 0) continue; //eeh not worth it float first_key_time = a->track_get_key_time(i, 0); + float transition = 1.0; + int first_key = 0; + + if (first_key_time == 0.0) { + //ignore, use for transition + if (key_count == 1) + continue; //with one key we cant do anything + transition = a->track_get_key_transition(i, 0); + first_key_time = a->track_get_key_time(i, 1); + first_key = 1; + } if (p_time < first_key_time) { - float c = p_time / first_key_time; - Variant first_value = a->track_get_key_value(i, 0); + float c = Math::ease(p_time / first_key_time, transition); + Variant first_value = a->track_get_key_value(i, first_key); Variant interp_value; Variant::interpolate(pa->capture, first_value, c, interp_value); diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index b1a300b225..011c4eb470 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -1287,6 +1287,10 @@ void AnimationTree::_bind_methods() { ClassDB::bind_method(D_METHOD("set_root_motion_track", "path"), &AnimationTree::set_root_motion_track); ClassDB::bind_method(D_METHOD("get_root_motion_track"), &AnimationTree::get_root_motion_track); + ClassDB::bind_method(D_METHOD("get_root_motion_transform"), &AnimationTree::get_root_motion_transform); + + + ClassDB::bind_method(D_METHOD("_node_removed"), &AnimationTree::_node_removed); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "tree_root", PROPERTY_HINT_RESOURCE_TYPE, "AnimationRootNode", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE), "set_tree_root", "get_tree_root"); diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index fe4d687c23..3185fb6768 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -134,8 +134,8 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) { int um = d["update"]; if (um < 0) um = 0; - else if (um > 2) - um = 2; + else if (um > 3) + um = 3; vt->update_mode = UpdateMode(um); } |