Skip to content
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

Asset loader #10

Open
mgi388 opened this issue Aug 26, 2024 · 4 comments
Open

Asset loader #10

mgi388 opened this issue Aug 26, 2024 · 4 comments

Comments

@mgi388
Copy link
Contributor

mgi388 commented Aug 26, 2024

By any chance have you created an asset loader that works with this crate?

It's possible that the space is too opinionated at least for this crate to provide an asset loader, but I was curious if you've been using this crate with an asset loader?

I wonder if at the very least we need serde support so we can create clips and animations from RON files, for example? Again, I guess it's possible that is something that this crate should not support and those serialization types and the loader should all be created as 3rd party to this.

@merwaaan
Copy link
Owner

I have not used an asset loader in that context but I can see the use-case.

I'm not against providing some kind of animation loader with the crate as long as it's an opt-in feature.

@mirsella
Copy link
Contributor

mirsella commented Nov 5, 2024

bevy asset loader doesn't support your use case ? it supports defining atlas layout from ron afaik

@mgi388
Copy link
Contributor Author

mgi388 commented Nov 5, 2024

bevy asset loader doesn't support your use case ? it supports defining atlas layout from ron afaik

The issue here is more about bevy_spritesheet_animation offering an asset format and structure for the animations. It's relatively easy to unmarshal some RON into a struct (using bevy_asset_loader and bevy_common_assets), but this is about how we could define assets outside of code such that they are ultimately the equivalent of this Rust code:

let spritesheet = Spritesheet::new(8, 8);
let clip = Clip::from_frames(spritesheet.row(3));
let clip_id = library.register_clip(clip);
// Create an animation that uses the clip
let animation = Animation::from_clip(clip_id);
let animation_id = library.register_animation(animation);
// Name the animation to retrieve it from other systems
library.name_animation(animation_id, "walk").unwrap();

@mirsella
Copy link
Contributor

mirsella commented Nov 5, 2024

for now i have a system that run after my assets are loaded, and register all the animation to the library.
the clip and animation are generated from my GameAssets struct (with bevy_asset_loader's AssetCollection) with Reflect by iterating over the field of type Handle.

i dont find this nice and especially no type safety, but it work for me.
i hope it can help you on your use case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@merwaaan @mirsella @mgi388 and others