idanarye / bevy-yoleck

Your Own Level Editor Creation Kit
Other
172 stars 11 forks source link

Entity type definition files #26

Open idanarye opened 1 year ago

idanarye commented 1 year ago

Registering entity types via code can be tedious. Users would prefer to use some UI to define them - something like bevy_editor_pls, or an external editor (like Blender) that can add metadata to the scene which Bevy can translate into components.

Yoleck needs to be able to read such files and convert them to YoleckEntityTypes at runtime. That way the user can create entity types with the UI and then place them in the level with Yoleck. Ideally, without even restarting the editor instance.

Yoleck itself should not add that external UI as a dependency. Instead, it should provide the mechanism for importing files (of unknown type!) and then some eternal crate - let's call it for now "bevy-yoleck-pls" - will add the support for specific file types. bevy-yoleck-pls should also allow switching between Yoleck and bevy_editor_pls while editing.

Note that components will still need to be defined (and registered!) by code. Can't escape that.

Also note that Yoleck will need metadata to determine two things:

  1. Which YoleckComponent should the entity type have? These are treated different from regular components. Luckily, it's easy enough to set a default (usually it'd just be Vpeol2dPosition/Vpeol3dPosition) and Yoleck itself could provide the UI for editing the YoleckComponents.
  2. Should the generated entity be the scene itself or some top level object in the scene? We can use the scene itself as default though (a top level object can't be a default because how do you determine which object?)

Since all that metadata has good defaults, it should not be an issue to have Yoleck list a directory and automatically import all the entity definition files from there, and just have some UI to configure them afterwards.