diff --git a/Cargo.lock b/Cargo.lock index 1262ec3..6770305 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6082,7 +6082,7 @@ dependencies = [ [[package]] name = "space_bevy_xpbd_plugin" version = "0.5.0" -source = "git+https://github.com/rewin123/space_editor?rev=948090e407558017874de491c5297aa1d2e9d21e#948090e407558017874de491c5297aa1d2e9d21e" +source = "git+https://github.com/rewin123/space_editor?rev=0f15c0d6b6b5864f4a05a2d57dfc2066e96d1a3b#0f15c0d6b6b5864f4a05a2d57dfc2066e96d1a3b" dependencies = [ "bevy", "bevy-inspector-egui", @@ -6093,7 +6093,7 @@ dependencies = [ [[package]] name = "space_editor" version = "0.5.0" -source = "git+https://github.com/rewin123/space_editor?rev=948090e407558017874de491c5297aa1d2e9d21e#948090e407558017874de491c5297aa1d2e9d21e" +source = "git+https://github.com/rewin123/space_editor?rev=0f15c0d6b6b5864f4a05a2d57dfc2066e96d1a3b#0f15c0d6b6b5864f4a05a2d57dfc2066e96d1a3b" dependencies = [ "bevy", "space_bevy_xpbd_plugin", @@ -6104,7 +6104,7 @@ dependencies = [ [[package]] name = "space_editor_core" version = "0.5.0" -source = "git+https://github.com/rewin123/space_editor?rev=948090e407558017874de491c5297aa1d2e9d21e#948090e407558017874de491c5297aa1d2e9d21e" +source = "git+https://github.com/rewin123/space_editor?rev=0f15c0d6b6b5864f4a05a2d57dfc2066e96d1a3b#0f15c0d6b6b5864f4a05a2d57dfc2066e96d1a3b" dependencies = [ "bevy", "bevy_egui", @@ -6119,7 +6119,7 @@ dependencies = [ [[package]] name = "space_editor_ui" version = "0.5.0" -source = "git+https://github.com/rewin123/space_editor?rev=948090e407558017874de491c5297aa1d2e9d21e#948090e407558017874de491c5297aa1d2e9d21e" +source = "git+https://github.com/rewin123/space_editor?rev=0f15c0d6b6b5864f4a05a2d57dfc2066e96d1a3b#0f15c0d6b6b5864f4a05a2d57dfc2066e96d1a3b" dependencies = [ "anyhow", "bevy", @@ -6147,7 +6147,7 @@ dependencies = [ [[package]] name = "space_persistence" version = "0.5.0" -source = "git+https://github.com/rewin123/space_editor?rev=948090e407558017874de491c5297aa1d2e9d21e#948090e407558017874de491c5297aa1d2e9d21e" +source = "git+https://github.com/rewin123/space_editor?rev=0f15c0d6b6b5864f4a05a2d57dfc2066e96d1a3b#0f15c0d6b6b5864f4a05a2d57dfc2066e96d1a3b" dependencies = [ "bevy", "ron", @@ -6157,7 +6157,7 @@ dependencies = [ [[package]] name = "space_prefab" version = "0.5.0" -source = "git+https://github.com/rewin123/space_editor?rev=948090e407558017874de491c5297aa1d2e9d21e#948090e407558017874de491c5297aa1d2e9d21e" +source = "git+https://github.com/rewin123/space_editor?rev=0f15c0d6b6b5864f4a05a2d57dfc2066e96d1a3b#0f15c0d6b6b5864f4a05a2d57dfc2066e96d1a3b" dependencies = [ "bevy", "bevy-inspector-egui", @@ -6171,7 +6171,7 @@ dependencies = [ [[package]] name = "space_shared" version = "0.5.0" -source = "git+https://github.com/rewin123/space_editor?rev=948090e407558017874de491c5297aa1d2e9d21e#948090e407558017874de491c5297aa1d2e9d21e" +source = "git+https://github.com/rewin123/space_editor?rev=0f15c0d6b6b5864f4a05a2d57dfc2066e96d1a3b#0f15c0d6b6b5864f4a05a2d57dfc2066e96d1a3b" dependencies = [ "anyhow", "bevy", @@ -6184,7 +6184,7 @@ dependencies = [ [[package]] name = "space_undo" version = "0.5.0" -source = "git+https://github.com/rewin123/space_editor?rev=948090e407558017874de491c5297aa1d2e9d21e#948090e407558017874de491c5297aa1d2e9d21e" +source = "git+https://github.com/rewin123/space_editor?rev=0f15c0d6b6b5864f4a05a2d57dfc2066e96d1a3b#0f15c0d6b6b5864f4a05a2d57dfc2066e96d1a3b" dependencies = [ "bevy", "pretty-type-name", diff --git a/studio/Cargo.toml b/studio/Cargo.toml index f31adc1..fb373b6 100644 --- a/studio/Cargo.toml +++ b/studio/Cargo.toml @@ -48,7 +48,7 @@ futures = "0.3.30" image = "0.25.0" bytemuck = "1.14.1" -space_editor = {git = "https://github.com/rewin123/space_editor", rev = "948090e407558017874de491c5297aa1d2e9d21e"} +space_editor = {git = "https://github.com/rewin123/space_editor", rev = "0f15c0d6b6b5864f4a05a2d57dfc2066e96d1a3b"} anyhow.workspace = true serde_repr = "0.1.18" wasm-bindgen-futures = "0.4" diff --git a/studio/src/debug.rs b/studio/src/debug.rs index 31cab44..5d8aa56 100644 --- a/studio/src/debug.rs +++ b/studio/src/debug.rs @@ -9,6 +9,7 @@ use space_editor::{ space_editor_ui::{tools::gizmo::GizmoToolPlugin, EditorPluginGroup}, }; +use crate::StudioMode; use crate::{ anim::SkeletalJoint, camera_controller::{CameraController, CameraMotionSystem}, @@ -57,37 +58,48 @@ impl Plugin for DebugPlugin { ), ); - //space_editor stuff - // app.add_plugins(UndoPlugin); - app.add_plugins( - EditorPluginGroup - .build() - .disable::() - .add_before::(EditorUiCore { - disable_no_editor_cams: false, - }) - // .disable::() - .disable::() - .disable::() - .disable::() - // .disable::() - .disable::() - // .disable::() - // .disable::() - .disable::(), - ); + let editor_ui_group = EditorPluginGroup + .build() + .disable::() + .add_before::(EditorUiCore { + disable_no_editor_cams: false, + }) + // .disable::() + .disable::() + .disable::() + .disable::() + // .disable::() + .disable::() + // .disable::() + // .disable::() + .disable::(); - app.auto_undo::>(); - app.auto_undo::(); - app.auto_undo::>(); - app.auto_undo::(); - app.auto_undo::(); + let mut only_core = false; - app.add_systems(Update, sync_editor_camera); - app.add_systems( - Update, - update_editor_ui_mode.run_if(resource_changed::), - ); + if let Some(state) = app.world.get_resource::() { + if *state == StudioMode::Headless { + only_core = true; + } + } + + if only_core { + app + .add_plugins(PrefabPlugin) + .add_plugins(EditorCore); + } else { + app.add_plugins(editor_ui_group); + app.auto_undo::>(); + app.auto_undo::(); + app.auto_undo::>(); + app.auto_undo::(); + app.auto_undo::(); + + app.add_systems(Update, sync_editor_camera); + app.add_systems( + Update, + update_editor_ui_mode.run_if(resource_changed::), + ); + } } } diff --git a/studio/src/persistance/mod.rs b/studio/src/persistance/mod.rs index 2092378..1bd02f7 100644 --- a/studio/src/persistance/mod.rs +++ b/studio/src/persistance/mod.rs @@ -1,11 +1,20 @@ use bevy::prelude::*; use space_editor::prelude::*; +use crate::StudioMode; + pub struct PersistancePlugin; impl Plugin for PersistancePlugin { fn build(&self, app: &mut App) { info!("PersistancePlugin::build"); + + if let Some(state) = app.world.get_resource::() { + if *state == StudioMode::Headless { + return; + } + } + app.editor_tab_by_trait( EditorTabName::Other("Persistance".to_string()), DebugPersistanceTab::default(), diff --git a/studio/src/ui/inspector.rs b/studio/src/ui/inspector.rs index b11d3e5..b1811b2 100644 --- a/studio/src/ui/inspector.rs +++ b/studio/src/ui/inspector.rs @@ -20,7 +20,7 @@ use space_editor::{ }; use wasm_bindgen::prelude::*; -use crate::material::short_material::ShortMaterial; +use crate::{material::short_material::ShortMaterial, StudioMode}; use crate::{ interaction::Selection, wasm::{self, StaticBuffer, WasmMessageBuffer}, @@ -30,6 +30,12 @@ pub struct InspectorPlugin; impl Plugin for InspectorPlugin { fn build(&self, app: &mut App) { + if let Some(state) = app.world.get_resource::() { + if *state == StudioMode::Headless { + return; + } + } + app.init_resource::(); app.add_event::();