MrGVSV / bevy_proto

Create config files for entities in Bevy
Other
239 stars 25 forks source link

Add `AssetSchematic` #57

Closed MrGVSV closed 1 year ago

MrGVSV commented 1 year ago

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:

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 commented 1 year ago

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 commented 1 year ago

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

MrGVSV commented 1 year ago

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