From 3740766157062c99f685510833f06aa520045469 Mon Sep 17 00:00:00 2001 From: Robin KAY Date: Mon, 30 Oct 2023 21:37:37 +0000 Subject: [PATCH] Change morph_targets to use iter_instance_entities(). --- examples/morph_targets.rs | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/examples/morph_targets.rs b/examples/morph_targets.rs index 8636492..e437244 100644 --- a/examples/morph_targets.rs +++ b/examples/morph_targets.rs @@ -7,7 +7,7 @@ //! - How to read morph target names in [`name_morphs`]. //! - How to play morph target animations in [`setup_animations`]. -use bevy::prelude::*; +use bevy::{prelude::*, scene::SceneInstance}; use bevy_mod_outline::{ AutoGenerateOutlineNormalsPlugin, OutlineBundle, OutlinePlugin, OutlineVolume, }; @@ -69,21 +69,26 @@ fn setup(asset_server: Res, mut commands: Commands) { fn setup_outlines( mut commands: Commands, mut has_setup: Local, - meshes: Query>>, + scene_query: Query<&SceneInstance>, + scene_manager: Res, ) { if *has_setup { return; } - for entity in &meshes { - commands.entity(entity).insert(OutlineBundle { - outline: OutlineVolume { - visible: true, - width: 3.0, - colour: Color::RED, - }, - ..default() - }); - *has_setup = true; + if let Ok(scene) = scene_query.get_single() { + if scene_manager.instance_is_ready(**scene) { + for entity in scene_manager.iter_instance_entities(**scene) { + commands.entity(entity).insert(OutlineBundle { + outline: OutlineVolume { + visible: true, + width: 3.0, + colour: Color::RED, + }, + ..default() + }); + *has_setup = true; + } + } } }