Skip to content

Commit

Permalink
System implemented, awaiting merge of pr bevyengine#3772
Browse files Browse the repository at this point in the history
  • Loading branch information
Troels Peter Jessen committed Apr 4, 2022
1 parent 28d0a40 commit db2c890
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions examples/tools/scene_viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Controls:
.add_system(check_camera_controller)
.add_system(update_lights)
.add_system(camera_controller.after(check_camera_controller))
.add_system(scene_dropped)
.add_system(start_animation)
.add_system(keyboard_animation_control)
.run();
Expand Down Expand Up @@ -83,6 +84,28 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
});
}

fn scene_dropped(
mut commands: Commands,
asset_server: Res<AssetServer>,
mut drop_events: EventReader<FileDragAndDrop>,
) {
for event in drop_events.iter() {
println!("Event happened: {event:?}");
if let FileDragAndDrop::DroppedFile { path_buf, .. } = event {
info!("Loading {}", path_buf.to_str().unwrap());

commands.insert_resource(SceneHandle {
handle: asset_server.load(path_buf.as_path()),
animations: Vec::new(),
instance_id: None,
is_loaded: false,
has_camera: false,
has_light: false,
});
}
}
}

fn scene_load_check(
asset_server: Res<AssetServer>,
mut scenes: ResMut<Assets<Scene>>,
Expand Down

0 comments on commit db2c890

Please sign in to comment.