-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Entity cloning #16132
Merged
Merged
Entity cloning #16132
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
ccfa150
First implmentation of entity cloning
eugineerd e3b85b6
fix typos
eugineerd 0685c64
added `allow_by_ids` and `disallow_by_ids` to `EntityCloneBuilder`
eugineerd c1c10c1
set `ObservedBy` clone handler to `Ignore` by default
eugineerd 5b840f7
Add `as_child` to `EntityCloneBuilder`
eugineerd c1dde50
add `allow_all` and `deny_all` to `EntityCloneBuilder`
eugineerd d94ca18
add `allow_bundle` and `deny_bundle` to `EntityCloneBuilder`
eugineerd 6c4bb06
clippy fixes
eugineerd 0b800df
actually ran clippy
eugineerd 0733248
fix `allow_bundle` and `deny_bundle` not actually working as intended
eugineerd 7798b9d
rename some `EntityCloner` items for clarity
eugineerd b4a69e1
rework filtering in `EntityCloneBuilder` to use `ComponentId`s
eugineerd b5034da
document component clone handler priority and default cloning strategy
eugineerd a514b2f
preallocate Vec for `ComponentId`s using `Archetype::component_count`
eugineerd 4277e10
replace `HashMap` in `ComponentCloneHandlers` with `Vec` to speed up …
eugineerd 3d4d681
Merge remote-tracking branch 'upstream/main' into entity_cloning
eugineerd 49a809f
use `DeferredWorld` instead of `World` to allow for more optimal enti…
eugineerd cc66e8d
fix `get_component_clone_handlers_mut` doctest
eugineerd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Would it make sense to have a helper method that calls
set_component_handler(id, component_clone_via_clone::<C>)
with the correctid
? You couldn't put it onComponentCloneHandlers
since you can't get thecomponent_id
from that, but you could put it onWorld
orComponents
.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'm not sure how useful that will be. I though that most users would not need to add
component_clone_via_clone
handlers at runtime, instead they would manuallyimpl Clone
for a component or set a handler inget_component_clone_handler
. Is it for components with conditionalClone
implementation with generics?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.
Yeah, I was thinking about the conditional
Clone
implementations. One of the reasons it seems perfectly fine to use default cloning in that case is that anyone who really needscomponent_clone_via_clone
can just register it for the concrete component types! But I agree that's likely to be rare, so it's probably not worth adding extra methods for it unless we see folks doing that in the wild.