|
|
|
|
@ -9,7 +9,13 @@
|
|
|
|
|
// * Easy despawn when de-selecting gltf
|
|
|
|
|
//
|
|
|
|
|
// TODO:
|
|
|
|
|
// * (easy) Play all animations
|
|
|
|
|
// * Disable auto start/load
|
|
|
|
|
// * Make GLTF nested menu
|
|
|
|
|
// * Better handle hide/close monologue
|
|
|
|
|
// * (hard) Harden Active Camera
|
|
|
|
|
// * (medium) Select Font -> "Default Font" Resource
|
|
|
|
|
// * (medium) Pre-compute animation target entities
|
|
|
|
|
// * (medium) Animation buttons only visible when playable
|
|
|
|
|
// * (easy) Clear button to wipe spawned scene
|
|
|
|
|
// * (brutal) export level
|
|
|
|
|
// * (hard) import level
|
|
|
|
|
@ -224,7 +230,7 @@ fn initialize_ui(mut commands: Commands) {
|
|
|
|
|
content_containers.push(spawn_tab_container::<SceneWidget>(
|
|
|
|
|
"Scene",
|
|
|
|
|
parent,
|
|
|
|
|
ui::Select::Multi,
|
|
|
|
|
ui::Select::Single,
|
|
|
|
|
));
|
|
|
|
|
content_containers.push(spawn_tab_container::<AnimationWidget>(
|
|
|
|
|
"Animation",
|
|
|
|
|
@ -553,22 +559,6 @@ mod assets {
|
|
|
|
|
commands.entity(entity).despawn_recursive();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn has_extensions<T: Asset>(
|
|
|
|
|
server: &AssetServer,
|
|
|
|
|
handle: Handle<T>,
|
|
|
|
|
extensions: &[&'static str],
|
|
|
|
|
) -> bool {
|
|
|
|
|
if let Some(asset_path) = server.get_handle_path(handle.clone()) {
|
|
|
|
|
if let Some(extension) = asset_path.path().extension() {
|
|
|
|
|
extensions.iter().any(|&check| check == extension)
|
|
|
|
|
} else {
|
|
|
|
|
false
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
use gltf::*;
|
|
|
|
|
@ -764,8 +754,6 @@ mod scenes {
|
|
|
|
|
current: Query<(Entity, &ui::TargetAsset<Scene>)>,
|
|
|
|
|
) {
|
|
|
|
|
events.iter().for_each(|event| {
|
|
|
|
|
let empty = current.iter().len() == 0;
|
|
|
|
|
|
|
|
|
|
match event {
|
|
|
|
|
CustomAssetEvent::Add { name, handle } => {
|
|
|
|
|
info!("Asset loading! {:?}({:?})", name, handle);
|
|
|
|
|
@ -779,10 +767,6 @@ mod scenes {
|
|
|
|
|
name.clone(),
|
|
|
|
|
None,
|
|
|
|
|
);
|
|
|
|
|
// If this is the first scene being added, set it as active
|
|
|
|
|
if empty {
|
|
|
|
|
commands.entity(e).insert(ui::Active);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
CustomAssetEvent::Remove { handle } => {
|
|
|
|
|
destroy_asset_button(
|
|
|
|
|
@ -1151,10 +1135,8 @@ mod monologues {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(BUG): Better handle hide/close monologue
|
|
|
|
|
pub fn show_preview_text(
|
|
|
|
|
added: Query<Entity, (With<Button>, Added<ui::Active>)>,
|
|
|
|
|
mut removed: RemovedComponents<ui::Active>,
|
|
|
|
|
monologue_handles: Query<&ui::TargetAsset<Monologue>>,
|
|
|
|
|
monologues: Res<Assets<Monologue>>,
|
|
|
|
|
container: Query<Entity, With<MonologueContainer>>,
|
|
|
|
|
@ -1246,8 +1228,6 @@ mod cameras {
|
|
|
|
|
destroy_entity_button(¤t, &mut commands, &ui::TargetEntity { entity });
|
|
|
|
|
});
|
|
|
|
|
added.iter_mut().for_each(|(entity, mut camera, name)| {
|
|
|
|
|
let empty = current.iter().len() == 0;
|
|
|
|
|
|
|
|
|
|
info!("Camera added {:?} {:?}", entity, name);
|
|
|
|
|
let e = create_entity_button(
|
|
|
|
|
&widget,
|
|
|
|
|
@ -1255,11 +1235,7 @@ mod cameras {
|
|
|
|
|
ui::TargetEntity { entity },
|
|
|
|
|
name.as_str().into(),
|
|
|
|
|
);
|
|
|
|
|
if empty {
|
|
|
|
|
commands.entity(e).insert(ui::Active);
|
|
|
|
|
} else {
|
|
|
|
|
camera.is_active = false;
|
|
|
|
|
}
|
|
|
|
|
camera.is_active = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|