commit before gutting gltf editor parts

main
Elijah Voigt 2 years ago
parent 7621db220e
commit b3c225b1ad

@ -23,7 +23,7 @@
// * make min/max/close buttons into actions not selects // * make min/max/close buttons into actions not selects
// * (???) Better handle hide/close monologue // * (???) 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}; use monologue_trees::{debug::*, editor::plugin::EditorPlugin, ui};
fn main() { fn main() {

@ -14,6 +14,7 @@ impl Plugin for EditorMonologuePlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.add_asset::<Monologue>() app.add_asset::<Monologue>()
.init_asset_loader::<MonologueLoader>() .init_asset_loader::<MonologueLoader>()
.add_event::<ControlMonologue>()
.add_systems(Update, sync_asset_buttons::<Monologue>) .add_systems(Update, sync_asset_buttons::<Monologue>)
.add_systems(Update, sync_remove_asset_buttons::<Monologue>) .add_systems(Update, sync_remove_asset_buttons::<Monologue>)
.add_systems(Update, control_active_gltf) .add_systems(Update, control_active_gltf)
@ -22,7 +23,8 @@ impl Plugin for EditorMonologuePlugin {
.add_systems(Update, ui_active::<Monologue>) .add_systems(Update, ui_active::<Monologue>)
.add_systems(Update, ui_inactive::<Monologue>) .add_systems(Update, ui_inactive::<Monologue>)
.add_systems(Update, sync_monologue_font) .add_systems(Update, sync_monologue_font)
.add_event::<ControlMonologue>(); .add_systems(Startup, init_texts_ui)
.add_systems(Update, texts_ui);
} }
} }
@ -60,6 +62,7 @@ impl AssetLoader for MonologueLoader {
let asset = Monologue { let asset = Monologue {
text: String::from_utf8(bytes.to_vec())?, text: String::from_utf8(bytes.to_vec())?,
}; };
info!("!!! Loading Monologue !!!");
load_context.set_default_asset(LoadedAsset::new(asset)); load_context.set_default_asset(LoadedAsset::new(asset));
Ok(()) Ok(())
}) })

@ -18,7 +18,6 @@ impl Plugin for EditorPlugin {
.add_plugins(EditorScenePlugin::default()) .add_plugins(EditorScenePlugin::default())
.add_plugins(EditorTimelinePlugin::default()) .add_plugins(EditorTimelinePlugin::default())
.add_systems(Startup, initialize_ui) .add_systems(Startup, initialize_ui)
.add_systems(Startup, init_texts_ui)
.add_systems(Startup, welcome_message); .add_systems(Startup, welcome_message);
} }
} }

@ -17,12 +17,14 @@ impl Plugin for EditorScenePlugin {
pub struct SceneWidget; pub struct SceneWidget;
pub fn add_scenes_ui( pub fn add_scenes_ui(
gltf_selected: Query<&ui::TargetAsset<Gltf>, Added<ui::Active>>, gltf_selected: Query<&ui::TargetAsset<Gltf>, Added<ui::TargetAsset<Gltf>>>,
mut commands: Commands, mut commands: Commands,
gltfs: Res<Assets<Gltf>>, gltfs: Res<Assets<Gltf>>,
widget: Query<Entity, With<SceneWidget>>, widget: Query<Entity, With<SceneWidget>>,
server: Res<AssetServer>,
) { ) {
gltf_selected.iter().for_each(|ui::TargetAsset { handle }| { 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()) { if let Some(gltf) = gltfs.get(&handle.clone()) {
gltf.named_scenes.iter().for_each(|(name, handle)| { gltf.named_scenes.iter().for_each(|(name, handle)| {
create_asset_button( create_asset_button(
@ -31,7 +33,7 @@ pub fn add_scenes_ui(
ui::TargetAsset { ui::TargetAsset {
handle: handle.clone(), handle: handle.clone(),
}, },
name.clone(), format!("{}/{}", gltf_name, name),
None, None,
); );
}) })

Loading…
Cancel
Save