[Merged by Bors] - Add apply_or_insert functions to reflected component and resources#5201
Closed
Shatur wants to merge 3 commits intobevyengine:mainfrom
gardum-game:apply-or-insert
Closed
[Merged by Bors] - Add apply_or_insert functions to reflected component and resources#5201Shatur wants to merge 3 commits intobevyengine:mainfrom gardum-game:apply-or-insert
Shatur wants to merge 3 commits intobevyengine:mainfrom
gardum-game:apply-or-insert
Conversation
alice-i-cecile
approved these changes
Jul 4, 2022
Member
alice-i-cecile
left a comment
There was a problem hiding this comment.
LGTM once the doc comment changes are in.
Contributor
Author
|
While working on it I decided to open an issue with naming suggestions: #5202 |
Contributor
Author
|
@alice-i-cecile rebased after #5219. |
PROMETHIA-27
approved these changes
Jul 6, 2022
jakobhellermann
approved these changes
Jul 10, 2022
Contributor
jakobhellermann
left a comment
There was a problem hiding this comment.
The change looks good to me.
Long term I wonder whether we can get rid of ReflectComponent and ReflectResource and built these APIs on top of the raw untyped methods + ReflectFromPtr, but that can be considered separately.
Member
|
bors r+ |
bors bot
pushed a commit
that referenced
this pull request
Jul 11, 2022
…5201) # Objective `ReflectResource` and `ReflectComponent` will panic on `apply` method if there is no such component. It's not very ergonomic. And not very good for performance since I need to check if such component exists first. ## Solution * Add `ReflectComponent::apply_or_insert` and `ReflectResource::apply_or_insert` functions. * Rename `ReflectComponent::add` into `ReflectComponent::insert` for consistency. --- ## Changelog ### Added * `ReflectResource::apply_or_insert` and `ReflectComponent::apply_on_insert`. ### Changed * Rename `ReflectComponent::add` into `ReflectComponent::insert` for consistency. * Use `ReflectComponent::apply_on_insert` in `DynamicScene` instead of manual checking. ## Migration Guide * Rename `ReflectComponent::add` into `ReflectComponent::insert`.
Contributor
inodentry
pushed a commit
to IyesGames/bevy
that referenced
this pull request
Aug 8, 2022
…evyengine#5201) # Objective `ReflectResource` and `ReflectComponent` will panic on `apply` method if there is no such component. It's not very ergonomic. And not very good for performance since I need to check if such component exists first. ## Solution * Add `ReflectComponent::apply_or_insert` and `ReflectResource::apply_or_insert` functions. * Rename `ReflectComponent::add` into `ReflectComponent::insert` for consistency. --- ## Changelog ### Added * `ReflectResource::apply_or_insert` and `ReflectComponent::apply_on_insert`. ### Changed * Rename `ReflectComponent::add` into `ReflectComponent::insert` for consistency. * Use `ReflectComponent::apply_on_insert` in `DynamicScene` instead of manual checking. ## Migration Guide * Rename `ReflectComponent::add` into `ReflectComponent::insert`.
james7132
pushed a commit
to james7132/bevy
that referenced
this pull request
Oct 28, 2022
…evyengine#5201) # Objective `ReflectResource` and `ReflectComponent` will panic on `apply` method if there is no such component. It's not very ergonomic. And not very good for performance since I need to check if such component exists first. ## Solution * Add `ReflectComponent::apply_or_insert` and `ReflectResource::apply_or_insert` functions. * Rename `ReflectComponent::add` into `ReflectComponent::insert` for consistency. --- ## Changelog ### Added * `ReflectResource::apply_or_insert` and `ReflectComponent::apply_on_insert`. ### Changed * Rename `ReflectComponent::add` into `ReflectComponent::insert` for consistency. * Use `ReflectComponent::apply_on_insert` in `DynamicScene` instead of manual checking. ## Migration Guide * Rename `ReflectComponent::add` into `ReflectComponent::insert`.
ItsDoot
pushed a commit
to ItsDoot/bevy
that referenced
this pull request
Feb 1, 2023
…evyengine#5201) # Objective `ReflectResource` and `ReflectComponent` will panic on `apply` method if there is no such component. It's not very ergonomic. And not very good for performance since I need to check if such component exists first. ## Solution * Add `ReflectComponent::apply_or_insert` and `ReflectResource::apply_or_insert` functions. * Rename `ReflectComponent::add` into `ReflectComponent::insert` for consistency. --- ## Changelog ### Added * `ReflectResource::apply_or_insert` and `ReflectComponent::apply_on_insert`. ### Changed * Rename `ReflectComponent::add` into `ReflectComponent::insert` for consistency. * Use `ReflectComponent::apply_on_insert` in `DynamicScene` instead of manual checking. ## Migration Guide * Rename `ReflectComponent::add` into `ReflectComponent::insert`.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
ReflectResourceandReflectComponentwill panic onapplymethod if there is no such component. It's not very ergonomic. And not very good for performance since I need to check if such component exists first.Solution
ReflectComponent::apply_or_insertandReflectResource::apply_or_insertfunctions.ReflectComponent::addintoReflectComponent::insertfor consistency.Changelog
Added
ReflectResource::apply_or_insertandReflectComponent::apply_on_insert.Changed
ReflectComponent::addintoReflectComponent::insertfor consistency.ReflectComponent::apply_on_insertinDynamicSceneinstead of manual checking.Migration Guide
ReflectComponent::addintoReflectComponent::insert.