Skip to content

Commit

Permalink
add labels with node names
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Dec 28, 2020
1 parent df4ef7e commit 9a915c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/bevy_gltf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
5 changes: 5 additions & 0 deletions crates/bevy_gltf/src/loader.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 9a915c0

Please sign in to comment.