From 9a915c04ac755a12c6705fec30a66da60b4fffe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Mockers?= Date: Thu, 24 Dec 2020 04:06:26 +0100 Subject: [PATCH] add labels with node names --- crates/bevy_gltf/Cargo.toml | 1 + crates/bevy_gltf/src/loader.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/crates/bevy_gltf/Cargo.toml b/crates/bevy_gltf/Cargo.toml index 42ff880caa627..e21f8806c5cab 100644 --- a/crates/bevy_gltf/Cargo.toml +++ b/crates/bevy_gltf/Cargo.toml @@ -16,6 +16,7 @@ keywords = ["bevy"] # bevy bevy_app = { path = "../bevy_app", version = "0.4.0" } bevy_asset = { path = "../bevy_asset", version = "0.4.0" } +bevy_core = { path = "../bevy_core", version = "0.4.0" } bevy_ecs = { path = "../bevy_ecs", version = "0.4.0" } bevy_pbr = { path = "../bevy_pbr", version = "0.4.0" } bevy_reflect = { path = "../bevy_reflect", version = "0.4.0", features = ["bevy"] } diff --git a/crates/bevy_gltf/src/loader.rs b/crates/bevy_gltf/src/loader.rs index 14ba2cf2eee06..30860e2bb5350 100644 --- a/crates/bevy_gltf/src/loader.rs +++ b/crates/bevy_gltf/src/loader.rs @@ -1,5 +1,6 @@ use anyhow::Result; use bevy_asset::{AssetIoError, AssetLoader, AssetPath, Handle, LoadContext, LoadedAsset}; +use bevy_core::Labels; use bevy_ecs::{bevy_utils::BoxedFuture, World, WorldBuilderSource}; use bevy_math::Mat4; use bevy_pbr::prelude::{PbrBundle, StandardMaterial}; @@ -316,6 +317,10 @@ fn load_node( GlobalTransform::default(), )); + if let Some(name) = gltf_node.name() { + node.with(Labels::from(vec![name.to_string()])); + } + // create camera node if let Some(camera) = gltf_node.camera() { node.with(VisibleEntities {