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 untyped labeled asset loading #10514

Merged
merged 6 commits into from
Nov 14, 2023
Merged

Fix untyped labeled asset loading #10514

merged 6 commits into from
Nov 14, 2023

Conversation

cart
Copy link
Member

@cart cart commented Nov 11, 2023

Objective

Fixes #10436
Alternative to #10465

Solution

load_untyped_async / load_internal currently has a bug. In load_untyped_async, we pass None into load_internal for the UntypedHandle of the labeled asset path. This results in a call to get_or_create_path_handle_untyped with loader.asset_type_id()
This is a new code path that wasn't hit prior to the newly added load_untyped because load_untyped_async was a private method only used in the context of the load_folder impl (which doesn't have labels)

The fix required some refactoring to catch that case and defer handle retrieval. I have also made load_untyped_async public as it is now "ready for public use" and unlocks new scenarios.

@cart cart added the A-Assets Load files from disk to use for things like images, models, and sounds label Nov 11, 2023
@cart cart added this to the 0.12.1 milestone Nov 11, 2023
@alice-i-cecile
Copy link
Member

@Selene-Amanita, can you test and review this please?

@Braymatter
Copy link
Contributor

Looks good to me

Copy link
Member

@NiklasEi NiklasEi left a comment

Choose a reason for hiding this comment

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

I verified that this fixes the original problem and the changes look fine to me.

crates/bevy_asset/src/server/mod.rs Show resolved Hide resolved
crates/bevy_asset/src/server/mod.rs Show resolved Hide resolved
@cart cart enabled auto-merge November 14, 2023 02:25
@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels Nov 14, 2023
@cart cart added this pull request to the merge queue Nov 14, 2023
Merged via the queue into bevyengine:main with commit 749f3d7 Nov 14, 2023
23 checks passed
cart added a commit that referenced this pull request Nov 30, 2023
# Objective

Fixes #10436
Alternative to #10465 

## Solution

`load_untyped_async` / `load_internal` currently has a bug. In
`load_untyped_async`, we pass None into `load_internal` for the
`UntypedHandle` of the labeled asset path. This results in a call to
`get_or_create_path_handle_untyped` with `loader.asset_type_id()`
This is a new code path that wasn't hit prior to the newly added
`load_untyped` because `load_untyped_async` was a private method only
used in the context of the `load_folder` impl (which doesn't have
labels)

The fix required some refactoring to catch that case and defer handle
retrieval. I have also made `load_untyped_async` public as it is now
"ready for public use" and unlocks new scenarios.
rdrpenguin04 pushed a commit to rdrpenguin04/bevy that referenced this pull request Jan 9, 2024
# Objective

Fixes bevyengine#10436
Alternative to bevyengine#10465 

## Solution

`load_untyped_async` / `load_internal` currently has a bug. In
`load_untyped_async`, we pass None into `load_internal` for the
`UntypedHandle` of the labeled asset path. This results in a call to
`get_or_create_path_handle_untyped` with `loader.asset_type_id()`
This is a new code path that wasn't hit prior to the newly added
`load_untyped` because `load_untyped_async` was a private method only
used in the context of the `load_folder` impl (which doesn't have
labels)

The fix required some refactoring to catch that case and defer handle
retrieval. I have also made `load_untyped_async` public as it is now
"ready for public use" and unlocks new scenarios.
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 S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

load_untyped has issues loading scenes from gltf files
4 participants