Add various methods to get reflected components from EntityRef
& friends
#15199
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
World::get_reflect()
andWorld::get_reflect_mut()
#14416 addedWorld::get_reflect
andWorld::get_reflect_mut
, but they require a world reference. Make them available onEntityRef
and other similar types._ref
variants ofget_by_id
methods and the aboveget_reflect
methods.Solution
get_reflect
,get_reflect_ref
,get_reflect_mut
andget_many_reflect_mut
methods to the typesUnsafeEntityCell
,EntityRef
,EntityMut
,EntityWorldMut
,FilteredEntityRef
andFilteredEntityMut
(the_mut
variants are missing for types that don't provide mutable access);EntityWorldMut
, all these methods take a&TypeRegistry
argument, since they can't fetch it from theWorld
.EntityWorldMut
instead fetches theAppTypeRegistry
resource from theWorld
reference it has access to;World
these methods take aComponentId
, which I think is more general and slightly more efficient.get_ref_by_id
to those same types and aRefUntyped
type to matchMutUntyped
.TODO
World::get_reflect
andWorld::get_reflect_mut
, since they can be replaced by the corresponding methods onEntityRef
andEntityMut
/EntityWorldMut
Option
sShowcase
TODO