diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-01-02 19:12:25 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-01-02 19:12:25 -0300 |
commit | ce26eb74bca48f16e9a34b4eb1c34e50dfc5daae (patch) | |
tree | 5f9c387037d0142d40f7275575436483dc0a7237 /scene/animation/animation_tree_player.cpp | |
parent | ab4126f51061277e87b41c48b40e7b54942d4eca (diff) | |
parent | 45c5c89de961357a7042d9e1f063e288d7a510cf (diff) |
Merge branch 'master' of https://github.com/godotengine/godot
Diffstat (limited to 'scene/animation/animation_tree_player.cpp')
-rw-r--r-- | scene/animation/animation_tree_player.cpp | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp index 9488ae37a8..de14daa570 100644 --- a/scene/animation/animation_tree_player.cpp +++ b/scene/animation/animation_tree_player.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -494,15 +494,8 @@ float AnimationTreePlayer::_process_node(const StringName& p_node,AnimationNode case NODE_OUTPUT: { NodeOut *on = static_cast<NodeOut*>(nb); - - for(TrackMap::Element *E=track_map.front();E;E=E->next()) { - E->get().total_weight = 0; - } - HashMap<NodePath, float> weights; - - return _process_node(on->inputs[0].node,r_prev_anim,p_time,p_seek, p_fallback_weight, &weights); } break; @@ -544,15 +537,12 @@ float AnimationTreePlayer::_process_node(const StringName& p_node,AnimationNode NodePath track_path = an->animation->track_get_path(E->get().local_track); if (an->filter.has(track_path) && an->filter[track_path]) { E->get().weight = 0; - E->get().track->total_weight += p_fallback_weight; } else { if (p_weights->has(track_path)) { float weight = (*p_weights)[track_path]; E->get().weight = weight; - E->get().track->total_weight += weight; } else { E->get().weight = p_fallback_weight; - E->get().track->total_weight += p_fallback_weight; } } if (E->get().weight>CMP_EPSILON) @@ -875,8 +865,6 @@ void AnimationTreePlayer::_process_animation(float p_delta) { if (tr.track==NULL || tr.local_track<0 || tr.weight < CMP_EPSILON) continue; - float blend=tr.weight / tr.track->total_weight; - switch(a->track_get_type(tr.local_track)) { case Animation::TYPE_TRANSFORM: { ///< Transform a node or a bone. @@ -885,14 +873,14 @@ void AnimationTreePlayer::_process_animation(float p_delta) { Vector3 scale; a->transform_track_interpolate(tr.local_track,anim_list->time,&loc,&rot,&scale); - tr.track->loc+=loc*blend; + tr.track->loc+=loc*tr.weight; scale.x-=1.0; scale.y-=1.0; scale.z-=1.0; - tr.track->scale+=scale*blend; + tr.track->scale+=scale*tr.weight; - tr.track->rot = tr.track->rot * empty_rot.slerp(rot,blend); + tr.track->rot = tr.track->rot * empty_rot.slerp(rot,tr.weight); } break; @@ -900,7 +888,7 @@ void AnimationTreePlayer::_process_animation(float p_delta) { if (a->value_track_get_update_mode(tr.local_track)==Animation::UPDATE_CONTINUOUS) { Variant value = a->value_track_interpolate(tr.local_track,anim_list->time); - Variant::blend(tr.track->value,value,blend,tr.track->value); + Variant::blend(tr.track->value,value,tr.weight,tr.track->value); } else { int index = a->track_find_key(tr.local_track,anim_list->time); tr.track->value = a->track_get_key_value(tr.local_track, index); |