diff --git a/examples/platformer.rs b/examples/platformer.rs index 8a286dd8..f4a36bd1 100644 --- a/examples/platformer.rs +++ b/examples/platformer.rs @@ -28,11 +28,7 @@ fn main() { "Simnple tab".into(), simple_tab_system, ) - .add_systems( - Update, - move_player - .run_if(in_state(EditorState::Game)), - ) + .add_systems(Update, move_player.run_if(in_state(EditorState::Game))) .add_systems(Update, camera_follow.run_if(in_state(EditorState::Game))) .run(); } diff --git a/src/editor/core/gltf_unpack.rs b/src/editor/core/gltf_unpack.rs index f1c7b7a0..1655f2ef 100644 --- a/src/editor/core/gltf_unpack.rs +++ b/src/editor/core/gltf_unpack.rs @@ -84,7 +84,7 @@ fn unpack_gltf(world: &mut World) { let mut command_queue = CommandQueue::default(); for gltf in loaded_scenes.iter() { let handle: Handle = gltf.0.clone(); - let gltf_path= if let Some(path) = handle.path() { + let gltf_path = if let Some(path) = handle.path() { path.clone() } else { continue; diff --git a/src/editor/mod.rs b/src/editor/mod.rs index 3b1299f7..6044135d 100644 --- a/src/editor/mod.rs +++ b/src/editor/mod.rs @@ -1,6 +1,6 @@ //code only for editor gui -use bevy::{prelude::*, window::PrimaryWindow, render::render_resource::PrimitiveTopology}; +use bevy::{prelude::*, render::render_resource::PrimitiveTopology, window::PrimaryWindow}; pub mod core; pub mod ui; @@ -9,7 +9,11 @@ pub mod ui_registration; use bevy_egui::{EguiContext, EguiContexts}; use bevy_inspector_egui::{quick::WorldInspectorPlugin, DefaultInspectorConfigPlugin}; -use bevy_mod_picking::{prelude::*, PickableBundle, backends::raycast::{bevy_mod_raycast::prelude::RaycastSettings, RaycastPickable}}; +use bevy_mod_picking::{ + backends::raycast::{bevy_mod_raycast::prelude::RaycastSettings, RaycastPickable}, + prelude::*, + PickableBundle, +}; use bevy_panorbit_camera::{PanOrbitCamera, PanOrbitCameraPlugin, PanOrbitCameraSystemSet}; use crate::{ @@ -46,11 +50,11 @@ impl Plugin for EditorPlugin { .add_plugins(PanOrbitCameraPlugin); if !app.is_plugin_added::() { - app.add_plugins( - bevy_mod_picking::DefaultPickingPlugins - ); + app.add_plugins(bevy_mod_picking::DefaultPickingPlugins); - app.world.resource_mut::().require_markers = true; + app.world + .resource_mut::() + .require_markers = true; } if !app.is_plugin_added::() { @@ -108,15 +112,10 @@ impl Plugin for EditorPlugin { app.add_systems( PostUpdate, - ( - auto_add_picking, - select_listener.after(UiSystemSet), - ) + (auto_add_picking, select_listener.after(UiSystemSet)) .run_if(in_state(EditorState::Editor)), ); - app.add_systems( - PostUpdate, - auto_add_picking_dummy); + app.add_systems(PostUpdate, auto_add_picking_dummy); app.add_systems( Update, @@ -165,16 +164,18 @@ fn auto_add_picking( } type AutoAddQueryFilter = ( - Without, - Without, - With, - Changed>); + Without, + Without, + With, + Changed>, +); //Auto add picking for each child to propagate picking event up to prefab entitiy fn auto_add_picking_dummy( - mut commands: Commands, - query : Query<(Entity, &Handle), AutoAddQueryFilter>, - meshs : Res>) { + mut commands: Commands, + query: Query<(Entity, &Handle), AutoAddQueryFilter>, + meshs: Res>, +) { for (e, mesh) in query.iter() { //Only meshed entity need to be pickable if let Some(mesh) = meshs.get(mesh) { @@ -392,4 +393,4 @@ fn draw_camera_gizmo( // for e in grids.iter() { // commands.entity(e).remove::(); // } -// } \ No newline at end of file +// } diff --git a/src/editor/ui/inspector/mod.rs b/src/editor/ui/inspector/mod.rs index 92674db8..c141de07 100644 --- a/src/editor/ui/inspector/mod.rs +++ b/src/editor/ui/inspector/mod.rs @@ -208,39 +208,27 @@ pub fn inspect(ui: &mut egui::Ui, world: &mut World) { pretty_type_name::pretty_type_name_str(info.name()) }; - if !editor_registry.silent.contains(®istration.type_id()) { - ui.push_id( - format!("{:?}-{}", &e.id(), &name), - |ui| { - ui.collapsing(&name, |ui| { - ui.push_id( - format!( - "content-{:?}-{}", - &e.id(), - &name - ), - |ui| { - if env.ui_for_reflect_with_options( - value, - ui, - ui.id(), - &(), - ) { - set_changed(); - } - }, - ); - }); - }, - ); + ui.push_id(format!("{:?}-{}", &e.id(), &name), |ui| { + ui.collapsing(&name, |ui| { + ui.push_id( + format!("content-{:?}-{}", &e.id(), &name), + |ui| { + if env.ui_for_reflect_with_options( + value, + ui, + ui.id(), + &(), + ) { + set_changed(); + } + }, + ); + }); + }); ui.push_id( - format!( - "del component {:?}-{}", - &e.id(), - &name - ), + format!("del component {:?}-{}", &e.id(), &name), |ui| { //must be on top ui.with_layout( diff --git a/src/lib.rs b/src/lib.rs index b41562db..9f2d0ddf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,8 +26,8 @@ use prefab::PrefabPlugin; /// Public usage of packages that used in this crate pub mod ext { pub use bevy::prelude::*; - pub use bevy_egui::*; pub use bevy_debug_grid::*; + pub use bevy_egui::*; pub use bevy_inspector_egui::prelude::*; pub use bevy_mod_picking::prelude::*; pub use bevy_panorbit_camera::*; @@ -136,6 +136,5 @@ pub fn simple_editor_setup(mut commands: Commands) { .insert(PickableBundle::default()) .insert(RaycastPickable); - bevy_debug_grid::spawn_floor_grid(commands); } diff --git a/src/optional/bevy_xpbd_plugin/collider.rs b/src/optional/bevy_xpbd_plugin/collider.rs index 0ca322cb..5a7fd4d4 100644 --- a/src/optional/bevy_xpbd_plugin/collider.rs +++ b/src/optional/bevy_xpbd_plugin/collider.rs @@ -141,7 +141,9 @@ pub fn update_collider( for (e, collider, mesh) in updated_meshes.iter() { if *collider == ColliderPrefab::FromMesh { if let Some(mesh) = meshes.get(mesh) { - commands.entity(e).insert(Collider::trimesh_from_mesh(mesh).unwrap_or_default()); + commands + .entity(e) + .insert(Collider::trimesh_from_mesh(mesh).unwrap_or_default()); } else { commands.entity(e).insert(Collider::default()); } diff --git a/src/prefab/mod.rs b/src/prefab/mod.rs index 162cc54a..11a65abf 100644 --- a/src/prefab/mod.rs +++ b/src/prefab/mod.rs @@ -132,7 +132,6 @@ impl Plugin for BasePrefabPlugin { app.editor_relation::(); app.editor_relation::(); - app.editor_relation::(); //Light @@ -232,9 +231,10 @@ fn add_computed_visibility( query: Query, Without)>, ) { for e in query.iter() { - commands.entity(e) - .insert(ViewVisibility::default()) - .insert(InheritedVisibility::VISIBLE); + commands + .entity(e) + .insert(ViewVisibility::default()) + .insert(InheritedVisibility::VISIBLE); } } @@ -243,7 +243,10 @@ fn remove_computed_visibility( query: Query, With)>, ) { for e in query.iter() { - commands.entity(e).remove::().remove::(); + commands + .entity(e) + .remove::() + .remove::(); } } @@ -254,9 +257,7 @@ fn sync_asset_mesh( assets: Res, ) { for (e, mesh) in changed.iter() { - commands - .entity(e) - .insert(assets.load::(&mesh.path)); + commands.entity(e).insert(assets.load::(&mesh.path)); } for e in deleted.read() {