You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
AnimationTreePlayer: blend value tracks (closes #2299)
Variant:
- zero() sets a Variant to the appropriate type of zero value
- blend() blends part of one Variant on top of another.
(cherry picked from commit 391ce81c5e)
This commit is contained in:
committed by
Rémi Verschelde
parent
459b914d9c
commit
cafcdb015d
@@ -768,6 +768,10 @@ void AnimationTreePlayer::_process_animation(float p_delta) {
|
||||
t.scale.x=0;
|
||||
t.scale.y=0;
|
||||
t.scale.z=0;
|
||||
|
||||
Variant value = t.node->get(t.property);
|
||||
value.zero();
|
||||
t.node->set(t.property, value);
|
||||
}
|
||||
|
||||
|
||||
@@ -777,11 +781,9 @@ void AnimationTreePlayer::_process_animation(float p_delta) {
|
||||
Quat empty_rot;
|
||||
|
||||
|
||||
int total = 0;
|
||||
while(anim_list) {
|
||||
|
||||
if (!anim_list->animation.is_null() && !anim_list->skip) {
|
||||
++total;
|
||||
//check if animation is meaningful
|
||||
Animation *a = anim_list->animation.operator->();
|
||||
|
||||
@@ -816,8 +818,9 @@ void AnimationTreePlayer::_process_animation(float p_delta) {
|
||||
case Animation::TYPE_VALUE: { ///< Set a value in a property, can be interpolated.
|
||||
|
||||
if (a->value_track_is_continuous(tr.local_track)) {
|
||||
Variant value = a->value_track_interpolate(tr.local_track,anim_list->time);
|
||||
tr.track->node->set(tr.track->property,value);
|
||||
Variant blended, value = a->value_track_interpolate(tr.local_track,anim_list->time);
|
||||
Variant::blend(tr.track->node->get(tr.track->property),value,blend,blended);
|
||||
tr.track->node->set(tr.track->property,blended);
|
||||
} else {
|
||||
|
||||
List<int> indices;
|
||||
|
||||
Reference in New Issue
Block a user