Skip to content

Commit

Permalink
StateMachinePlayback: Added missing bindings to `get_current_play_pos…
Browse files Browse the repository at this point in the history
…` 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`
  • Loading branch information
Eoin-ONeill-Yokai committed Jan 2, 2021
1 parent 36c9432 commit 674fb52
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doc/classes/AnimationNodeStateMachinePlayback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
Returns the current travel path as computed internally by the A* algorithm.
</description>
</method>
<method name="get_current_play_position" qualifiers="const">
<return type="float">
</return>
<description>
Returns the playback position within the current animation state.
</description>
</method>
<method name="is_playing" qualifiers="const">
<return type="bool">
</return>
Expand Down
2 changes: 2 additions & 0 deletions scene/animation/animation_node_state_machine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 674fb52

Please sign in to comment.