-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Implement methods to list all components and all resources #3012
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
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.
alice-i-cecile
left a comment
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]>
inodentry
left a comment
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
Components andResources registered in aWorld.Solution
ComponentsintoWorldDatato reflect that it stores metadata both onComponents andResources. Also renameComponentIdtoDataId,ComponentInfotoDataInfoandComponentDescriptortoDataDescriptorIntoIteratorforWorldDatato iterate over all components and resourcesComponentssystem descriptor and implementIntoIteratorto iterate over all componentsResourcessystem descriptor and implementIntoIteratorto iterate over all resources