diff options
author | Max Hilbrunner <mhilbrunner@users.noreply.github.com> | 2018-05-26 18:18:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-26 18:18:07 +0200 |
commit | 140822cc8fc6383182afbd21ff6239abe644ec14 (patch) | |
tree | 183294c791b70ca51e7d122b936ad3a5fcebb508 /scene | |
parent | 2fca33ac7bfea33ec560a69a9b3c552beeac452c (diff) | |
parent | da8fe2f31d01772d686bd173467e0cc11357d8ac (diff) |
Merge pull request #18885 from Gamblify/AnimationTreeExposePos
Expose animation pos to user for AnimationNodes in AnimationTree
Diffstat (limited to 'scene')
-rw-r--r-- | scene/animation/animation_tree_player.cpp | 7 | ||||
-rw-r--r-- | scene/animation/animation_tree_player.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp index ce5b372d72..143684bdf9 100644 --- a/scene/animation/animation_tree_player.cpp +++ b/scene/animation/animation_tree_player.cpp @@ -1216,6 +1216,12 @@ String AnimationTreePlayer::animation_node_get_master_animation(const StringName return n->from; } +float AnimationTreePlayer::animation_node_get_position(const StringName &p_node) const { + + GET_NODE_V(NODE_ANIMATION, AnimationNode, 0); + return n->time; +} + bool AnimationTreePlayer::animation_node_is_path_filtered(const StringName &p_node, const NodePath &p_path) const { GET_NODE_V(NODE_ANIMATION, AnimationNode, 0); @@ -1724,6 +1730,7 @@ void AnimationTreePlayer::_bind_methods() { ClassDB::bind_method(D_METHOD("animation_node_set_master_animation", "id", "source"), &AnimationTreePlayer::animation_node_set_master_animation); ClassDB::bind_method(D_METHOD("animation_node_get_master_animation", "id"), &AnimationTreePlayer::animation_node_get_master_animation); + ClassDB::bind_method(D_METHOD("animation_node_get_position", "id"), &AnimationTreePlayer::animation_node_get_position); ClassDB::bind_method(D_METHOD("animation_node_set_filter_path", "id", "path", "enable"), &AnimationTreePlayer::animation_node_set_filter_path); ClassDB::bind_method(D_METHOD("oneshot_node_set_fadein_time", "id", "time_sec"), &AnimationTreePlayer::oneshot_node_set_fadein_time); diff --git a/scene/animation/animation_tree_player.h b/scene/animation/animation_tree_player.h index 09d6f6fcb4..d2d7b1c9ec 100644 --- a/scene/animation/animation_tree_player.h +++ b/scene/animation/animation_tree_player.h @@ -348,6 +348,7 @@ public: Ref<Animation> animation_node_get_animation(const StringName &p_node) const; void animation_node_set_master_animation(const StringName &p_node, const String &p_master_animation); String animation_node_get_master_animation(const StringName &p_node) const; + float animation_node_get_position(const StringName &p_node) const; void animation_node_set_filter_path(const StringName &p_node, const NodePath &p_track_path, bool p_filter); void animation_node_set_get_filtered_paths(const StringName &p_node, List<NodePath> *r_paths) const; |