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

Add AssetSchematic #57

Merged
merged 6 commits into from
Sep 17, 2023
Merged

Add AssetSchematic #57

merged 6 commits into from
Sep 17, 2023

Conversation

MrGVSV
Copy link
Owner

@MrGVSV MrGVSV commented Sep 9, 2023

Resolves #47

This PR adds support for asset schematics as defined in #47. I won't go into too much detail here, but here's an high-level overview:

  • Allows defining assets directly inside a schematic definition by deriving the new AssetSchematic trait
  • More examples:
    • bevy/asset_loading.rs
    • bevy/sprite_sheet.rs
    • asset_schematic.rs
  • Improved bevy_proto_derive logic and organization

Here are some examples of various built-in asset schematics:

UV Sphere
(
  name: "Sphere",
  schematics: {
    "bevy_proto::custom::MaterialMeshBundle<bevy_pbr::pbr_material::StandardMaterial>": (
      mesh: Asset(UvSphere((
        radius: 1.0,
      ))),
      material: Asset((
        base_color: Rgba(
          red: 0.8,
          green: 0.7,
          blue: 0.6,
          alpha: 1.0
        ),
      )),
    )
  }
)
Sprite Sheet
(
  name: "Player",
  schematics: {
    "bevy_proto::custom::SpriteSheetBundle": (
      texture_atlas: Asset(Grid(
        texture: AssetPath("textures/rpg/chars/gabe/gabe-idle-run.png"),
        tile_size: (
          x: 24.0,
          y: 24.0
        ),
        columns: 7,
        rows: 1,
        padding: None,
        offset: None,
      )),
    )
  }
)

@MrGVSV
Copy link
Owner Author

MrGVSV commented Sep 9, 2023

This is a massive change haha but if anyone has any comments or thoughts, feel free to leave them.

I'll probably merge this pretty soon (I've been working on it for too long and getting kinda sick of it lol).

@brandon-reinhart
Copy link

This is nice. I'll probably switch to bevy_proto from my custom asset loaders after this is merged.

@MrGVSV
Copy link
Owner Author

MrGVSV commented Sep 16, 2023

Going to maybe update README to include details about this new functionality, and then I'll merge later today!

@MrGVSV MrGVSV merged commit 427268a into main Sep 17, 2023
2 checks passed
@MrGVSV MrGVSV deleted the inline-assets branch September 17, 2023 03:24
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

Successfully merging this pull request may close these issues.

AssetSchematic: Defining assets inline
2 participants