there are bugs, taking a break to do work on timeline

main
Elijah Voigt 2 years ago
parent 36605781e8
commit 1963c290a1

@ -6,18 +6,6 @@
// * When Handle<T> is loaded, the button for TargetAsset<T> should load as well // * When Handle<T> is loaded, the button for TargetAsset<T> should load as well
// * Exported level should preserve active camera // * Exported level should preserve active camera
// * Picking new GLTF resets audio without resetting buttons // * Picking new GLTF resets audio without resetting buttons
// * Error with exported scene w/ animation:
// WARN bevy_asset::asset_server: encountered an error while loading an asset:
// no registration found for type
// `alloc::vec::Vec<
// alloc::vec::Vec<
// core::option::Option<
// bevy_ecs::entity::Entity
// >>>`
// at output.scn.ron:723:23
// This is the `path_cache` field on an Animation
// ...
// Also many other components out of the box just straight up don't work...
// //
// TODO: // TODO:
// * edit textbox with actions // * edit textbox with actions
@ -31,7 +19,6 @@
use bevy::{ use bevy::{
asset::{Asset, AssetLoader, Assets, ChangeWatcher, LoadContext, LoadedAsset}, asset::{Asset, AssetLoader, Assets, ChangeWatcher, LoadContext, LoadedAsset},
audio::PlaybackMode, audio::PlaybackMode,
core_pipeline::tonemapping::DebandDither,
gltf::Gltf, gltf::Gltf,
prelude::*, prelude::*,
utils::{BoxedFuture, Duration}, utils::{BoxedFuture, Duration},
@ -135,6 +122,18 @@ fn main() {
//rehydrate_level::<DebandDither, Camera3d>, //rehydrate_level::<DebandDither, Camera3d>,
), ),
) )
.add_systems(
Update,
(
sync_asset_buttons::<Font>,
sync_asset_buttons::<AudioSource>,
sync_asset_buttons::<Monologue>,
sync_asset_buttons::<Level>,
sync_asset_buttons::<Gltf>,
sync_asset_buttons::<Scene>,
sync_asset_buttons::<AnimationClip>,
),
)
.run(); .run();
} }
@ -1472,7 +1471,7 @@ mod level {
use super::*; use super::*;
type Level = DynamicScene; pub type Level = DynamicScene;
#[derive(Debug, Component, Default)] #[derive(Debug, Component, Default)]
pub struct LevelWidget; pub struct LevelWidget;
@ -1645,3 +1644,34 @@ mod quit {
exit.send(AppExit); exit.send(AppExit);
} }
} }
use asset_sync::*;
mod asset_sync {
use super::*;
// This sets buttons to active when their associated handle is spawned
// TODO: Remove active when handle is despawned?
// ONLY IF there are no instances of that handle [!any(*)]
pub fn sync_asset_buttons<T: Asset>(
events: Query<&Handle<T>, Added<Handle<T>>>,
buttons: Query<(Entity, &ui::TargetAsset<T>)>,
mut commands: Commands,
) {
events.iter().for_each(|this_handle| {
info!("Syncing {:?}", this_handle);
buttons
.iter()
.find_map(|(entity, ui::TargetAsset { handle })| {
if handle == this_handle {
Some(entity)
} else {
None
}
})
.iter()
.for_each(|&entity| {
commands.entity(entity).insert(ui::Active);
});
});
}
}

Loading…
Cancel
Save