From 674fb52f52f6592c71de319fb4e3fa52be6c136c Mon Sep 17 00:00:00 2001 From: Eoin O'Neill Date: Fri, 18 Sep 2020 19:59:25 -0700 Subject: [PATCH] StateMachinePlayback: Added missing bindings to `get_current_play_pos` and `get_current_length`. This allows the user to query the AnimationNodeStateMachinePlayback's current play position and total length of current animation state. These methods are currently used in the editor plugin, but can also be useful for querying general playback state information. Added documentation for AnimationNodeStateMachinePlayback's `get_current_play_position` --- doc/classes/AnimationNodeStateMachinePlayback.xml | 7 +++++++ scene/animation/animation_node_state_machine.cpp | 2 ++ 2 files changed, 9 insertions(+) diff --git a/doc/classes/AnimationNodeStateMachinePlayback.xml b/doc/classes/AnimationNodeStateMachinePlayback.xml index 60ff425cdb9..4dc88ffa561 100644 --- a/doc/classes/AnimationNodeStateMachinePlayback.xml +++ b/doc/classes/AnimationNodeStateMachinePlayback.xml @@ -35,6 +35,13 @@ Returns the current travel path as computed internally by the A* algorithm. + + + + + Returns the playback position within the current animation state. + + diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp index 36552c966d6..f69a9381e18 100644 --- a/scene/animation/animation_node_state_machine.cpp +++ b/scene/animation/animation_node_state_machine.cpp @@ -495,6 +495,8 @@ void AnimationNodeStateMachinePlayback::_bind_methods() { ClassDB::bind_method(D_METHOD("stop"), &AnimationNodeStateMachinePlayback::stop); ClassDB::bind_method(D_METHOD("is_playing"), &AnimationNodeStateMachinePlayback::is_playing); ClassDB::bind_method(D_METHOD("get_current_node"), &AnimationNodeStateMachinePlayback::get_current_node); + ClassDB::bind_method(D_METHOD("get_current_play_position"), &AnimationNodeStateMachinePlayback::get_current_play_pos); + ClassDB::bind_method(D_METHOD("get_current_length"), &AnimationNodeStateMachinePlayback::get_current_length); ClassDB::bind_method(D_METHOD("get_travel_path"), &AnimationNodeStateMachinePlayback::get_travel_path); }