-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Implement methods to list all components and all resources #3012
Implement methods to list all components and all resources #3012
Conversation
This allows iteration over all `Component`s registered in a world by implementing `IntoIterator` for the `Components` type.
I am realizing there is some more design discussion to be had before I can continue implementing this - see the issue associated with this PR |
the Components struct was not just storing metadata on components, but also on resources. WorldData is a new umbrella term for components and resources. also rename the following: `ComponentId` -> `DataId` `ComponentInfo` -> `DataInfo` `ComponentDescriptor` -> `DataDescriptor`
2200887
to
e48cd26
Compare
These can be used in systems to get an overview over all available Components and Resources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an outstanding first PR. I read the changes in full and have no complaints.
Co-authored-by: MinerSebas <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks good to me.
I really like the "component" -> "data" rename. It makes so much more sense this way. I previously found it confusing that bevy ecs uses the term "components" to refer both to the user-facing concept and api (distinct from "resources") and the internal backing storage for all data (including resources). They are separate things and deserve distinct names.
And, being able to iterate "all components", "all resources", and "all data"/both, is obviously also very useful.
@sseemayer I'm interested in merging this; can you please rebase? |
Would it be okay with either of you if I open a PR for this rebased on main? @alice-i-cecile @inodentry |
@KevinKeyser Yes please! That's the intent behind the |
Closing in favor of #4955. |
Objective
Component
s andResource
s registered in aWorld
.Solution
Components
intoWorldData
to reflect that it stores metadata both onComponent
s andResource
s. Also renameComponentId
toDataId
,ComponentInfo
toDataInfo
andComponentDescriptor
toDataDescriptor
IntoIterator
forWorldData
to iterate over all components and resourcesComponents
system descriptor and implementIntoIterator
to iterate over all componentsResources
system descriptor and implementIntoIterator
to iterate over all resources