From b3c225b1ad1aafdbe904f6b37978584689397f98 Mon Sep 17 00:00:00 2001 From: Elijah Voigt Date: Sat, 23 Sep 2023 20:57:12 -0700 Subject: [PATCH] commit before gutting gltf editor parts --- bin/editor.rs | 2 +- src/editor/monologue.rs | 5 ++++- src/editor/plugin.rs | 1 - src/editor/scene.rs | 6 ++++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bin/editor.rs b/bin/editor.rs index 022a181..04745a7 100644 --- a/bin/editor.rs +++ b/bin/editor.rs @@ -23,7 +23,7 @@ // * make min/max/close buttons into actions not selects // * (???) Better handle hide/close monologue -use bevy::{asset::ChangeWatcher, gltf::Gltf, prelude::*, utils::Duration}; +use bevy::{asset::ChangeWatcher, prelude::*, utils::Duration}; use monologue_trees::{debug::*, editor::plugin::EditorPlugin, ui}; fn main() { diff --git a/src/editor/monologue.rs b/src/editor/monologue.rs index a72b36b..85e1322 100644 --- a/src/editor/monologue.rs +++ b/src/editor/monologue.rs @@ -14,6 +14,7 @@ impl Plugin for EditorMonologuePlugin { fn build(&self, app: &mut App) { app.add_asset::() .init_asset_loader::() + .add_event::() .add_systems(Update, sync_asset_buttons::) .add_systems(Update, sync_remove_asset_buttons::) .add_systems(Update, control_active_gltf) @@ -22,7 +23,8 @@ impl Plugin for EditorMonologuePlugin { .add_systems(Update, ui_active::) .add_systems(Update, ui_inactive::) .add_systems(Update, sync_monologue_font) - .add_event::(); + .add_systems(Startup, init_texts_ui) + .add_systems(Update, texts_ui); } } @@ -60,6 +62,7 @@ impl AssetLoader for MonologueLoader { let asset = Monologue { text: String::from_utf8(bytes.to_vec())?, }; + info!("!!! Loading Monologue !!!"); load_context.set_default_asset(LoadedAsset::new(asset)); Ok(()) }) diff --git a/src/editor/plugin.rs b/src/editor/plugin.rs index c42bd9d..45f2a5b 100644 --- a/src/editor/plugin.rs +++ b/src/editor/plugin.rs @@ -18,7 +18,6 @@ impl Plugin for EditorPlugin { .add_plugins(EditorScenePlugin::default()) .add_plugins(EditorTimelinePlugin::default()) .add_systems(Startup, initialize_ui) - .add_systems(Startup, init_texts_ui) .add_systems(Startup, welcome_message); } } diff --git a/src/editor/scene.rs b/src/editor/scene.rs index 5125689..6a6099d 100644 --- a/src/editor/scene.rs +++ b/src/editor/scene.rs @@ -17,12 +17,14 @@ impl Plugin for EditorScenePlugin { pub struct SceneWidget; pub fn add_scenes_ui( - gltf_selected: Query<&ui::TargetAsset, Added>, + gltf_selected: Query<&ui::TargetAsset, Added>>, mut commands: Commands, gltfs: Res>, widget: Query>, + server: Res, ) { gltf_selected.iter().for_each(|ui::TargetAsset { handle }| { + let gltf_name = get_asset_name(&server, handle.clone()); if let Some(gltf) = gltfs.get(&handle.clone()) { gltf.named_scenes.iter().for_each(|(name, handle)| { create_asset_button( @@ -31,7 +33,7 @@ pub fn add_scenes_ui( ui::TargetAsset { handle: handle.clone(), }, - name.clone(), + format!("{}/{}", gltf_name, name), None, ); })