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

scene_viewer is crashed when loading gltf. #6630

Closed
AllenDang opened this issue Nov 15, 2022 · 1 comment
Closed

scene_viewer is crashed when loading gltf. #6630

AllenDang opened this issue Nov 15, 2022 · 1 comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Bug An unexpected or incorrect behavior C-Examples An addition or correction to our examples

Comments

@AllenDang
Copy link

Bevy version

0.9.0

[Optional] Relevant system information

If you cannot get Bevy to build or run on your machine, please include:

  • the Rust version you're using (you can get this by running cargo --version)
    • cargo 1.65.0 (4bc8f24d3 2022-10-20)
  • the operating system or browser used, including its version
    • macOS 13.0

What you did

run cargo run --release --example scene_viewer /Users/allen/Blender/Gandam/gltf/GDM.glb#Scene0`

What went wrong

scene_viewer crashed with following logs.

❯ cargo run --release --example scene_viewer "/Users/allen/Blender/Gandam/gltf/GDM.glb#Scene0"
    Finished release [optimized] target(s) in 0.13s
     Running `target/release/examples/scene_viewer '/Users/allen/Blender/Gandam/gltf/GDM.glb#Scene0'`

Controls:
    MOUSE       - Move camera orientation
    LClick/M    - Enable mouse movement
    WSAD        - forward/back/strafe left/right
    LShift      - 'run'
    E           - up
    Q           - down
    L           - animate light direction
    U           - toggle shadows
    C           - cycle through the camera controller and any cameras loaded from the scene
    5/6         - decrease/increase shadow projection width
    7/8         - decrease/increase shadow projection height
    9/0         - decrease/increase shadow projection near/far

    Space       - Play/Pause animation
    Enter       - Cycle through animations

2022-11-15T12:11:59.003031Z  INFO bevy_render::renderer: AdapterInfo { name: "Apple M1 Max", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
2022-11-15T12:11:59.131401Z  INFO scene_viewer: Loading /Users/allen/Blender/Gandam/gltf/GDM.glb#Scene0
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', examples/tools/scene_viewer.rs:113:28
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Additional information

The crash occurred at second line.

            if asset_server.get_load_state(&scene_handle.handle) == LoadState::Loaded {
                let gltf = gltf_assets.get(&scene_handle.handle).unwrap();

The scene-handle.handle is valid, and load state is loaded, gltf_assets should be able to get from it, but it returns None.

@AllenDang AllenDang added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Nov 15, 2022
@nicopap nicopap added C-Examples An addition or correction to our examples A-Assets Load files from disk to use for things like images, models, and sounds and removed S-Needs-Triage This issue needs to be labelled labels Nov 15, 2022
@nicopap
Copy link
Contributor

nicopap commented Nov 15, 2022

I can reproduce this.

When I run the scene viewer this way, it works:

cargo run --example scene_viewer -- assets/models/animated/Fox.glb

But if I add the #Scene0 as recommended in the example doc

cargo run --example scene_viewer -- assets/models/animated/Fox.glb#Scene0

It crashes on line 113.

It makes sense that it would crash, since it is looking for an asset, but the scene path was provided. Wonder if it worked before. My suggestion would be to recommend using the raw path without the #Scene0 in the documentation.

@bors bors bot closed this as completed in f4818bc Dec 11, 2022
alradish pushed a commit to alradish/bevy that referenced this issue Jan 22, 2023
# Objective

- Fixes bevyengine#6630, fixes bevyengine#6679
- Improve scene viewer in cases where there are more than one scene in a gltf file

## Solution

- Can select which scene to display using `#SceneN`, defaults to scene 0 if not present
- Display the number of scenes available if there are more than one
ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
# Objective

- Fixes bevyengine#6630, fixes bevyengine#6679
- Improve scene viewer in cases where there are more than one scene in a gltf file

## Solution

- Can select which scene to display using `#SceneN`, defaults to scene 0 if not present
- Display the number of scenes available if there are more than one
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Bug An unexpected or incorrect behavior C-Examples An addition or correction to our examples
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants