-
Notifications
You must be signed in to change notification settings - Fork 78
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
ParticleTextureModifier serialization #192
base: main
Are you sure you want to change the base?
Conversation
Thanks for the PR! That looks definitely very useful, and is something I'd like for all modifiers so we can finally properly serialize I was wondering how we can do that in a future-proof way. It looks like a good solution, however I'm wondering if that's the right solution. Surely we're not the first ones using Bevy to have this issue. So it feels awkward to have to redefine our own In short, I need to think a bit more about this. |
It's unfortunate Bevy doesn't handle this situation more generally. This doesn't even work with scenes, which is where I would expect most users of Bevy to have handles to external assets. I have seen a few complaints, but I guess most people aren't writing their own asset loaders. Another possible solution is scanning all the assets at startup, or keeping a persisted list of assets with ids and paths to reference at load. Since the asset ids are stable hashes, the path can be looked up from there. I suspect both of those options would be more code, and more steps overall than what's in this PR. In regards to future Bevy changes, you have your own asset loader so the format shouldn't change unless You also might consider putting |
Ok from quick discussion on Discord with Cart it doesn't seem like there's a better alternative at the minute, so I guess it's fine merging the current solution. I merged the Graph API though (#191) so there's a few conflicts now, if you have time to resolve @yrns I can review after. Thanks! |
@djeedai Merged, and added a test. |
I'm so sorry, I merged a bunch of things I had locally and I made more conflicts 🤦♂️ |
Ok I fixed the issues on your branch directly. However I'd like to test the new example, but I can't do that until |
This is a way to handle serialization of particle textures within
EffectAsset
by way of:AssetHandle
, which derefs toHandle
and de/serializes as anAssetPath
.EffectAssetLoader
as dependent assets to the effect.I included a new example in which you can save the current effect to the assets directory, edit the file, and click "load" to respawn the effect with the new asset.
I found the idea here. I believe
AssetHandle
becomes unnecessary with the new asset rework (bevyengine/bevy#8624) in Bevy 0.12.