not loving the rough edges on gltf spawning...

main
Elijah Voigt 2 years ago
parent aba9415ad6
commit dc8b0e73ce

@ -39,7 +39,7 @@ const WELCOME_MESSAGES: &'static [&'static str] = &[
"* 3D: .gltf, .glb\n",
"* Audio: .ogg\n",
"* Font: .ttf, .otf\n",
"* Monologues: .monologue.txt\n",
"* Monologues: .monologue.txt",
),
];
@ -748,11 +748,13 @@ 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);
// Spawn new tree
create_asset_button(
let e = create_asset_button(
&widget,
&mut commands,
ui::TargetAsset {
@ -761,6 +763,10 @@ 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(
@ -1158,14 +1164,20 @@ mod cameras {
destroy_entity_button(&current, &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);
create_entity_button(
let e = create_entity_button(
&widget,
&mut commands,
ui::TargetEntity { entity },
name.as_str().into(),
);
camera.is_active = false;
if empty {
commands.entity(e).insert(ui::Active);
} else {
camera.is_active = false;
}
});
}

Loading…
Cancel
Save