-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GltfLoaderSettings #10804
Add GltfLoaderSettings #10804
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation looks good, and this should definitely exist.
I'd like a bit more documentation on how to use this in practice: right now, it's quite hard to piece the usage together.
I think it would also make sense to add a |
It looks like your PR is a breaking change, but you didn't provide a migration guide. Could you add some context on what users should update when this change get released in a new version of Bevy? |
added lights, and meshes for completeness. not sure what makes this a breaking change? anyway i added the struct comment as migration guide, let me know if you want something else. |
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Really nice, thank you! The associated type on a public trait impl changed, which is technically semver breaking: line 144, which then cascades to the |
@robftm missing import in the example :) |
my pc is even worse at running doctests than i am at writing them ... |
# 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>
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 nodesload_meshes
: checked before loading meshes, materials and morph weightsExisting 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: