Skip to content

Commit

Permalink
docs(gltf_extras): added small description of the newly added gltf_ex…
Browse files Browse the repository at this point in the history
…tras (#1387)

Co-authored-by: Alice Cecile <[email protected]>
  • Loading branch information
kaosat-dev and alice-i-cecile authored Jun 11, 2024
1 parent 59dcbf3 commit ade4ade
Showing 1 changed file with 31 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
<!-- add handling of all missing gltf extras: scene, mesh & materials -->
<!-- https://github.com/bevyengine/bevy/pull/13453 -->

<!-- TODO -->
The glTF 3D model file format allows passing additional user defined metadata in the *extras* properties, and
in addition to the glTF extras at the primitive/node level , Bevy now has specific GltfExtras for:
- scenes: **SceneGltfExtras** injected at the scene level if any
- meshes: **MeshGltfExtras**, injected at the mesh level if any
- materials: **MaterialGltfExtras**, injected at the mesh level if any: ie if a mesh has a material that has gltf extras, the component will be injected there.

You can now easily query for these specific extras

```rust
fn check_for_gltf_extras(
gltf_extras_per_entity: Query<(
Entity,
Option<&Name>,
Option<&GltfSceneExtras>,
Option<&GltfExtras>,
Option<&GltfMeshExtras>,
Option<&GltfMaterialExtras>,
)>,
) {
// use the extras' data
for (id, name, scene_extras, extras, mesh_extras, material_extras) in
gltf_extras_per_entity.iter()
{

}
}

```

This makes passing information from programs such as Blender to Bevy via gltf files more spec compliant, and more practical !

0 comments on commit ade4ade

Please sign in to comment.