Skip to content

Commit 0cb3eae

Browse files
authored
Fix validation errors in Fox.glb (#17801)
# Objective Fix gltf validation errors in `Fox.glb`. Inspired by #8099, but that issue doesn't appear to describe a real bug to fix, as far as I can tell. ## Solution Use the latest version of the Fox from [glTF-Sample-Assets](https://github.com/KhronosGroup/glTF-Sample-Assets/blob/main/Models/Fox/glTF-Binary/Fox.glb). ## Testing Dropped both versions in https://github.khronos.org/glTF-Validator/ `cargo run --example animated_mesh` seems to still look fine. Before: ``` The asset contains errors. "numErrors": 126, "numWarnings": 4184, ``` After: ``` The asset is valid. "numErrors": 0, "numWarnings": 0, ``` ## Discussion The 3d testbed was panicking with ``` thread 'main' panicked at examples/testbed/3d.rs:288:60: called `Result::unwrap()` on an `Err` value: QueryDoesNotMatch(35v1 with components Transform, GlobalTransform, Visibility, InheritedVisibility, ViewVisibility, ChildOf, Children, Name) ``` Which is bizarre. I think this might be related to #17720, or maybe the structure of the gltf changed. I fixed it by using updating the testbed to use a more robust method of finding the correct entity as is done in `animated_mesh`.
1 parent aa8793f commit 0cb3eae

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

Diff for: CREDITS.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* Epic orchestra music sample, modified to loop, from [Migfus20](https://freesound.org/people/Migfus20/sounds/560449/) ([CC BY 4.0 DEED](https://creativecommons.org/licenses/by/4.0/))
3333

3434
[MorphStressTest]: https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/MorphStressTest
35-
[fox]: https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/Fox
35+
[fox]: https://github.com/KhronosGroup/glTF-Sample-Assets/tree/main/Models/Fox
3636
[by PixelMannen]: https://opengameart.org/content/fox-and-shiba
3737
[by @tomkranis on Sketchfab]: https://sketchfab.com/models/371dea88d7e04a76af5763f2a36866bc
3838
[CC-BY 4.0]: https://creativecommons.org/licenses/by/4.0/

Diff for: assets/models/animated/Fox.glb

-4 Bytes
Binary file not shown.

Diff for: examples/testbed/3d.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -282,19 +282,19 @@ mod animation {
282282
animation: Res<Animation>,
283283
mut players: Query<(Entity, &mut AnimationPlayer)>,
284284
) {
285-
let entity = children.get(trigger.target()).unwrap()[0];
286-
let entity = children.get(entity).unwrap()[0];
287-
288-
let (entity, mut player) = players.get_mut(entity).unwrap();
289-
let mut transitions = AnimationTransitions::new();
290-
transitions
291-
.play(&mut player, animation.animation, Duration::ZERO)
292-
.seek_to(0.5)
293-
.pause();
294-
295-
commands
296-
.entity(entity)
297-
.insert(AnimationGraphHandle(animation.graph.clone()))
298-
.insert(transitions);
285+
for child in children.iter_descendants(trigger.target()) {
286+
if let Ok((entity, mut player)) = players.get_mut(child) {
287+
let mut transitions = AnimationTransitions::new();
288+
transitions
289+
.play(&mut player, animation.animation, Duration::ZERO)
290+
.seek_to(0.5)
291+
.pause();
292+
293+
commands
294+
.entity(entity)
295+
.insert(AnimationGraphHandle(animation.graph.clone()))
296+
.insert(transitions);
297+
}
298+
}
299299
}
300300
}

0 commit comments

Comments
 (0)