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

Fix panics in scene_viewer and audio_control #16983

Merged
merged 6 commits into from
Dec 26, 2024

Conversation

rparrett
Copy link
Contributor

@rparrett rparrett commented Dec 26, 2024

Objective

Fixes #16978

While testing, discovered that the morph weight interface in scene_viewer has been broken for a while (panics when loaded model has morph weights), probably since #15591. Fixed that too.

While testing, saw example text in morph interface with wrong padding. Fixed that too. Left the small font size because there may be a lot of morphs to display, so that seems intentional.

Solution

Use normal queries and bail early

Testing

Morph interface can be tested with

cargo run --example scene_viewer assets/models/animated/MorphStressTest.gltf

Discussion

I noticed that this fix is different than what is happening in #16976. Feel free to discard this for an alternative fix. I opened this anyway to document the issue with morph weight display.

This is on top of #16966 which is required to test.

@rparrett rparrett changed the title Example panics Fix panics in scene_viewer and audio_control Dec 26, 2024
@alice-i-cecile alice-i-cecile added C-Examples An addition or correction to our examples A-Cross-Cutting Impacts the entire engine labels Dec 26, 2024
@alice-i-cecile alice-i-cecile added this to the 0.16 milestone Dec 26, 2024
@@ -34,29 +34,48 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
#[derive(Component)]
struct MyMusic;

fn update_speed(sink: Single<&AudioSink, With<MyMusic>>, time: Res<Time>) {
fn update_speed(music_controller: Query<&AudioSink, With<MyMusic>>, time: Res<Time>) {
let Ok(sink) = music_controller.get_single() else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this? I thought Single here was very intentional and intended to replace this pattern. This seems to just ignore invalid state.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single now panics again. Using Option<Single> here would work, but that's kind of a sidegrade.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we can reconfigure the system to ignore failing params

Copy link
Contributor Author

@rparrett rparrett Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's expected that the sink won't be present until PostUpdate on the first frame.

Specifying Single and disabling warnings feels like a dirty way to write this code to me. Option<Single> seems even wackier IMO. But please discuss and feel free to close for an alternative implementation.

Or I can fix it up late tonight or tomorrow if there's consensus the other way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This solution is totally fine, just listing alternatives

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, this solution is fine.

@MiniaczQ
Copy link
Contributor

MiniaczQ commented Dec 26, 2024

Got this while running scene_viewer
bevy_winit::accessibility::update_accessibility_nodes could not access system parameter Res<InputFocus>
but I can't seem to cause it again

Copy link
Contributor

@MiniaczQ MiniaczQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Examples seem fine, the accessibility issue isn't related to #16978
so I'm not pushing to fix it here, especially since there is no reproduction

@mockersf mockersf modified the milestones: 0.16, 0.15.1 Dec 26, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Dec 26, 2024
Merged via the queue into bevyengine:main with commit 78d2149 Dec 26, 2024
28 checks passed
mockersf added a commit that referenced this pull request Jan 3, 2025
Fixes #16978

While testing, discovered that the morph weight interface in
`scene_viewer` has been broken for a while (panics when loaded model has
morph weights), probably since #15591. Fixed that too.

While testing, saw example text in morph interface with [wrong
padding](https://bevyengine.org/learn/contribute/helping-out/creating-examples/#visual-guidelines).
Fixed that too. Left the small font size because there may be a lot of
morphs to display, so that seems intentional.

Use normal queries and bail early

Morph interface can be tested with
```
cargo run --example scene_viewer assets/models/animated/MorphStressTest.gltf
```

I noticed that this fix is different than what is happening in #16976.
Feel free to discard this for an alternative fix. I opened this anyway
to document the issue with morph weight display.

This is on top of #16966 which is required to test.

---------

Co-authored-by: François Mockers <[email protected]>
Co-authored-by: François Mockers <[email protected]>
ecoskey pushed a commit to ecoskey/bevy that referenced this pull request Jan 6, 2025
# Objective

Fixes bevyengine#16978

While testing, discovered that the morph weight interface in
`scene_viewer` has been broken for a while (panics when loaded model has
morph weights), probably since bevyengine#15591. Fixed that too.

While testing, saw example text in morph interface with [wrong
padding](https://bevyengine.org/learn/contribute/helping-out/creating-examples/#visual-guidelines).
Fixed that too. Left the small font size because there may be a lot of
morphs to display, so that seems intentional.

## Solution

Use normal queries and bail early

## Testing

Morph interface can be tested with
```
cargo run --example scene_viewer assets/models/animated/MorphStressTest.gltf
```

## Discussion

I noticed that this fix is different than what is happening in bevyengine#16976.
Feel free to discard this for an alternative fix. I opened this anyway
to document the issue with morph weight display.

This is on top of bevyengine#16966 which is required to test.

---------

Co-authored-by: François Mockers <[email protected]>
Co-authored-by: François Mockers <[email protected]>
mrchantey pushed a commit to mrchantey/bevy that referenced this pull request Feb 4, 2025
# Objective

Fixes bevyengine#16978

While testing, discovered that the morph weight interface in
`scene_viewer` has been broken for a while (panics when loaded model has
morph weights), probably since bevyengine#15591. Fixed that too.

While testing, saw example text in morph interface with [wrong
padding](https://bevyengine.org/learn/contribute/helping-out/creating-examples/#visual-guidelines).
Fixed that too. Left the small font size because there may be a lot of
morphs to display, so that seems intentional.

## Solution

Use normal queries and bail early

## Testing

Morph interface can be tested with
```
cargo run --example scene_viewer assets/models/animated/MorphStressTest.gltf
```

## Discussion

I noticed that this fix is different than what is happening in bevyengine#16976.
Feel free to discard this for an alternative fix. I opened this anyway
to document the issue with morph weight display.

This is on top of bevyengine#16966 which is required to test.

---------

Co-authored-by: François Mockers <[email protected]>
Co-authored-by: François Mockers <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Cross-Cutting Impacts the entire engine C-Examples An addition or correction to our examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

scene_viewer and audio_control examples panic
5 participants