Skip to content
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

Attempting to load a GltfPrimitive directly from a file path causes it to be stuck loading forever. #17661

Closed
rydb opened this issue Feb 3, 2025 · 7 comments
Labels
C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled

Comments

@rydb
Copy link

rydb commented Feb 3, 2025

Bevy version

0.15.1

What you did

I attempted to load a gltf primitive with:

primitive.0 = Some(asset_server.load("cube.glb#Mesh0/Primitive0"));

However, the asset will never finish loading.

let path = handle.path().unwrap();

match asset_server.load_state(handle) {
    bevy::asset::LoadState::NotLoaded => println!("not loaded {:#}", path),
    // perpetually stuck loading here, but no error from the asset loader about being an invalid asset?
    bevy::asset::LoadState::Loading => {
        println!("loading {:#?}", path)
    }
    bevy::asset::LoadState::Loaded => {
        println!("loaded {:#}", path);
        primitive.0 = None;
    }
    bevy::asset::LoadState::Failed(asset_load_error) => {
        println!("failed to load {:#}. REASON: {:#}", path, asset_load_error)
    }
}

I re-created a minimal example of the bug at the repo here:
https://github.com/rydb/bug_example

@rydb rydb added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Feb 3, 2025
@hukasu
Copy link
Contributor

hukasu commented Feb 11, 2025

this is because you are trying to load the asset label Mesh0/Primitive0 as an GltfPrimitive when it is a Mesh
you can see the types that the asset labels map to here https://docs.rs/bevy/latest/bevy/gltf/enum.GltfAssetLabel.html#variants

@hukasu
Copy link
Contributor

hukasu commented Feb 11, 2025

the lack of warning is an issue, yes

@rydb
Copy link
Author

rydb commented Feb 11, 2025

this is because you are trying to load the asset label Mesh0/Primitive0 as an GltfPrimitive when it is a Mesh you can see the types that the asset labels map to here https://docs.rs/bevy/latest/bevy/gltf/enum.GltfAssetLabel.html#variants

this means the issue is that loading a GltfPrimitive does not give a Handle<GltfPrimitive>. Loading a GltfMesh and GltfNode correctly return a Handle<GltfMesh> and Handle<GltfNode> respectively, but that means GltfPrimitive is inconsistent with the rest of the Gltf sub-assets then.

@hukasu
Copy link
Contributor

hukasu commented Feb 11, 2025

yes, the name is misleading

@rydb
Copy link
Author

rydb commented Feb 11, 2025

yes, the name is misleading

The name is correct in gltf's context.. GltfAssetLabel::Primitive is incorrect and needs to be fixed though.

@hukasu
Copy link
Contributor

hukasu commented Feb 11, 2025

@rparrett what is the course of action here?

@rparrett
Copy link
Contributor

rparrett commented Feb 11, 2025

This seems like a duplicate of #17325, or closely related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled
Projects
None yet
Development

No branches or pull requests

4 participants