From 04d72a66503fc409a0608b99479ac7e57b52493c Mon Sep 17 00:00:00 2001 From: Danny McGee Date: Fri, 22 Mar 2024 17:40:25 -0400 Subject: [PATCH] Formatting, clippy --- studio/src/interaction/selection.rs | 3 ++- studio/src/scene.rs | 16 +++++++++++++--- studio/src/ui/blocking.rs | 7 ++----- studio/src/ui/inspector.rs | 29 ++++++++++++++++------------- 4 files changed, 33 insertions(+), 22 deletions(-) diff --git a/studio/src/interaction/selection.rs b/studio/src/interaction/selection.rs index ca7acad..405eb4c 100644 --- a/studio/src/interaction/selection.rs +++ b/studio/src/interaction/selection.rs @@ -106,7 +106,8 @@ fn tag_scene_elements( q_primitives: Query<&Handle>, ) { for (ent, children) in q_scene_elements.iter() { - cmd.entity(ent).insert(Selectable).insert(PickableBundle::default()); + cmd.entity(ent) + .insert((Selectable, PickableBundle::default())); if let Some(children) = children { for &ent_child in children diff --git a/studio/src/scene.rs b/studio/src/scene.rs index cf86f2d..26652e1 100644 --- a/studio/src/scene.rs +++ b/studio/src/scene.rs @@ -17,14 +17,25 @@ use bevy::{ use serde_repr::{Deserialize_repr, Serialize_repr}; use space_editor::{ prelude::{EditorEvent, EditorPrefabPath, PrefabMarker}, - space_prefab::{component::{GltfPrefab, SceneAutoChild}, editor_registry::EditorRegistryExt}, + space_prefab::{ + component::{GltfPrefab, SceneAutoChild}, + editor_registry::EditorRegistryExt, + }, }; #[cfg(feature = "wasm")] use wasm_bindgen::prelude::wasm_bindgen; use wgpu::{TextureDescriptor, TextureUsages}; use crate::{ - anim::timeline_animation::AnimationTarget, camera_controller::{CameraController, CameraControllerBundle}, change_tracking::{ChangeTracker, ChangeTrackingPlugin}, debug::DebugPoint, headless::{is_headless, is_not_headless, HeadlessSettings}, interaction::Selectable, is_editor, math::{Combinable, Extrema}, screenshot::ScreenCapture, MainCamera + anim::timeline_animation::AnimationTarget, + camera_controller::{CameraController, CameraControllerBundle}, + change_tracking::{ChangeTracker, ChangeTrackingPlugin}, + debug::DebugPoint, + headless::{is_headless, is_not_headless, HeadlessSettings}, + is_editor, + math::{Combinable, Extrema}, + screenshot::ScreenCapture, + MainCamera, }; pub struct ScenePlugin; @@ -103,7 +114,6 @@ impl Plugin for ScenePlugin { ); app.editor_registry::(); - // app.editor_registry::(); } } diff --git a/studio/src/ui/blocking.rs b/studio/src/ui/blocking.rs index 5b1fc77..a77566d 100644 --- a/studio/src/ui/blocking.rs +++ b/studio/src/ui/blocking.rs @@ -27,11 +27,8 @@ fn read_command_system(mut commands: Commands, mut change_event: EventWriter { diff --git a/studio/src/ui/inspector.rs b/studio/src/ui/inspector.rs index 9b75ab2..45481ae 100644 --- a/studio/src/ui/inspector.rs +++ b/studio/src/ui/inspector.rs @@ -1,7 +1,11 @@ use std::{marker::PhantomData, sync::Arc}; use bevy::{ - ecs::world::unsafe_world_cell::UnsafeWorldCell, prelude::*, reflect::{serde::ReflectSerializer, GetTypeRegistration}, transform::commands, utils::HashMap, window::PrimaryWindow + ecs::world::unsafe_world_cell::UnsafeWorldCell, + prelude::*, + reflect::{serde::ReflectSerializer, GetTypeRegistration}, + utils::HashMap, + window::PrimaryWindow, }; use serde::{Deserialize, Serialize}; use serde_json::{self, json, Map as JsonMap, Value as JsonValue}; @@ -10,7 +14,9 @@ use space_editor::{ editor_tab::{EditorTab, EditorTabName}, EditorUiAppExt, }, - space_prefab::{component::MeshPrimitivePrefab, editor_registry::EditorRegistryExt, save::SaveState}, + space_prefab::{ + component::MeshPrimitivePrefab, editor_registry::EditorRegistryExt, save::SaveState, + }, }; use wasm_bindgen::prelude::*; @@ -62,7 +68,6 @@ impl Plugin for InspectorPlugin { //register standart material { - app.editor_registry::() .add_event::>>() .add_systems( @@ -83,7 +88,9 @@ impl Plugin for InspectorPlugin { app.add_systems( OnEnter(SaveState::Save), - (create_short_materials, apply_deferred).chain().before(space_editor::space_prefab::sub_scene::prepare_auto_scene) + (create_short_materials, apply_deferred) + .chain() + .before(space_editor::space_prefab::sub_scene::prepare_auto_scene), ); app.add_systems(PostUpdate, apply_short_materials); @@ -121,10 +128,8 @@ impl Plugin for InspectorPlugin { } } - - fn create_short_materials( - mut commands : Commands, + mut commands: Commands, q_mats: Query<(Entity, &Handle)>, materials: Res>, ) { @@ -136,12 +141,12 @@ fn create_short_materials( } fn apply_short_materials( - mut commands : Commands, + mut commands: Commands, q_mats: Query<(Entity, &Handle, &ShortMaterial)>, - mut materials: ResMut>,) -{ + mut materials: ResMut>, +) { for (entity, handle, short) in q_mats.iter() { - let Some(mut material) = materials.get_mut(handle) else { + let Some(material) = materials.get_mut(handle) else { continue; }; @@ -154,7 +159,6 @@ fn apply_short_materials( } } - #[derive(Resource, Default)] struct InspectGetters { getters: HashMap< @@ -595,7 +599,6 @@ impl ShortMaterial { } } - fn serialize_standart_materal( r_selection: Option>, q_m: Query<&Handle>,