diff --git a/Cargo.lock b/Cargo.lock index be6cf288..683209d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4539,6 +4539,7 @@ dependencies = [ "bevy-inspector-egui", "bevy_xpbd_3d", "space_editor_ui", + "space_shared", "workspace-hakari", ] diff --git a/crates/editor_core/src/selected.rs b/crates/editor_core/src/selected.rs index 716ad04b..50998e48 100644 --- a/crates/editor_core/src/selected.rs +++ b/crates/editor_core/src/selected.rs @@ -4,7 +4,7 @@ use bevy::{ }; #[cfg(feature = "bevy_mod_outline")] -use bevy_mod_outline::{OutlinePlugin, OutlineVolume, OutlineBundle}; +use bevy_mod_outline::{OutlineBundle, OutlinePlugin, OutlineVolume}; /// A marker for editor selected entities #[derive(Component, Default, Clone)] @@ -60,7 +60,6 @@ fn selected_entity_wireframe_update( del_wireframe: Query, Without)>, need_wireframe: Query, With)>, ) { - for e in del_wireframe.iter() { cmds.entity(e).remove::(); } diff --git a/crates/editor_ui/src/camera_view.rs b/crates/editor_ui/src/camera_view.rs index 37203f7d..f2e035d5 100644 --- a/crates/editor_ui/src/camera_view.rs +++ b/crates/editor_ui/src/camera_view.rs @@ -31,7 +31,6 @@ pub struct CameraViewTabPlugin; impl Plugin for CameraViewTabPlugin { #[cfg(not(tarpaulin_include))] fn build(&self, app: &mut App) { - app.editor_tab_by_trait(CameraViewTab::default()); app.add_systems( PreUpdate, diff --git a/crates/editor_ui/src/meshless_visualizer.rs b/crates/editor_ui/src/meshless_visualizer.rs index 4ea88d39..b5e12b48 100644 --- a/crates/editor_ui/src/meshless_visualizer.rs +++ b/crates/editor_ui/src/meshless_visualizer.rs @@ -25,49 +25,23 @@ pub struct MeshlessVisualizerPlugin; impl Plugin for MeshlessVisualizerPlugin { #[cfg(not(tarpaulin_include))] fn build(&self, app: &mut App) { - use bevy_asset_loader::prelude::*; - - use toast::ToastMessage; - - if std::fs::metadata("assets/icons/").is_ok() { - app.add_loading_state( - LoadingState::new(EditorState::Loading) - .continue_to_state(EditorState::Editor) - .load_collection::() - .register_dynamic_asset_collection::() - .with_dynamic_assets_file::( - "icons/editor.icons.ron", - ), + app.add_systems(OnEnter(EditorState::Editor), register_assets) + .add_systems( + Startup, + |mut next_editor_state: ResMut>| { + next_editor_state.set(EditorState::Editor); + }, ) - .add_plugins(RonAssetPlugin::::new(&[ - "icons.ron", - ])) - } else { - app.world.send_event(ToastMessage::new( - "Failed to dynamic load assets. Loading defaults from memory", - ToastKind::Error, - )); - error!("Failed to dynamic load assets. Loading defaults from memory"); - app.add_systems(OnEnter(EditorState::Editor), register_assets) - .add_systems( - Startup, - |mut next_editor_state: ResMut>| { - next_editor_state.set(EditorState::Editor); - }, - ) - } - .insert_resource(RaycastBackendSettings { - raycast_visibility: RaycastVisibility::Ignore, - ..Default::default() - }) - .add_plugins(BillboardPlugin) - .add_systems( - Update, - (visualize_meshless, visualize_custom_meshless) - .run_if(resource_exists::) - .in_set(EditorShowSet::Show), - ) - .editor_registry::(); + .insert_resource(RaycastBackendSettings { + raycast_visibility: RaycastVisibility::Ignore, + ..Default::default() + }) + .add_plugins(BillboardPlugin) + .add_systems( + Update, + (visualize_meshless, visualize_custom_meshless).in_set(EditorShowSet::Show), + ) + .editor_registry::(); } } diff --git a/modules/bevy_xpbd_plugin/Cargo.toml b/modules/bevy_xpbd_plugin/Cargo.toml index 4f75cc59..660c1a53 100644 --- a/modules/bevy_xpbd_plugin/Cargo.toml +++ b/modules/bevy_xpbd_plugin/Cargo.toml @@ -11,6 +11,7 @@ description = "Space XPBD plugin for space_editor crate" [dependencies] bevy.workspace = true space_editor_ui.workspace = true +space_shared.workspace = true bevy_xpbd_3d = { workspace = true, features = ["3d", "f32", "collider-from-mesh", "debug-plugin", "default-collider", "parry-f32"] } bevy-inspector-egui.workspace = true workspace-hakari = { version = "0.1", path = "../../workspace-hakari" } diff --git a/modules/bevy_xpbd_plugin/src/registry.rs b/modules/bevy_xpbd_plugin/src/registry.rs index 879cbdb0..3f351e7e 100644 --- a/modules/bevy_xpbd_plugin/src/registry.rs +++ b/modules/bevy_xpbd_plugin/src/registry.rs @@ -6,6 +6,7 @@ use space_editor_ui::{ settings::RegisterSettingsBlockExt, ui_plugin::UiSystemSet, }; +use space_shared::EditorShowSet; use crate::{ collider::{self, ColliderPart, ColliderPrefabCompound, ColliderPrimitive}, @@ -65,7 +66,12 @@ impl Plugin for BevyXpbdPlugin { force_rigidbody_type_change_in_editor, ); app.add_systems(OnEnter(EditorState::Game), force_rigidbody_type_change); - app.add_systems(Update, transform_changed.after(UiSystemSet).in_set(EditorSet::EditorAndGame)); + app.add_systems( + Update, + transform_changed + .after(UiSystemSet) + .in_set(EditorShowSet::Show), + ); // app.add_systems( // Update, // (sync_position_spawn, late_sync_position_spawn).in_set(EditorSet::EditorAndGame).after(UiSystemSet), @@ -95,13 +101,15 @@ impl Plugin for BevyXpbdPlugin { } } - fn transform_changed( mut commands: Commands, query: Query<(Entity, &GlobalTransform), Changed>, ) { for (e, tr) in query.iter() { - commands.entity(e).insert((Position(tr.translation()), Rotation(tr.compute_transform().rotation))); + commands.entity(e).insert(( + Position(tr.translation()), + Rotation(tr.compute_transform().rotation), + )); } }