-
-
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
UI Node's Style changes are ignored for unparented nodes as long as the parent exists #11385
Comments
After more and more investigations, this is due to taffy storing "phantom" children that were removed during the layout update. The phantom children exist because the node children need to be updated before node removal to avoid a panic (Invalid SlotMap key). The solution is to sync the children again after the nodes were cleaned up. |
github-merge-queue bot
pushed a commit
that referenced
this issue
Jul 30, 2024
# Objective The `ui_layout_system` relies on change detection to sync parent-child relation to taffy. The children need to by synced before node removal to avoid trying to set deleted nodes as children (due to how the different queries collect entities). This however may leave nodes that were removed set as children to other nodes in special cases. Fixes #11385 ## Solution The solution is simply to re-sync the changed children after the nodes are removed. ## Testing Tested with `sickle_ui` where docking zone highlights would end up glitched when docking was done in a certain manner: - run the `docking_zone_splits` example - pop out a tab from the top - dock the floating panel in the center right - grab another tab and try to hover the original static docking zone: the highlight is semi-stuck - (NOTE: sometimes it worked even without the fix due to scheduling order not producing the bugged query results) After the fix, the issue is no longer present. NOTE: The performance impact should be minimal, as the child sync relies on change detection. The change detection was also the reason the parent nodes remained "stuck" with the phantom children if no other update were done to them.
mockersf
pushed a commit
that referenced
this issue
Aug 2, 2024
# Objective The `ui_layout_system` relies on change detection to sync parent-child relation to taffy. The children need to by synced before node removal to avoid trying to set deleted nodes as children (due to how the different queries collect entities). This however may leave nodes that were removed set as children to other nodes in special cases. Fixes #11385 ## Solution The solution is simply to re-sync the changed children after the nodes are removed. ## Testing Tested with `sickle_ui` where docking zone highlights would end up glitched when docking was done in a certain manner: - run the `docking_zone_splits` example - pop out a tab from the top - dock the floating panel in the center right - grab another tab and try to hover the original static docking zone: the highlight is semi-stuck - (NOTE: sometimes it worked even without the fix due to scheduling order not producing the bugged query results) After the fix, the issue is no longer present. NOTE: The performance impact should be minimal, as the child sync relies on change detection. The change detection was also the reason the parent nodes remained "stuck" with the phantom children if no other update were done to them.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bevy version
0.12.1
What you did
I made a floating panel (based on
NodeBundle
) that needs to be absolutely positioned to the whole window. The panel is first spawned as a child of another entity (to have access to theChildBuilder
needed to populate it's content), then I callremove_parent()
on the panel (via commands) with a system inUpdate
.What went wrong
Style
component aren't reflected on the panel, i.e. left/top positioning and display properties are ignored. Except when the Window is resized.Additional information
The
Interaction
component is updated as if theStyle
didn't change, so it seems the issue is around the calculation of the transforms or updates to theNode
props.The
Style
is correctly processed if the original parent node is despawned, so this works as expected:While this does not work:
Removing the parent:
EDIT: After more trial and error, it seems that even if the panel is spawn directly without a parent the loss of updates can occur. Randomly, I would say. I had a working version, but then it stopped working after a few builds even though I did not touch this part. The key difference between when it is working and when it's not seems to be about when the panel is spawned. During
Startup
always seem to work. DuringUpdate
, usually not.The text was updated successfully, but these errors were encountered: