mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 20:53:53 +00:00
insert the gltf mesh name on the entity if there is one (#4119)
# Objective - In glTF, mesh can be named. This named is used to be able to reference the mesh, but not as a component on the entity - Bevy only added the node name to the parent node. ## Solution - Also adds the name on the mesh entity if there is one. Limitation: In glTF, it's possible to have one mesh (which can be named) corresponding to several primitives (which can't, but are the actual mesh). I added the mesh name to the entity with the `PbrBundle` matching the primitives, which means that a mesh with several primitives would all have the same name. I think this is acceptable...
This commit is contained in:
parent
4feb0d520a
commit
d478723e19
1 changed files with 3 additions and 0 deletions
|
@ -801,6 +801,9 @@ fn load_node(
|
|||
value: extras.get().to_string(),
|
||||
});
|
||||
}
|
||||
if let Some(name) = mesh.name() {
|
||||
mesh_entity.insert(Name::new(name.to_string()));
|
||||
}
|
||||
// Mark for adding skinned mesh
|
||||
if let Some(skin) = gltf_node.skin() {
|
||||
entity_to_skin_index_map.insert(mesh_entity.id(), skin.index());
|
||||
|
|
Loading…
Reference in a new issue