MCPcopy Index your code
hub / github.com/BlakeDarrow/bevy_granite

github.com/BlakeDarrow/bevy_granite @v0.2.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.2.2 ↗ · + Follow
835 symbols 1,573 edges 191 files 189 documented · 23% updated 5mo agov0.2.2 · 2025-10-06★ 20621 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Bevy Granite

This crate provides a way to interactively create, edit, save, and load Bevy data in 3D.

[!CAUTION] This is in early development and you will likely encounter bugs

Screenshot

Start Here

Getting Started

Navigate to your projects Cargo.toml and add bevy_granite.

[dependencies]
bevy = "0.16.0"
bevy_granite = { git = "https://github.com/BlakeDarrow/bevy_granite", branch = "main" }
serde = "*"

There are 3 optional feature sets. - Gizmos - Only loads needed content for gizmos. No editor or UI. - Core - No Editor or Gizmos, just the bare bones needed to use our serial/deserial functions with macros and logging. - Editor - The same as default features. Includes Gizmos, Core, and all Editor functionality.

Examples

Next, check out the examples which showcase how you can setup a project. Dungeon provides a simple entry point file with code ready to start editing. Just make sure you copy over the relevant assets subfolder folder or you will get errors.

If you clone this repo directly, you can use the example argument to launch straight into an example.

ps cargo run --release --example dungeon


Support Table

bevy bevy_granite
0.16 0.2.0 - 0.2.2
0.15 None
0.14 0.1.0

Features

Features

Scene Serialization

An entity is stored as three main parts: - Identity: Contains the entity’s name, uuid, and type/class (such as Camera, Light, OBJ). This class data contains everything necessary to rebuild this bundle and any other adjacently relevant data. Not everything is currently available in classes. - Transform: Describes the entity’s position, rotation, and scale. This determines where the entity is located and how it is oriented in the world. - Components: (Optional) Holds additional data or behaviors attached to the entity. This is where you extend the entity’s functionality via the #[granite_component] macro.

A scene file contains metadata and a list of serializable entity data. Check out the assets/scenes for scene examples.

Callable Events

While comprehensive documentation is currently unavailable, here are some helpful events you can use to interact with the editor while I write said documentation:

Events

Editor Control Events

  • RequestEditorToggle - Toggle the editor UI on/off
  • RequestToggleCameraSync - Toggle camera synchronization between editor and main camera

Entity Selection Events

  • RequestSelectEntityEvent - Select an entity (additive for multi-selection)
  • RequestDeselectEntityEvent - Deselect a specific entity
  • RequestDeselectAllEntitiesEvent - Clear all entity selections
  • RequestCameraEntityFrame - Frame the UI camera to focus on active entity

Entity Duplication Events

  • RequestDuplicateEntityEvent - Duplicate a specific entity
  • RequestDuplicateAllSelectionEvent - Duplicate all currently selected entities

Entity Hierarchy Events

  • RequestNewParent - Request to set active as parent for selected entities
  • RequestRemoveParents - Remove parent relationships from selected entities
  • RequestRemoveChildren - Remove child relationships from selected entities

World Management Events

  • RequestSaveEvent - Save the specific world
  • RequestLoadEvent - Load a world from specified path
  • RequestReloadEvent - Reload a world from specified path
  • WorldLoadSuccessEvent - Event sent when world loading completes successfully
  • WorldSaveSuccessEvent - Event sent when world saving completes successfully
  • RequestDespawnSerializableEntities - Event to despawn all serializable entities
  • RequestDespawnBySource - Event to despawn a specific source that is loaded

Custom UI Callable Events

Only Bevy Event unit structs are supported for UI button rendering.

With version 0.2.x, there is a new window that renders users buttons that are clickable. Create a struct that holds your events, and add #[ui_callable_events]. This will add all the events to the events window as clickable, and will dispatch said event in your struct.

Make sure to call UI registration before the plugin gets initialized in your app if your using this. DebugEvents::register_ui();.

Example

use crate::*;
#[derive(Event, Default)]
pub struct DebugRequestPlayer;

#[derive(Event, Default)]
pub struct DebugRequestRemovePlayer;

#[ui_callable_events] 
pub struct DebugEvents {
    pub spawn_player: DebugRequestPlayer,
    pub remove_player: DebugRequestRemovePlayer,
}

pub fn debug_callable_watcher(
    mut despawn: EventReader<DebugRequestRemovePlayer>,
    mut spawn: EventReader<DebugRequestPlayer>,
    mut commands: Commands,
    mut player_start: Query<(&GlobalTransform, &mut PlayerSpawner)>,
    mut world_state: ResMut<WorldState>,
) {
    for DebugRequestRemovePlayer in despawn.read() {
        commands.send_event(RequestDespawnBySource(PLAYER_PREFAB.to_string()));
    }

    for DebugRequestPlayer in spawn.read() {
        spawn_player(&mut commands, &mut world_state, &mut player_start);
    }
}

Screenshot


License

Bevy Granite is free and open source. Except when noted, all assets are licensed under either:

  • MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
  • Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)

Any contributions by you, shall be dual licensed as above, without any additional terms or conditions.

Contributors

Additional Info

If you have any feedback, please reach out to me via a GitHub issue. I look forward to maintaining and improving this tool and am happy to hear y'alls opinions.

Special Thanks

  • Noah
  • Silas
  • Ethan
  • Max

Creator

Screenshots

Screenshot Screenshot Screenshot

Extension points exported contracts — how you extend this code

GraniteType (Interface)
(no doc) [7 implementers]
crates/bevy_granite_core/src/entities/editable/definition.rs
SelectableItem (Interface)
Generic trait for items that can be displayed in selectors [3 implementers]
crates/bevy_granite_editor/src/interface/shared/widgets/combobox.rs
ExposeToEditor (Interface)
(no doc) [1 implementers]
crates/bevy_granite_expose/src/lib.rs
UICallableEventMarker (Interface)
Marker trait for UI callable events
crates/bevy_granite_core/src/lib.rs
ChangeTracker (Interface)
Helper trait for tracking changes
crates/bevy_granite_editor/src/interface/tabs/editor_settings/ui.rs
UICallableEventProvider (Interface)
Trait for providing event information to UI
crates/bevy_granite_core/src/lib.rs

Core symbols most depended-on inside this repo

clone
called by 291
crates/bevy_granite_core/src/entities/component_editor.rs
get
called by 87
crates/bevy_granite_gizmos/src/gizmos/mod.rs
is_empty
called by 79
crates/bevy_granite_core/src/assets/materials/definition.rs
as_ref
called by 29
crates/bevy_granite_core/src/assets/materials/mod.rs
update_key
called by 21
crates/bevy_granite_core/src/shared/user_input.rs
spawn
called by 13
crates/bevy_granite_core/src/entities/editable/types/obj/creation.rs
load_texture_with_repeat
called by 12
crates/bevy_granite_core/src/assets/materials/load.rs
snap_gizmo
called by 12
crates/bevy_granite_gizmos/src/gizmos/transform/drag.rs

Shape

Function 319
Method 292
Class 191
Enum 27
Interface 6

Languages

Rust100%

Modules by API surface

crates/bevy_granite_core/src/entities/component_editor.rs28 symbols
crates/bevy_granite_editor/src/interface/tabs/node_tree/rendering.rs26 symbols
crates/bevy_granite_core/src/assets/materials/definition.rs24 symbols
crates/bevy_granite_gizmos/src/gizmos/mod.rs21 symbols
crates/bevy_granite_core/src/entities/mod.rs19 symbols
crates/bevy_granite_editor/src/interface/events.rs18 symbols
crates/bevy_granite_editor/src/interface/tabs/editor_settings/ui.rs17 symbols
crates/bevy_granite_core/src/entities/editable/types/rect_brush/mod.rs16 symbols
crates/bevy_granite_editor/src/interface/tabs/entity_editor/widgets/material_editor.rs15 symbols
crates/bevy_granite_core/src/entities/editable/types/obj/mod.rs14 symbols
crates/bevy_granite_logging/src/config.rs13 symbols
crates/bevy_granite_editor/src/interface/themes.rs13 symbols

For agents

$ claude mcp add bevy_granite \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page