check root node for animations#9407
Merged
alice-i-cecile merged 10 commits intobevyengine:mainfrom Aug 28, 2023
Merged
Conversation
Contributor
|
If I'm not mistaken this "Fixes #8357"? |
nicopap
reviewed
Aug 10, 2023
nicopap
approved these changes
Aug 10, 2023
nicopap
reviewed
Aug 10, 2023
Co-authored-by: Nicola Papale <[email protected]>
mockersf
reviewed
Aug 11, 2023
Comment on lines
+302
to
+307
| let Some((_, root_name)) = parts.next() else { | ||
| return None; | ||
| }; | ||
| if names.get(current_entity) != Ok(root_name) { | ||
| return None; | ||
| } |
Member
There was a problem hiding this comment.
Suggested change
| let Some((_, root_name)) = parts.next() else { | |
| return None; | |
| }; | |
| if names.get(current_entity) != Ok(root_name) { | |
| return None; | |
| } | |
| if names.get(current_entity).ok() != parts.next().map(|(_, part)| part) { | |
| return None; | |
| }; |
Just a style nit, but I would prefer this
Contributor
Author
There was a problem hiding this comment.
it's slightly different semantically - this would pass if parts is empty and the node has no name. neither of those things can happen via the gltf loader but could happen for clips/players constructed another way.
could maybe go with if names.get(current_entity) != Ok(parts.next()?.1) { ... i'm not sure it's nicer.
mockersf
approved these changes
Aug 11, 2023
robtfm
added a commit
to decentraland/bevy-explorer
that referenced
this pull request
Aug 16, 2023
features - `AvatarAttach` - `Visibility` - `PointerResults`: - add normal - add position - add scene entity to hit result for events sent to scene roots - collisions - add DisableCollisions marker, apply to `AvatarAttach`ed items - mock js modules bugfixes - animations - fix path bug (inc bevy patch [#9407](bevyengine/bevy#9407)) that caused anims to play on the wrong nodes - play gltf first animation if no animator present - play animation resets the anim (only if not looping) - fix main.crdt buffer overrun - fix collider pipeline use-before-init crash - system log chat tab now updates live without forcing reload - chat tab wraps correctly - send transform updates to scene only if they are changed - don't validate the `main_file` for texture wearables, just look for pngs - AudioSource - only plays in current scene - use manual spatial calc to preserve requested volume tweaks - increase base move speed - vsync off by default - update to latest protobuf messages
rdrpenguin04
pushed a commit
to rdrpenguin04/bevy
that referenced
this pull request
Jan 9, 2024
# Objective fixes bevyengine#8357 gltf animations can affect multiple "root" nodes (i.e. top level nodes within a gltf scene). the current loader adds an AnimationPlayer to each root node which is affected by any animation. when a clip which affects multiple root nodes is played on a root node player, the root node name is not checked, leading to potentially incorrect weights being applied. also, the `AnimationClip::compatible_with` method will never return true for those clips, as it checks that all paths start with the root node name - not all paths start with the same name so it can't return true. ## Solution - check the first path node name matches the given root - change compatible_with to return true if `any` match is found a better alternative would probably be to attach the player to the scene root instead of the first child, and then walk the full path from there. this would be breaking (and would stop multiple animations that *don't* overlap from being played concurrently), but i'm happy to modify to that if it's preferred. --------- Co-authored-by: Nicola Papale <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
fixes #8357
gltf animations can affect multiple "root" nodes (i.e. top level nodes within a gltf scene).
the current loader adds an AnimationPlayer to each root node which is affected by any animation. when a clip which affects multiple root nodes is played on a root node player, the root node name is not checked, leading to potentially incorrect weights being applied.
also, the
AnimationClip::compatible_withmethod will never return true for those clips, as it checks that all paths start with the root node name - not all paths start with the same name so it can't return true.Solution
anymatch is founda better alternative would probably be to attach the player to the scene root instead of the first child, and then walk the full path from there. this would be breaking (and would stop multiple animations that don't overlap from being played concurrently), but i'm happy to modify to that if it's preferred.