-
-
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
Misc. docs and renames for niche ECS internals #16786
Conversation
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.
Really nice set of changes. AddBundle
in particular has really confused and aggravated me in the past. I agree with all of these changes, and while the type names are verbose, they're both arcane and internal so I think it's a fine tradeoff.
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.
changes make sense to me.
pub(crate) struct AddBundle { | ||
/// The target archetype after the bundle is added to the source archetype | ||
/// Used in [`Edges`] to cache the result of inserting a bundle into the source archetype. | ||
pub(crate) struct ArchetypeAfterBundleInsert { |
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.
nit: it might be better to name this and other methods ArchetypeAfterInsertBundle
and *_insert_bundle()
to match the insert_bundle
ordering.
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.
I went back and forth on this, but I stuck with bundle_insert
because I thought insert_bundle
might sound too much like an "action", like get_archetype_after_insert_bundle
would actually be doing the insert itself. Not married to it though
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.
I don't really have too strong feelings here either and I don't think it's worth thinking about too hard. The new names are better, so lets just ship it.
Objective
Some structs and methods in the ECS internals have names that don't describe their purpose very well, and sometimes don't have docs either.
Also, the function
remove_bundle_from_archetype
is a counterpart toBundleInfo::add_bundle_to_archetype
, but isn't a method and is in a different file.Solution
AddBundle
ArchetypeAfterBundleInsert
InsertBundleResult
ArchetypeMoveType
Edges::get_add_bundle
Edges::get_archetype_after_bundle_insert
Edges::insert_add_bundle
Edges::cache_archetype_after_bundle_insert
Edges::get_remove_bundle
Edges::get_archetype_after_bundle_remove
Edges::insert_remove_bundle
Edges::cache_archetype_after_bundle_remove
Edges::get_take_bundle
Edges::get_archetype_after_bundle_take
Edges::insert_take_bundle
Edges::cache_archetype_after_bundle_take
remove_bundle_from_archetype
fromworld/entity_ref.rs
toBundleInfo
. I left the function in entity_ref in the first commit for comparison, look there for the diff of comments and whatnot.BundleInfo::add_bundle_to_archetype
toBundleInfo::insert_bundle_into_archetype
for consistency.