Skip to content

Commit

Permalink
Add GltfLoaderSettings (#10804)
Browse files Browse the repository at this point in the history
# Objective

when loading gltfs we may want to filter the results. in particular, i
need to be able to exclude cameras.

i can do this already by modifying the gltf after load and before
spawning, but it seems like a useful general option.

## Solution

add `GltfLoaderSettings` struct with bool members:
- `load_cameras` : checked before processing camera nodes.
- `load_lights` : checked before processing light nodes
- `load_meshes` : checked before loading meshes, materials and morph
weights

Existing code will work as before. Now you also have the option to
restrict what parts of the gltf are loaded. For example, to load a gltf
but exclude the cameras, replace a call to
`asset_server.load("my.gltf")` with:
```rust
asset_server.load_with_settings(
    "my.gltf",
    |s: &mut GltfLoaderSettings| {
        s.load_cameras = false;
    }
);
```

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
  • Loading branch information
robtfm and alice-i-cecile committed Nov 30, 2023
1 parent 0a588db commit 74ead1e
Showing 1 changed file with 208 additions and 159 deletions.
Loading

0 comments on commit 74ead1e

Please sign in to comment.