Conversation
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.
This change transitions from the
typetagdependency to using Bevy's ownbuilt-in
TypeRegistryto serialize and deserialize Hanabi'sEffectAsset(*.effect).This solves a long-standing issue where modifiers couldn't be serialized easily,
and user-provided modifiers were ignored for serialization. With the use of
Bevy's own type registry, all built-in and user modifiers are treated equally,
as long as they are registered via
register_reflect_modifier(). All built-in modifiersare automatically registered by the
HanabiPlugin.That registration allows leveraging the new
ReflectModifiertype data, whichprovides a factory function to create a concrete modifier type instance. This is
used during deserialization to instantiate the actual modifier object. This works
around the lack of reflection/serialization support for
Box<dyn Trait>.This change has a few knock-on effects on other parts of Hanabi:
EffectAsset::meshis now anOption<AssetPath<'static>>referencing themesh, if any, used to render particles. That path is now also serialized.
EffectMeshcomponent can override this asset mesh.With this,
EffectAssetis now entirely serializable. This doesn't solve the entireasset story, as some additional items are still missing (notably, textures). But
this should greatly improve the value proposition for loading Hanabi effects
from assets on disk, rather than generating effects in code.