Update morph_targets and many_foxes examples to use observers#20531
Merged
alice-i-cecile merged 5 commits intobevyengine:mainfrom Aug 14, 2025
Merged
Update morph_targets and many_foxes examples to use observers#20531alice-i-cecile merged 5 commits intobevyengine:mainfrom
morph_targets and many_foxes examples to use observers#20531alice-i-cecile merged 5 commits intobevyengine:mainfrom
Conversation
…. Also changed the `name_morphs` system to use asset loaded events.
…ly set (albeit with an underscore) so I don't think it's worth complicating the code.
morph_target and many_foxes examples to use scene spawning observersmorph_target and many_foxes examples to use observers
morph_target and many_foxes examples to use observersmorph_targets and many_foxes examples to use observers
alice-i-cecile
approved these changes
Aug 12, 2025
Member
alice-i-cecile
left a comment
There was a problem hiding this comment.
I think this is an improvement regardless of the asset reloading problem.
andriyDev
approved these changes
Aug 14, 2025
Member
|
Waiting to merge until we have a fix for the issue that this revealed. |
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
Change some examples to follow best practices for playing animations, and as a bonus work around an issue with scenes spawning multiple times.
Background
Examples that play skeletal animations usually have two steps:
Different examples use different approaches for triggering part 2, including a scene spawning observer and
Added<AnimationPlayer>queries.The observer approach is arguably best as it's more tightly scoped and easier for users to extend. The other approaches work in simple examples but fall down when users want multiple scenes or animations. See #17421 for more detail.
As a bonus, the scene spawning observer works around a current issue with scenes spawning multiple times - see #20393, #20430. Although there's an argument that this PR shouldn't land until the issue is properly fixed, as these examples are a useful test case.
Solution
Update the
morph_targetsandmany_foxesexamples to use observers.I also made a few tweaks and fixes to
morph_targets.update_weightsfeature that isn't in the example.AnimationToPlaycomponent as theanimated_meshexample.name_morphssystem to be event driven and print the asset name.I haven't updated the
animated_mesh_control,animated_mesh_events, andanimation_masksexamples, which still useAdded<AnimationPlayer>.Testing