Add bevy_gltf settings for animation player and target creation#22046
Open
greeble-dev wants to merge 7 commits into
Open
Add bevy_gltf settings for animation player and target creation#22046greeble-dev wants to merge 7 commits into
bevy_gltf settings for animation player and target creation#22046greeble-dev wants to merge 7 commits into
Conversation
bevy_gltf settings that control when animation players and targets are createdbevy_gltf settings for animation player and target creation
ChristopherBiscardi
approved these changes
May 21, 2026
Contributor
ChristopherBiscardi
left a comment
There was a problem hiding this comment.
This generally seems good and the creation of the target ids as such is a feature that would be useful to have. I think the animation features are a bit complicated and hard to use, but that's not really this PR's responsibility to fix.
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
Add support for:
Background
bevy_animationrequires animated entities to have certain components:AnimationTargetIdcomponent that identifies which data in anAnimationClipwill apply to the entity.AnimatedBycomponent that points to an entity with aAnimationPlayercomponent.bevy_gltfautomatically sets up these components if the glTF file contains animations. This works well for glTFs that are self-contained meshes with animations. But it fails for two cases:AnimationPlayeron mesh B will drive both meshes.AnimationTargetIdcomponents so it can bind to the animation clips.AnimatedByandAnimationPlayercomponents created automatically - these will be created separately when binding to mesh B's player.Solution
This PR adds the following settings:
The default values work as before. For the two example cases they would be changed:
CreateAnimationTargetIds::Alwayson the mesh, so it always gets IDs even if it doesn't contain animations.CreateAnimationTargetIds::Alwaysif necessary, andCreateAnimationPlayers::Never.The PR also moves the component creation code from
load_nodeto where the scenes are created. This makes the logic a bit simpler, and I think it's nicer if everything is done in one self-contained step rather then being mixed in with other per-node work.Testing
Tested every combination of settings on a few glTFs with and without animation. Also: