mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-17 00:13:17 +00:00
8bf4abc3a469587b5382311b69ec1093574bf8e5
This PR adds the bones of a user-facing scene inspector. ### Work Done To facilitate this work, the Bevy/frontend interface has been expanded to accommodate two-way communications: - The Bevy app can now dispatch JavaScript `CustomEvent`s via `wasm::dispatch_to_js(...)` - The frontend application can receive those events by listening for the given event type on the `window` object In its current state, the inspection system works by attaching the `Inspectable` marker component to any entities which should be exposed to the user. A Bevy system runs on `Update` to check for newly spawned or despawned entities with that component, and emits events to notify the frontend. The frontend listens for those events and updates its model of the scene accordingly, which is then displayed with a simple tree view. ### Future Enhancements There are many improvements that must be made to make this system actually useful, but this PR is being expedited to focus on migrating to Bevy 0.12. A shortlist of planned updates: - Identify and expose the "type" of entity (e.g. lights, cameras, meshes, skeletons, etc.) via a field on the `Inspectable` component - Highlight the currently selected entity in the frontend hierarchy - Ask the Bevy app to update the selection when the user selects an entry in the hierarchy - Add a separate UI panel to inspect and modify the selected entity's components via the frontend
Storyteller Studio
Installing dependencies
- Install Rust
- Install Node.js LTS
- Run
npm ci
Building / Running / Testing stuff
This repo is managed by Nx, a polyglot build system and monorepo framework written in TypeScript. After installing dependencies, dev tasks can be run through the Nx CLI:
npx nx <command> <project> [options]
# OR
npx nx run <project>:<command> [options]
For example, to compile the Bevy app to WebAssembly and serve it via the web frontend project, run:
npx nx serve studio-frontend
Projects are located in directories at the workspace root. The list of commands
supported by a given project can be found under the target property of its
project.json file, which defines the Nx configuration for that project.
The full list of options for a given command can be discovered by passing the
--help flag:
npx nx <command> <project> --help
Description
Languages
Rust
59.2%
TypeScript
34.9%
SCSS
4.1%
JavaScript
1%
HTML
0.3%
Other
0.5%