Rename EntityCommands::clone to clone_and_spawn#16696
Merged
alice-i-cecile merged 2 commits intobevyengine:mainfrom Dec 10, 2024
Merged
Rename EntityCommands::clone to clone_and_spawn#16696alice-i-cecile merged 2 commits intobevyengine:mainfrom
EntityCommands::clone to clone_and_spawn#16696alice-i-cecile merged 2 commits intobevyengine:mainfrom
Conversation
Contributor
|
Here's a link to the referenced conversation. https://discord.com/channels/691052431525675048/749335865876021248/1314635145650638960 (btw, can't wait to use this feature) |
Member
Author
|
Credit to @eugineerd for the neat feature, sorry for repeatedly nitpicking it :P |
alice-i-cecile
requested changes
Dec 8, 2024
Member
alice-i-cecile
left a comment
There was a problem hiding this comment.
I definitely think we should rename this, but I find spawn_clone quite awkward and unclear. Are you okay with clone_and_spawn instead?
Contributor
|
What about Also cc @benfrankel who originally suggested |
Member
|
That's also an improvement, but I think that the order of operations (clone the data out, then spawn a new entity with it) is clearest with my suggestion :) |
EntityCommands::clone to spawn_cloneEntityCommands::clone to clone_and_spawn
alice-i-cecile
approved these changes
Dec 9, 2024
BenjaminBrienen
approved these changes
Dec 9, 2024
BD103
pushed a commit
to BD103/bevy
that referenced
this pull request
Dec 10, 2024
## Objective Follow-up to bevyengine#16672. `EntityCommands::clone` looks the same as the `Clone` trait, which could be confusing. A discord discussion has made me realize that's probably a bigger problem than I thought. Oops :P ## Solution Renamed `EntityCommands::clone` to `EntityCommands::clone_and_spawn`, renamed `EntityCommands::clone_with` to `EntityCommands::clone_and_spawn_with`. Also added some docs explaining the commands' relation to `Clone` (components need to implement it (or `Reflect`)). ## Showcase ``` // Create a new entity and keep its EntityCommands let mut entity = commands.spawn((ComponentA(10), ComponentB(20))); // Create a clone of the first entity let mut entity_clone = entity.clone_and_spawn(); ``` ## The Bikeshed - `clone_and_spawn` (Alice's suggestion) - `spawn_clone` (benfrankel's suggestion) - `spawn_cloned` (rparrett's suggestion)
ecoskey
pushed a commit
to ecoskey/bevy
that referenced
this pull request
Jan 6, 2025
## Objective Follow-up to bevyengine#16672. `EntityCommands::clone` looks the same as the `Clone` trait, which could be confusing. A discord discussion has made me realize that's probably a bigger problem than I thought. Oops :P ## Solution Renamed `EntityCommands::clone` to `EntityCommands::clone_and_spawn`, renamed `EntityCommands::clone_with` to `EntityCommands::clone_and_spawn_with`. Also added some docs explaining the commands' relation to `Clone` (components need to implement it (or `Reflect`)). ## Showcase ``` // Create a new entity and keep its EntityCommands let mut entity = commands.spawn((ComponentA(10), ComponentB(20))); // Create a clone of the first entity let mut entity_clone = entity.clone_and_spawn(); ``` ## The Bikeshed - `clone_and_spawn` (Alice's suggestion) - `spawn_clone` (benfrankel's suggestion) - `spawn_cloned` (rparrett's suggestion)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Objective
Follow-up to #16672.
EntityCommands::clonelooks the same as theClonetrait, which could be confusing. A discord discussion has made me realize that's probably a bigger problem than I thought. Oops :PSolution
Renamed
EntityCommands::clonetoEntityCommands::clone_and_spawn, renamedEntityCommands::clone_withtoEntityCommands::clone_and_spawn_with. Also added some docs explaining the commands' relation toClone(components need to implement it (orReflect)).Showcase
The Bikeshed
clone_and_spawn(Alice's suggestion)spawn_clone(benfrankel's suggestion)spawn_cloned(rparrett's suggestion)