Open Braymatter opened 1 year ago
Here is an example of where I'm forced to do lookups on the asset_server directly and create a bunch of adidtional consts:
What additional consts do you mean? There is no const in the code example.
Have you looked into custom dynamic assets for this issue? Maybe that could help reducing the direct usage of the asset server.
Just FYI: Bevy v0.12 (in~3 months) will likely support properly typed const asset handles. That might make it easier.
I am not sure If I understood your issue correctly. Could you please explain a bit more if you are still missing some functionality?
I've got a set of const custom materials that I need to swap out with the standard materials that are loaded from GLTF's like so:
These materials are basically a copy of the StandardMaterial with a Thermal glow blending emissivity layered on top. I need a way to indicate that I need a specific field from within the AssetCollection.
The two things I can come up with for this are either some macro wizardry to secretly do const handles internally, or using something the key attribute of the asset macro to generate some form of index.
Additionally, you could probably get somewhere with Reflect / get_field, but I have a very strong preference to not litter duplicate &str's around. That specifically would be less of an issue if we could reference Const &str's in macro attributes.
My use case for the key solution would be the ability to reference the handle from a file or a const Material at compile time.
Here is an example of where I'm forced to do lookups on the asset_server directly and create a bunch of adidtional consts: