-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
only take up to the max number of joints #9351
only take up to the max number of joints #9351
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.
This is the correct fix for the current code.
Though, adding an error/warning log in bevy_gltf/src/loader.rs
at line 500 if we have more joints than max would also help users understand why things break.
added a warning 👍 |
@@ -497,6 +498,16 @@ async fn load_gltf<'a, 'b>( | |||
.map(|node| node_index_to_entity_map[&node.index()]) | |||
.collect(); | |||
|
|||
if joint_entities.len() > MAX_JOINTS && warned_about_max_joints.insert(skin_index) { |
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.
Does this properly short circuit, and not insert into the hashmap if the len <= MAX_JOINTS?
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.
yes that's how &&
works in rust, see https://doc.rust-lang.org/reference/expressions/operator-expr.html#lazy-boolean-operators
# Objective - Meshes with a higher number of joints than `MAX_JOINTS` are crashing - Fixes partly bevyengine#9021 (doesn't crash anymore, but the mesh is not correctly displayed) ## Solution - Only take up to `MAX_JOINTS` joints when extending the buffer
# Objective - Meshes with a higher number of joints than `MAX_JOINTS` are crashing - Fixes partly bevyengine#9021 (doesn't crash anymore, but the mesh is not correctly displayed) ## Solution - Only take up to `MAX_JOINTS` joints when extending the buffer (cherry picked from commit b28f633)
# Objective - Meshes with a higher number of joints than `MAX_JOINTS` are crashing - Fixes partly bevyengine#9021 (doesn't crash anymore, but the mesh is not correctly displayed) ## Solution - Only take up to `MAX_JOINTS` joints when extending the buffer
Objective
MAX_JOINTS
are crashingSolution
MAX_JOINTS
joints when extending the buffer