Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify usage of AnimationPlayer with AnimationTree and fill empty doc descriptions #39234

Merged

Conversation

mrushyendra
Copy link
Contributor

Updated class documentation for AnimationTree:

  1. Added missing descriptions for root_motion_track and get_root_motion_transform()

  2. Clarified usage of AnimationPlayer when paired with an AnimationTree. The behavior is described in more detail in Correctness of AnimationPlayer's methods is affected when paired with an AnimationTree godot-docs#3610. Essentially, when an AnimationPlayer object is paired with an AnimationTree, several properties and methods exposed by the AnimationPlayer class will not work as expected. Some of these include:

current_animation
assigned_animation
current_animation_position
current_animation_length
playback_default_blend_time
playback_active
playback_speed

as well as their associated setters and getters, and a couple of other methods. This occurs because an AnimationTree uses its AnimationPlayer* player primarily for its Map<StringName, AnimationData> animation_set.

AnimationTree::_process_graph() calls AnimationTree::_update_caches() to get the animation_set from the player and populate its track_cache, instead of calling AnimationPlayer::play() directly. Hence, most of the properties of the AnimationPlayer will not be updated.

bool AnimationTree::_update_caches(AnimationPlayer *player) {
setup_pass++;
if (!player->has_node(player->get_root())) {
ERR_PRINT("AnimationTree: AnimationPlayer root is invalid.");
set_active(false);
return false;
}
Node *parent = player->get_node(player->get_root());
List<StringName> sname;
player->get_animation_list(&sname);

As suggested by @Calinou in #34947, it would be good to mention this behavior in the AnimationTree's class documentation.

This closes #38956, closes #34947 and closes godotengine/godot-docs#3610

… method descriptions

Add clarification to docs to explain that when an `AnimationPlayer`
object is paired with an `AnimationTree`, several properties and
methods exposed by the `AnimationPlayer` class may not work as expected.
The issues occur because an `AnimationTree` runs independently, and
uses its member `AnimationPlayer* player` primarily for its
`Map<StringName, AnimationData> animation_set`.

Added descriptions for `root_motion_track` and `get_root_motion_transform`.
@mrushyendra mrushyendra requested a review from a team as a code owner June 2, 2020 05:09
@Calinou Calinou added cherrypick:3.x Considered for cherry-picking into a future 3.x release documentation enhancement labels Jun 2, 2020
@Calinou Calinou added this to the 4.0 milestone Jun 2, 2020
@akien-mga akien-mga merged commit 82da6aa into godotengine:master Jun 2, 2020
@akien-mga
Copy link
Member

Thanks!

@akien-mga
Copy link
Member

Cherry-picked for 3.2.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment