diff --git a/bin/editor.rs b/bin/editor.rs index ba9be30..7032f58 100644 --- a/bin/editor.rs +++ b/bin/editor.rs @@ -35,7 +35,6 @@ use bevy::{ asset::{Asset, Assets}, asset::{AssetLoader, LoadContext, LoadedAsset}, audio::PlaybackMode, - ecs::system::EntityCommands, gltf::Gltf, prelude::*, utils::BoxedFuture, @@ -101,18 +100,12 @@ pub struct TabRoot; #[derive(Debug, Component)] pub struct LevelRoot; -#[derive(Debug, Component)] -pub enum Minimize { - Open, - Closed, -} - #[derive(Debug, Component)] pub struct EditorCamera; fn initialize_ui(mut commands: Commands) { // Empty entity for populating the level being edited - commands.spawn(LevelRoot); + commands.spawn((TransformBundle { ..default() }, LevelRoot)); commands.spawn(( Camera3dBundle { ..default() }, @@ -130,7 +123,7 @@ fn initialize_ui(mut commands: Commands) { }; commands - .spawn(NodeBundle { + .spawn((NodeBundle { style: Style { border: UiRect::all(Val::Px(1.0)), margin: UiRect::all(Val::Px(5.0)), @@ -142,7 +135,7 @@ fn initialize_ui(mut commands: Commands) { background_color: Color::WHITE.into(), border_color: Color::BLACK.into(), ..default() - }) + },)) .with_children(|parent| { // HACK: This is super janky but I think we need it like this for UI layout rules let mut content_containers: Vec<(String, Entity)> = Vec::new(); @@ -171,31 +164,37 @@ fn initialize_ui(mut commands: Commands) { "Font", parent, &base_style, + ui::Select::Single, )); content_containers.push(spawn_tab_container::( "Audio", parent, &base_style, + ui::Select::Multi, )); content_containers.push(spawn_tab_container::( "Gltf", parent, &base_style, + ui::Select::Single, )); content_containers.push(spawn_tab_container::( "Scene", parent, &base_style, + ui::Select::Single, )); content_containers.push(spawn_tab_container::( "Animation", parent, &base_style, + ui::Select::Multi, )); content_containers.push(spawn_tab_container::( "Camera", parent, &base_style, + ui::Select::Single, )); }); @@ -216,6 +215,7 @@ fn initialize_ui(mut commands: Commands) { ..default() }, ui::Sorting(1), + ui::Select::Single, )) .with_children(|parent| { let b = ButtonBundle { @@ -244,6 +244,7 @@ fn spawn_tab_container( title: &'static str, parent: &mut ChildBuilder, base_style: &Style, + select: ui::Select, ) -> (String, Entity) { ( title.into(), @@ -267,6 +268,7 @@ fn spawn_tab_container( T::default(), ui::Scroll, Interaction::default(), + select, )) .id(), ) @@ -567,28 +569,19 @@ mod gltf { pub fn manage_active_gltf( events: Query< - (Entity, &Parent, &Interaction, Option<&ui::Active>), + (Entity, &Interaction, Option<&ui::Active>), (With