Skip to content

Commit

Permalink
Add extras field to GltfNode
Browse files Browse the repository at this point in the history
  • Loading branch information
alradish committed Jan 22, 2023
1 parent 7a176ae commit 12fbea3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/bevy_gltf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pub struct GltfNode {
pub children: Vec<GltfNode>,
pub mesh: Option<Handle<GltfMesh>>,
pub transform: bevy_transform::prelude::Transform,
pub extras: Option<GltfExtras>,
}

/// A glTF mesh, which may consist of multiple [`GltfPrimitives`](GltfPrimitive).
Expand Down
7 changes: 7 additions & 0 deletions crates/bevy_gltf/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,12 @@ async fn load_gltf<'a, 'b>(
scale: bevy_math::Vec3::from(scale),
},
},
extras: node
.mesh()
.and_then(|mesh| mesh.extras().as_ref())
.map(|extras| super::GltfExtras {
value: extras.get().to_string(),
}),
},
node.children()
.map(|child| child.index())
Expand Down Expand Up @@ -1166,6 +1172,7 @@ mod test {
children: vec![],
mesh: None,
transform: bevy_transform::prelude::Transform::IDENTITY,
extras: None,
}
}
}
Expand Down

0 comments on commit 12fbea3

Please sign in to comment.