-
-
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
Fix double parenting. #1545
Closed
Closed
Fix double parenting. #1545
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
0f8fc38
set PreviousParent when it exists
siler 0937610
Merge remote-tracking branch 'upstream/main' into main
siler f725ff2
Merge remote-tracking branch 'upstream/main' into main
siler 1a6f9b8
remove some dead code
siler ffedfd7
dropped a brace
siler 94bb58e
remove vec
siler 86fe77d
Merge remote-tracking branch 'upstream/main' into main
siler f7cadc2
Merge remote-tracking branch 'upstream/main' into main
siler 80e39b0
Merge remote-tracking branch 'upstream/main' into main
siler bfebd92
Merge remote-tracking branch 'upstream/main' into main
siler 9e37f9a
Merge remote-tracking branch 'upstream/main' into main
siler 815ae0f
Merge remote-tracking branch 'upstream/main' into main
siler ea02255
Merge remote-tracking branch 'upstream/main' into main
siler c0d4423
remove duplicate Parent update, properly set PreviousParent
siler 6fced49
fix remaining ECSv2 changes
siler 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,6 @@ Cargo.lock | |
.cargo/config | ||
.cargo/config.toml | ||
/.idea | ||
.iml | ||
/.vscode | ||
/benches/target |
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
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.
Wont removing this break manual insertion of the
Parent(Entity)
component (or changing the parent value directly)? If so, that would be a pretty major breaking change.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.
Yes, I think it would. But I would make the argument that mutably interacting with those is broken anyway. It only works for a narrow - if, perhaps, "typical" - set of use cases. Is this something we want to support if we cannot do it correctly?
For example, it is impossible to maintain a
PastParent
and correctly remove entities fromChildren
collections if the user of this API is simply adding/altering theParent
component instead of callingcommands.push_children(..)
. The oldParent
would be gone and, if the entity was previously childed to anotherParent
, we would have no idea what list to remove it from. If we had #1655 it might be possible to support.I do recognize that it would be a breaking change in that the use case that works correctly is taking two entities that haven't been part of parent/child relationships and just doing
commands.insert(child, Parent(parent))
.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.
Yup theres no question that the whole system needs an overhaul. Currently it is possible (and easy) to mutably change Parent (either via commands or &mut Parent queries). Using that to change parents has probably been done (and regardless its possible and easy to do). Breaking that behavior silently feels about as problematic as the bug being fixed in this pr. If we can do it in a way that completely prevents manual Parent mutations (both via queries and direct world access), thats worth considering.
I'm also starting to consider moving forward on merging my
hierarchy
branch, or if that ends up not being ready / too disruptive for 0.5, maybe just leaving this behavior as-is for 0.5.Let me know if you have any other suggestions.
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.
My preference would be to leave this behavior as-is and then do a full RFC on how parent-child stuff should work immediately after 0.5 lands. It's very central to UI, and @BoxyUwU's relations are also threatening to disrupt the space and need consideration.
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.
Cool, yeah there's several sets of changes in motion that will contribute to a better solution for this problem space. I don't have any good ideas about how to fix it in a way that works for everyone with what we have now, I think we need either Boxy's changes or something like #1655. I'm good closing this then, I'll keep running a fork until we get a proper solution.