-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Fix duplicate asset loader registration warning #17105
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
Merged
alice-i-cecile
merged 1 commit into
bevyengine:main
from
arunke:duplicate-asset-loader-warning
Jan 6, 2025
Merged
Fix duplicate asset loader registration warning #17105
alice-i-cecile
merged 1 commit into
bevyengine:main
from
arunke:duplicate-asset-loader-warning
Jan 6, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The original fix (bevyengine#11870) did not actually implement the described logic. It checked if there were independently multiple loaders for a given asset type and multiple loaders for a given extension. However, this did not handle the case where those loaders were not the same. For example, there could be a loader for type `Foo` and extension `.foo`. Anther loader could exist for type `Bar` but extension `.bar`. If a third loader was added for type `Foo` but extension `.bar`, the warning would have been incorrectly logged. Instead of independently checking to see if there are preexisting loaders for both the extension and type, look up the indices of the loaders for the type in question. Then check to see if the loaders registered for the extensions has any overlap. Only log if there are loaders that fit this criteria.
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
@thepackett can I get your review here please? |
BenjaminBrienen
approved these changes
Jan 2, 2025
alice-i-cecile
approved these changes
Jan 2, 2025
mrchantey
pushed a commit
to mrchantey/bevy
that referenced
this pull request
Feb 4, 2025
# Objective The original fix (bevyengine#11870) did not actually implement the described logic. It checked if there were independently multiple loaders for a given asset type and multiple loaders for a given extension. However, this did not handle the case where those loaders were not the same. For example, there could be a loader for type `Foo` and extension `.foo`. Anther loader could exist for type `Bar` but extension `.bar`. If a third loader was added for type `Foo` but extension `.bar`, the warning would have been incorrectly logged. ## Solution Instead of independently checking to see if there are preexisting loaders for both the extension and type, look up the indices of the loaders for the type in question. Then check to see if the loaders registered for the extensions has any overlap. Only log if there are loaders that fit this criteria. ## Testing Ran CI tests. Locally tested the situation describe in the objective section for the normal `App::init_asset_loader` flow. I think testing could be done on the pre-registration flow for loaders still. I tested on Windows, but the changes should not be affected by platform.
mockersf
pushed a commit
that referenced
this pull request
Feb 6, 2025
# Objective The original fix (#11870) did not actually implement the described logic. It checked if there were independently multiple loaders for a given asset type and multiple loaders for a given extension. However, this did not handle the case where those loaders were not the same. For example, there could be a loader for type `Foo` and extension `.foo`. Anther loader could exist for type `Bar` but extension `.bar`. If a third loader was added for type `Foo` but extension `.bar`, the warning would have been incorrectly logged. ## Solution Instead of independently checking to see if there are preexisting loaders for both the extension and type, look up the indices of the loaders for the type in question. Then check to see if the loaders registered for the extensions has any overlap. Only log if there are loaders that fit this criteria. ## Testing Ran CI tests. Locally tested the situation describe in the objective section for the normal `App::init_asset_loader` flow. I think testing could be done on the pre-registration flow for loaders still. I tested on Windows, but the changes should not be affected by platform.
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
D-Straightforward
Simple bug fixes and API improvements, docs, test and examples
S-Ready-For-Final-Review
This PR has been approved by the community. It's ready for a maintainer to consider merging it
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
The original fix (#11870) did not actually implement the described logic. It checked if there were independently multiple loaders for a given asset type and multiple loaders for a given extension. However, this did not handle the case where those loaders were not the same. For example, there could be a loader for type
Foo
and extension.foo
. Anther loader could exist for typeBar
but extension.bar
. If a third loader was added for typeFoo
but extension.bar
, the warning would have been incorrectly logged.Solution
Instead of independently checking to see if there are preexisting loaders for both the extension and type, look up the indices of the loaders for the type in question. Then check to see if the loaders registered for the extensions has any overlap. Only log if there are loaders that fit this criteria.
Testing
Ran CI tests. Locally tested the situation describe in the objective section for the normal
App::init_asset_loader
flow. I think testing could be done on the pre-registration flow for loaders still. I tested on Windows, but the changes should not be affected by platform.