Skip to content
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

Adding some docs for archetype internals #12578

Merged
merged 2 commits into from
Mar 23, 2024

Conversation

cBournhonesque
Copy link
Contributor

Objective

I was reading some of the Archetype and Bundle code and was getting confused a little bit in some places (is the archetype_id in AddBundle the source or the target archetype id?).
Small PR that adds some docstrings to make it easier for first-time readers.

@cBournhonesque cBournhonesque added C-Docs An addition or correction to our documentation A-ECS Entities, components, systems, and events labels Mar 19, 2024
pub archetype_id: ArchetypeId,
/// For each component iterated in the same order as the source [`Bundle`](crate::bundle::Bundle),
/// indicate if the component is newly added to the target archetype or if it already existed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's the status on the entity

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry; of which entity?

From what I understand, the bundle_status is computed just by comparing the components of the bundle with the components of the source archetype; no entities are involved.
(https://github.com/cBournhonesque/bevy/blob/7281b0e06c531cac4b9073cbb119b036a2ddfacb/crates/bevy_ecs/src/bundle.rs#L442)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep @cBournhonesque is right here. The entity's components are based on which archetype it's in, so this comment makes perfect sense.

@james7132 james7132 added this pull request to the merge queue Mar 23, 2024
Merged via the queue into bevyengine:main with commit 0b5f7b4 Mar 23, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Docs An addition or correction to our documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants