From 2433f6386deb4990aca84345381b6b7c21d67372 Mon Sep 17 00:00:00 2001 From: Elijah Voigt Date: Tue, 12 Sep 2023 20:39:00 -0700 Subject: [PATCH] saving my place --- bin/editor.rs | 572 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 541 insertions(+), 31 deletions(-) diff --git a/bin/editor.rs b/bin/editor.rs index 623bfd7..91488fd 100644 --- a/bin/editor.rs +++ b/bin/editor.rs @@ -64,6 +64,7 @@ fn main() { .init_resource::() .add_asset::() .init_asset_loader::() + .add_event::() .add_systems(Startup, (initialize_ui, init_texts_ui, welcome_message)) .add_systems(Update, quit.run_if(ui::activated::)) .add_systems( @@ -81,7 +82,7 @@ fn main() { (remove_scenes_ui, add_scenes_ui, control_active_scenes), ) .add_systems(Update, (cameras_ui, manage_active_camera, fallback_camera)) - .add_systems(Update, (audio_ui, play_audio, pause_audio)) + .add_systems(Update, (audio_ui, play_audio, pause_audio, control_audio)) .add_systems( Update, ( @@ -126,12 +127,41 @@ fn main() { Update, ( sync_asset_buttons::, + sync_remove_asset_buttons::, sync_asset_buttons::, + sync_remove_asset_buttons::, sync_asset_buttons::, + sync_remove_asset_buttons::, sync_asset_buttons::, + sync_remove_asset_buttons::, sync_asset_buttons::, + sync_remove_asset_buttons::, sync_asset_buttons::, + sync_remove_asset_buttons::, sync_asset_buttons::, + sync_remove_asset_buttons::, + ), + ) + .add_systems( + Update, + ( + add_timeline_epoch.run_if(ui::activated::), + set_epoch_gltf, + load_epoch_gltf, + set_epoch_scene, + load_epoch_scene, + set_epoch_camera, + load_epoch_camera, + set_epoch_music, + load_epoch_music, + set_epoch_monologue, + load_epoch_monologue, + set_epoch_font, + load_epoch_font, + set_epoch_sfx, + load_epoch_sfx, + set_epoch_animations, + load_epoch_animations, ), ) .run(); @@ -184,6 +214,7 @@ fn initialize_ui(mut commands: Commands) { ..default() }; + // Assets widget commands .spawn(NodeBundle { style: Style { @@ -328,6 +359,8 @@ fn initialize_ui(mut commands: Commands) { ui::Sorting(0), )); }); + + // Actions widget commands .spawn(NodeBundle { style: Style { @@ -422,6 +455,88 @@ fn initialize_ui(mut commands: Commands) { ui::Sorting(0), )); }); + + // Actions widget + commands + .spawn(NodeBundle { + style: Style { + bottom: Val::Px(0.0), + right: Val::Px(0.0), + position_type: PositionType::Absolute, + border: UiRect::all(Val::Px(1.0)), + margin: UiRect::all(Val::Px(1.0)), + padding: UiRect::all(Val::Px(1.0)), + flex_direction: FlexDirection::Column, + overflow: Overflow::clip(), + ..default() + }, + background_color: Color::WHITE.into(), + border_color: Color::BLACK.into(), + ..default() + }) + .with_children(|parent| { + let container = parent + .spawn(( + NodeBundle { + style: Style { + border: UiRect::all(Val::Px(1.0)), + margin: UiRect::all(Val::Px(1.0)), + padding: UiRect::all(Val::Px(1.0)), + flex_direction: FlexDirection::Row, + overflow: Overflow::clip(), + ..default() + }, + background_color: Color::WHITE.into(), + border_color: Color::BLACK.into(), + ..default() + }, + ui::Sorting(99), + ui::Select::Single, + TimelineWidget, + )) + .with_children(|parent| { + // "Add Epoch" button + parent + .spawn(( + NodeBundle { + style: Style { + border: UiRect::all(Val::Px(1.0)), + margin: UiRect::all(Val::Px(1.0)), + padding: UiRect::all(Val::Px(1.0)), + flex_direction: FlexDirection::Row, + align_items: AlignItems::Center, + justify_items: JustifyItems::Center, + overflow: Overflow::clip(), + ..default() + }, + background_color: Color::WHITE.into(), + border_color: Color::BLACK.into(), + ..default() + }, + ui::Select::Action, + )) + .with_children(|parent| { + parent.spawn(( + simple_button.clone(), + AddEpoch, + ui::Title { + text: "+".into(), + ..default() + }, + )); + }); + }) + .id(); + parent.spawn(( + ui::TitleBarBase::new(Color::WHITE).bundle(), + ui::Title { + text: "Timeline".into(), + ..default() + }, + ui::Minimize { target: container }, + ui::Sorting(0), + )); + }); } fn welcome_message(mut writer: EventWriter) { @@ -522,49 +637,79 @@ mod audio { }); } - pub fn play_audio( - events: Query<&ui::TargetAsset, (With