Dealing with scene import woes
parent
3545aa227c
commit
93d07f1a42
@ -1,5 +1,26 @@
|
||||
# Inspect Model
|
||||
# Exploration
|
||||
|
||||
- [ ] Load previews on startup.
|
||||
- [ ] Click to "Open" a model.
|
||||
## Inspectors
|
||||
|
||||
### Model Inspector
|
||||
|
||||
- [ ] Construct Scene from Nodes/Meshes (not auto-scene builder)
|
||||
- [ ] Show debug info about selected model
|
||||
- [ ] Wireframe view
|
||||
- [ ] Automatic tighter bounding box for selection
|
||||
|
||||
### Audio Inspector
|
||||
|
||||
- [ ] UI for selecting sound
|
||||
- [ ] Play/Pause/Volume
|
||||
- [x] Load sounds
|
||||
- [ ] Scrolling list of sounds
|
||||
|
||||
## WASM
|
||||
|
||||
- [ ] Build and run using model/text inspector
|
||||
- https://github.com/bevyengine/bevy/blob/main/examples/README.md#wasm
|
||||
|
||||
## Text Inspector
|
||||
|
||||
- [ ] Performance improvements?
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,114 @@
|
||||
use bevy::prelude::*;
|
||||
use monologue_trees::debug::*;
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.add_plugins((
|
||||
DefaultPlugins.set(WindowPlugin {
|
||||
primary_window: Some(Window {
|
||||
title: "Audio Inspect".into(),
|
||||
resolution: (640., 480.).into(),
|
||||
..default()
|
||||
}),
|
||||
..default()
|
||||
}),
|
||||
DebugInfoPlugin,
|
||||
))
|
||||
.add_systems(PreStartup, (load,))
|
||||
.add_systems(Startup, (init,))
|
||||
.add_systems(Update, (save, update))
|
||||
.run()
|
||||
}
|
||||
|
||||
/// Stores audio handles so they don't get dropped
|
||||
#[derive(Component, Debug)]
|
||||
struct AudioItem(Handle<AudioSource>);
|
||||
|
||||
#[derive(Component)]
|
||||
struct Container;
|
||||
|
||||
///
|
||||
/// Load audio assets
|
||||
/// TODO: Does this load new items when they're added to the folder?
|
||||
fn load(server: Res<AssetServer>) {
|
||||
// To prevent handles from being dropped,
|
||||
// they are stored on entities created triggered on AssetEvent<AudioSource>::Created
|
||||
let _yeet = server.load_folder("audio").expect("Load audios");
|
||||
}
|
||||
|
||||
///
|
||||
/// Initialize audio inspector UI
|
||||
fn init(mut commands: Commands) {
|
||||
commands.spawn(Camera3dBundle { ..default() });
|
||||
|
||||
commands
|
||||
.spawn((
|
||||
NodeBundle {
|
||||
style: Style {
|
||||
width: Val::Percent(100.0),
|
||||
height: Val::Percent(100.0),
|
||||
align_items: AlignItems::FlexStart,
|
||||
flex_direction: FlexDirection::Column,
|
||||
..default()
|
||||
},
|
||||
background_color: BackgroundColor(Color::MIDNIGHT_BLUE),
|
||||
..default()
|
||||
},
|
||||
Container,
|
||||
))
|
||||
.with_children(|parent| {
|
||||
// Something might go here...
|
||||
});
|
||||
}
|
||||
|
||||
///
|
||||
/// Save loaded audio sources to entities
|
||||
fn save(
|
||||
mut audio_load_events: EventReader<AssetEvent<AudioSource>>,
|
||||
server: Res<AssetServer>,
|
||||
mut commands: Commands,
|
||||
container_q: Query<Entity, With<Container>>,
|
||||
) {
|
||||
for event in audio_load_events.iter() {
|
||||
match event {
|
||||
AssetEvent::Created { handle } => {
|
||||
let style = TextStyle {
|
||||
color: Color::BLACK,
|
||||
font_size: 16.0,
|
||||
..default()
|
||||
};
|
||||
let handle_path = server
|
||||
.get_handle_path(handle.clone())
|
||||
.expect("Get handle path");
|
||||
let path = handle_path.path().to_str().expect("Convert path to str");
|
||||
let title = path
|
||||
.split("/")
|
||||
.last()
|
||||
.expect("Extracting filename")
|
||||
.trim_end_matches(".ogg");
|
||||
|
||||
commands
|
||||
.spawn((
|
||||
ButtonBundle {
|
||||
style: Style { ..default() },
|
||||
..default()
|
||||
},
|
||||
AudioItem(handle.clone()),
|
||||
))
|
||||
.with_children(|parent| {
|
||||
parent.spawn(TextBundle::from_section(title, style));
|
||||
})
|
||||
.set_parent(container_q.single());
|
||||
}
|
||||
AssetEvent::Modified { .. } => {
|
||||
debug_assert!(false, "Audio file was modified, not handled!")
|
||||
}
|
||||
AssetEvent::Removed { .. } => {
|
||||
debug_assert!(false, "Audio file was deleted, not handled!")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Update loop; play/pause/volume
|
||||
fn update() {}
|
||||
Loading…
Reference in New Issue