From 930033354b4ca29c24b0072267c14fe1471cea5b Mon Sep 17 00:00:00 2001 From: andriyDev Date: Sat, 25 May 2024 19:26:55 -0700 Subject: [PATCH] Switch to using the SceneInstance component to determine the nearest Gltf. --- crates/bevy_gltf_component_refs/Cargo.toml | 5 +---- crates/bevy_gltf_component_refs/src/lib.rs | 5 ++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/crates/bevy_gltf_component_refs/Cargo.toml b/crates/bevy_gltf_component_refs/Cargo.toml index 9eb7718..5a1ce15 100644 --- a/crates/bevy_gltf_component_refs/Cargo.toml +++ b/crates/bevy_gltf_component_refs/Cargo.toml @@ -14,10 +14,7 @@ license = "MIT OR Apache-2.0" workspace = true [dependencies] -bevy = { version = "0.13", default-features = false, features = [ - "bevy_asset", - "bevy_scene", -] } +bevy = { version = "0.13", default-features = false, features = ["bevy_scene"] } bevy_gltf_components = { version = "0.5", path = "../bevy_gltf_components" } [dev-dependencies] diff --git a/crates/bevy_gltf_component_refs/src/lib.rs b/crates/bevy_gltf_component_refs/src/lib.rs index 628111f..945204c 100644 --- a/crates/bevy_gltf_component_refs/src/lib.rs +++ b/crates/bevy_gltf_component_refs/src/lib.rs @@ -1,6 +1,5 @@ use bevy::{ app::{App, Plugin}, - asset::Handle, ecs::{ component::Component, entity::Entity, @@ -13,7 +12,7 @@ use bevy::{ log::warn, prelude::Update, reflect::{Reflect, TypePath}, - scene::Scene, + scene::SceneInstance, utils::HashMap, }; use bevy_gltf_components::GltfComponentsSet; @@ -157,7 +156,7 @@ impl Default for GltfRefPlugin { /// SystemParam to find the Gltf that an entity belongs to. #[derive(SystemParam)] pub struct GltfForEntity<'w, 's> { - gltfs: Query<'w, 's, (), With>>, + gltfs: Query<'w, 's, (), With>, hierarchy: Query<'w, 's, &'static Parent>, }