diff --git a/Cargo.lock b/Cargo.lock index 3e6d5bd..b305ccd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -334,47 +334,19 @@ dependencies = [ "bevy_internal", ] -[[package]] -name = "bevy-inspector-egui" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d65b98d6fca1209c36c4d403c377f303aad22d940281fe1a9e431217516f0622" -dependencies = [ - "bevy-inspector-egui-derive 0.21.0", - "bevy_app", - "bevy_asset", - "bevy_core", - "bevy_core_pipeline", - "bevy_ecs", - "bevy_egui 0.23.0", - "bevy_hierarchy", - "bevy_log", - "bevy_math", - "bevy_pbr", - "bevy_reflect", - "bevy_render", - "bevy_utils", - "bevy_window", - "egui 0.23.0", - "image", - "once_cell", - "pretty-type-name", - "smallvec", -] - [[package]] name = "bevy-inspector-egui" version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c3efee9165f9be9c6a180c6a9bbb4bd39ee0a98a594f4cb7127704e15415cdd" dependencies = [ - "bevy-inspector-egui-derive 0.22.0", + "bevy-inspector-egui-derive", "bevy_app", "bevy_asset", "bevy_core", "bevy_core_pipeline", "bevy_ecs", - "bevy_egui 0.24.0", + "bevy_egui", "bevy_hierarchy", "bevy_log", "bevy_math", @@ -384,24 +356,13 @@ dependencies = [ "bevy_time", "bevy_utils", "bevy_window", - "egui 0.24.1", + "egui", "image", "once_cell", "pretty-type-name", "smallvec", ] -[[package]] -name = "bevy-inspector-egui-derive" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec800b7cf98151b5dbff80f0eb6dffcb4bcfceef6e457888b395ead4eb7e75ba" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.37", -] - [[package]] name = "bevy-inspector-egui-derive" version = "0.22.0" @@ -646,19 +607,6 @@ dependencies = [ "syn 2.0.37", ] -[[package]] -name = "bevy_egui" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85450af551b7e1cb766f710763b60a12a82ffd6323945a8f776c6334c59ccdc1" -dependencies = [ - "arboard", - "bevy", - "egui 0.23.0", - "thread_local", - "webbrowser", -] - [[package]] name = "bevy_egui" version = "0.24.0" @@ -667,7 +615,7 @@ checksum = "c90c01202dbcebc03315a01ea71553b35e1f20b0da6b1cc8c2605344032a3d96" dependencies = [ "arboard", "bevy", - "egui 0.24.1", + "egui", "thread_local", "webbrowser", ] @@ -2001,15 +1949,6 @@ dependencies = [ "proc-macro-error", ] -[[package]] -name = "ecolor" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfdf4e52dbbb615cfd30cf5a5265335c217b5fd8d669593cea74a517d9c605af" -dependencies = [ - "bytemuck", -] - [[package]] name = "ecolor" version = "0.24.1" @@ -2019,17 +1958,6 @@ dependencies = [ "bytemuck", ] -[[package]] -name = "egui" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bd69fed5fcf4fbb8225b24e80ea6193b61e17a625db105ef0c4d71dde6eb8b7" -dependencies = [ - "ahash", - "epaint 0.23.0", - "nohash-hasher", -] - [[package]] name = "egui" version = "0.24.1" @@ -2037,7 +1965,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c55bcb864b764eb889515a38b8924757657a250738ad15126637ee2df291ee6b" dependencies = [ "ahash", - "epaint 0.24.1", + "epaint", "nohash-hasher", ] @@ -2047,7 +1975,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2880830f1b9a0ea618472c989e7ee758f9abc54352846e4feab1be278e69316b" dependencies = [ - "egui 0.24.1", + "egui", "glam", "mint", ] @@ -2059,7 +1987,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "246a6cbf38560cdcf75f955b1f2f39be6339a3f2958d06997ce70b7b4aa3f57d" dependencies = [ "duplicate", - "egui 0.24.1", + "egui", "paste", ] @@ -2068,7 +1996,7 @@ name = "egui_file" version = "0.13.0" source = "git+https://github.com/Barugon/egui_file.git?rev=de5f8f41df160d67be328ab50974966ceb74e70f#de5f8f41df160d67be328ab50974966ceb74e70f" dependencies = [ - "egui 0.24.1", + "egui", ] [[package]] @@ -2077,15 +2005,6 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" -[[package]] -name = "emath" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ef2b29de53074e575c18b694167ccbe6e5191f7b25fe65175a0d905a32eeec0" -dependencies = [ - "bytemuck", -] - [[package]] name = "emath" version = "0.24.1" @@ -2127,21 +2046,6 @@ dependencies = [ "syn 2.0.37", ] -[[package]] -name = "epaint" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58067b840d009143934d91d8dcb8ded054d8301d7c11a517ace0a99bb1e1595e" -dependencies = [ - "ab_glyph", - "ahash", - "bytemuck", - "ecolor 0.23.0", - "emath 0.23.0", - "nohash-hasher", - "parking_lot", -] - [[package]] name = "epaint" version = "0.24.1" @@ -2151,8 +2055,8 @@ dependencies = [ "ab_glyph", "ahash", "bytemuck", - "ecolor 0.24.1", - "emath 0.24.1", + "ecolor", + "emath", "nohash-hasher", "parking_lot", ] @@ -3883,7 +3787,7 @@ dependencies = [ [[package]] name = "space_bevy_xpbd_plugin" version = "0.3.1" -source = "git+https://github.com/rewin123/space_editor?rev=e150ecaf0647de6532d2967928982abf2558bfbc#e150ecaf0647de6532d2967928982abf2558bfbc" +source = "git+https://github.com/rewin123/space_editor?rev=ac8651f4d8f916566e1026b04d03d1ed476fc610#ac8651f4d8f916566e1026b04d03d1ed476fc610" dependencies = [ "bevy", "bevy_xpbd_3d", @@ -3893,7 +3797,7 @@ dependencies = [ [[package]] name = "space_editor" version = "0.3.1" -source = "git+https://github.com/rewin123/space_editor?rev=e150ecaf0647de6532d2967928982abf2558bfbc#e150ecaf0647de6532d2967928982abf2558bfbc" +source = "git+https://github.com/rewin123/space_editor?rev=ac8651f4d8f916566e1026b04d03d1ed476fc610#ac8651f4d8f916566e1026b04d03d1ed476fc610" dependencies = [ "bevy", "space_bevy_xpbd_plugin", @@ -3904,7 +3808,7 @@ dependencies = [ [[package]] name = "space_editor_core" version = "0.3.1" -source = "git+https://github.com/rewin123/space_editor?rev=e150ecaf0647de6532d2967928982abf2558bfbc#e150ecaf0647de6532d2967928982abf2558bfbc" +source = "git+https://github.com/rewin123/space_editor?rev=ac8651f4d8f916566e1026b04d03d1ed476fc610#ac8651f4d8f916566e1026b04d03d1ed476fc610" dependencies = [ "bevy", "space_persistence", @@ -3916,11 +3820,11 @@ dependencies = [ [[package]] name = "space_editor_ui" version = "0.3.1" -source = "git+https://github.com/rewin123/space_editor?rev=e150ecaf0647de6532d2967928982abf2558bfbc#e150ecaf0647de6532d2967928982abf2558bfbc" +source = "git+https://github.com/rewin123/space_editor?rev=ac8651f4d8f916566e1026b04d03d1ed476fc610#ac8651f4d8f916566e1026b04d03d1ed476fc610" dependencies = [ "bevy", "bevy_debug_grid", - "bevy_egui 0.24.0", + "bevy_egui", "bevy_mod_picking", "bevy_panorbit_camera", "convert_case 0.6.0", @@ -3937,7 +3841,7 @@ dependencies = [ [[package]] name = "space_persistence" version = "0.3.1" -source = "git+https://github.com/rewin123/space_editor?rev=e150ecaf0647de6532d2967928982abf2558bfbc#e150ecaf0647de6532d2967928982abf2558bfbc" +source = "git+https://github.com/rewin123/space_editor?rev=ac8651f4d8f916566e1026b04d03d1ed476fc610#ac8651f4d8f916566e1026b04d03d1ed476fc610" dependencies = [ "bevy", "ron", @@ -3947,10 +3851,10 @@ dependencies = [ [[package]] name = "space_prefab" version = "0.3.1" -source = "git+https://github.com/rewin123/space_editor?rev=e150ecaf0647de6532d2967928982abf2558bfbc#e150ecaf0647de6532d2967928982abf2558bfbc" +source = "git+https://github.com/rewin123/space_editor?rev=ac8651f4d8f916566e1026b04d03d1ed476fc610#ac8651f4d8f916566e1026b04d03d1ed476fc610" dependencies = [ "bevy", - "bevy-inspector-egui 0.22.1", + "bevy-inspector-egui", "bevy-scene-hook", "ron", "serde", @@ -3961,17 +3865,17 @@ dependencies = [ [[package]] name = "space_shared" version = "0.3.1" -source = "git+https://github.com/rewin123/space_editor?rev=e150ecaf0647de6532d2967928982abf2558bfbc#e150ecaf0647de6532d2967928982abf2558bfbc" +source = "git+https://github.com/rewin123/space_editor?rev=ac8651f4d8f916566e1026b04d03d1ed476fc610#ac8651f4d8f916566e1026b04d03d1ed476fc610" dependencies = [ "bevy", - "bevy-inspector-egui 0.22.1", + "bevy-inspector-egui", "egui_file", ] [[package]] name = "space_undo" version = "0.3.1" -source = "git+https://github.com/rewin123/space_editor?rev=e150ecaf0647de6532d2967928982abf2558bfbc#e150ecaf0647de6532d2967928982abf2558bfbc" +source = "git+https://github.com/rewin123/space_editor?rev=ac8651f4d8f916566e1026b04d03d1ed476fc610#ac8651f4d8f916566e1026b04d03d1ed476fc610" dependencies = [ "bevy", "pretty-type-name", @@ -4016,7 +3920,7 @@ name = "studio" version = "0.1.0" dependencies = [ "bevy", - "bevy-inspector-egui 0.21.0", + "bevy-inspector-egui", "bevy_mod_outline", "bevy_mod_picking", "bevy_mod_raycast", diff --git a/editor.ron b/editor.ron new file mode 100644 index 0000000..40d190b --- /dev/null +++ b/editor.ron @@ -0,0 +1,5 @@ +{ + "space_editor_ui::settings::NewWindowSettings": "{\"space_editor_ui::settings::NewWindowSettings\":(new_tab:SameNode)}", + "space_editor_core::hotkeys::HotkeySet": "{\"space_editor_core::hotkeys::HotkeySet\":(bindings:{Rotate:[R],Translate:[G],Scale:[S],Multiple:[ShiftLeft],Clone:[AltLeft],Delete:[X]},name:\"GizmoHotkey\")}", + "space_persistence::PersistenceSettings": "{\"space_persistence::PersistenceSettings\":(load_on_startup:true,save_on_close:true)}", +} \ No newline at end of file diff --git a/studio/Cargo.toml b/studio/Cargo.toml index ffaa47c..6980b8d 100644 --- a/studio/Cargo.toml +++ b/studio/Cargo.toml @@ -13,7 +13,7 @@ name = "studio-standalone" path = "src/main.rs" [dependencies] -bevy-inspector-egui = "0.21.0" +bevy-inspector-egui = "0.22.0" bevy_mod_raycast = "0.16.0" bevy_rapier3d = "0.23.0" bevy_mod_outline = "0.6.0" @@ -32,7 +32,7 @@ web-sys = { version = "0.3.65", optional = true, features = [ "HtmlElement", "Window", ] } -space_editor = {git = "https://github.com/rewin123/space_editor", rev = "e150ecaf0647de6532d2967928982abf2558bfbc"} +space_editor = {git = "https://github.com/rewin123/space_editor", rev = "ac8651f4d8f916566e1026b04d03d1ed476fc610"} [features] wasm = [ diff --git a/studio/src/debug.rs b/studio/src/debug.rs index c1a0d07..2fd74fc 100644 --- a/studio/src/debug.rs +++ b/studio/src/debug.rs @@ -1,13 +1,14 @@ use std::fmt; use bevy::{prelude::*, window::PrimaryWindow}; -use bevy_inspector_egui::quick::WorldInspectorPlugin; +use bevy_inspector_egui::{quick::WorldInspectorPlugin, bevy_egui::EguiPlugin, DefaultInspectorConfigPlugin}; use bevy_mod_picking::debug::DebugPickingMode; +use space_editor::{space_editor_ui::{EditorPluginGroup, EditorPickingPlugin, EditorDefaultCameraPlugin, bottom_menu::BottomMenuPlugin, EditorUiCore}, prelude::{EditorCameraMarker, space_undo::UndoPlugin}}; use crate::{ camera_controller::{CameraController, CameraMotionSystem}, input::{Action, InputAction, Lifecycle}, - MainCamera, + MainCamera, interaction::gizmos::camera::GizmoCamera, }; #[derive(Resource, Deref, DerefMut)] @@ -43,6 +44,23 @@ impl Plugin for DebugPlugin { .run_if(is_debug_mode), ), ); + + //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::(),); + + app.add_systems(Update, sync_editor_camera); } } @@ -125,3 +143,12 @@ pub fn print_mat3(m: &Mat3, label: impl fmt::Display) -> fmt::Result { Ok(()) } + +fn sync_editor_camera( + mut cmd : Commands, + mut q_cam : Query, Without)> +) { + for ent in q_cam.iter_mut() { + cmd.entity(ent).insert(EditorCameraMarker); + } +} \ No newline at end of file diff --git a/studio/src/interaction/gizmos/camera.rs b/studio/src/interaction/gizmos/camera.rs index 43d1be1..6c01cac 100644 --- a/studio/src/interaction/gizmos/camera.rs +++ b/studio/src/interaction/gizmos/camera.rs @@ -9,7 +9,7 @@ use crate::MainCamera; use super::GIZMO_RENDER_LAYER; #[derive(Component)] -pub(super) struct GizmoCamera; +pub struct GizmoCamera; pub(super) fn spawn_gizmo_camera( mut cmd: Commands, diff --git a/studio/src/interaction/gizmos/mod.rs b/studio/src/interaction/gizmos/mod.rs index b4009d5..1c06515 100644 --- a/studio/src/interaction/gizmos/mod.rs +++ b/studio/src/interaction/gizmos/mod.rs @@ -13,7 +13,7 @@ use self::{ use super::{Selection, TransformMode, TransformType}; -mod camera; +pub mod camera; mod combo; mod common; mod resources; diff --git a/studio/src/interaction/mod.rs b/studio/src/interaction/mod.rs index a438ce4..dd37e9f 100644 --- a/studio/src/interaction/mod.rs +++ b/studio/src/interaction/mod.rs @@ -1,6 +1,6 @@ use bevy::prelude::*; -mod gizmos; +pub mod gizmos; pub mod selection; pub mod transformation; diff --git a/studio/src/lib.rs b/studio/src/lib.rs index 3d7a8b7..84702a6 100644 --- a/studio/src/lib.rs +++ b/studio/src/lib.rs @@ -3,7 +3,10 @@ use bevy::prelude::*; use bevy_mod_picking::DefaultPickingPlugins; -use space_editor::prelude::space_undo::UndoPlugin; +use space_editor::{ + prelude::space_undo::UndoPlugin, + space_editor_ui::{EditorPluginGroup, ext::{bevy_egui::EguiPlugin, bevy_inspector_egui::DefaultInspectorConfigPlugin}, EditorPickingPlugin}, +}; #[cfg(feature = "wasm")] use wasm_bindgen::prelude::*; @@ -80,7 +83,6 @@ pub fn init(viewport_size: ViewportSize) { SkyboxPlugin, UiLayerPlugin, WorldGridPlugin, - UndoPlugin, )) .add_systems( Startup, @@ -147,7 +149,6 @@ pub fn start_viewer( SkyboxPlugin, UiLayerPlugin, WorldGridPlugin, - UndoPlugin, )) .add_systems( Startup, diff --git a/studio/src/scene.rs b/studio/src/scene.rs index ab64c3e..acf269c 100644 --- a/studio/src/scene.rs +++ b/studio/src/scene.rs @@ -252,12 +252,13 @@ fn tag_scene_elements( let gltf = ra_gltfs.get(&r_active_scene.source).unwrap(); for ent in r_scene_spawner.iter_instance_entities(**r_active_scene) { + cmd.entity(ent).insert(PrefabMarker); let Ok(name) = q_named_non_primitives.get(ent) else { continue; }; if gltf.named_nodes.contains_key(&**name) { - cmd.entity(ent).insert(SceneElement).insert(PrefabMarker); + cmd.entity(ent).insert(SceneElement); } } }