Merge pull request #3980 from JoshuaGrams/timescale-remainder

TimeScale node: scale return value (time remaining).
This commit is contained in:
Rémi Verschelde 2016-03-09 20:17:13 +01:00
commit 6ef3c3b645
1 changed files with 7 additions and 2 deletions

View File

@ -637,10 +637,15 @@ float AnimationTreePlayer::_process_node(const StringName& p_node,AnimationNode
} break;
case NODE_TIMESCALE: {
TimeScaleNode *tsn = static_cast<TimeScaleNode*>(nb);
float rem;
if (p_seek)
return _process_node(tsn->inputs[0].node,r_prev_anim,p_weight,p_time,switched,true,p_filter,p_reverse_weight);
rem = _process_node(tsn->inputs[0].node,r_prev_anim,p_weight,p_time,switched,true,p_filter,p_reverse_weight);
else
return _process_node(tsn->inputs[0].node,r_prev_anim,p_weight,p_time*tsn->scale,switched,false,p_filter,p_reverse_weight);
rem = _process_node(tsn->inputs[0].node,r_prev_anim,p_weight,p_time*tsn->scale,switched,false,p_filter,p_reverse_weight);
if (tsn->scale == 0)
return INFINITY;
else
return rem / tsn->scale;
} break;
case NODE_TIMESEEK: {