amethyst / editor-core

Crate that allows an Amethyst game to communicate with an editor.
Other
44 stars 10 forks source link

Register read-only resources #26

Closed randomPoison closed 6 years ago

randomPoison commented 6 years ago

25 added support for editing Resources, but in doing so added the requirement that registered Resource types be DeserializeOwned. While most Resources types will likely be able to #[derive(Deserialize)], it would be good to still support displaying Resources that only implement Serialize.

To do so, we should add a new method SyncEditorBundle::read_resource for registering a read-only Resource, as well as a corresponding SyncEditorBundle::read_resources method for registering a set of read-only resources generated with type_set!.

To do this, we'll likely have to split the ResourceSet trait into two traits ReadResourceSet and WriteResourceSet. ReadResourceSet would only need to enforce the Serialize bound, and WriteResourceSet would only need to enforce the DeserializeOwned bound.