Skip to content
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

Restored Control properties when you undo a parenting of a Control to a Container #85181

Merged
merged 1 commit into from
Dec 4, 2023

Conversation

TheSofox
Copy link
Contributor

Fixes #44629.

Previously if you added a Control to a Container that did automatic layout (Such as Button to VBoxLayout), then if you hit "Undo", the parenting would be undone, but the anchors and the size of the control would remain whatever the Container had set them to. This update fixes that.

@YuriSizov
Copy link
Contributor

Controls, in a rather hackish manner, have dedicated editor-only methods that can give you the entire state of the control which you can use to restore it later. I think this is what you should use here.

@TheSofox TheSofox force-pushed the reparent-container-undo-fix branch from 471e234 to 01329e6 Compare November 21, 2023 16:53
@TheSofox
Copy link
Contributor Author

It was that easy the whole time? Well, I've made the change, pushed, and on my end it works even better than before.

@YuriSizov YuriSizov requested a review from a team November 21, 2023 17:05
@YuriSizov YuriSizov added the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Nov 21, 2023
@TheSofox TheSofox changed the title Added size and anchor to restore when you undo a parenting of a Control to a Container Restored Control properties when you undo a parenting of a Control to a Container Nov 21, 2023
@TheSofox TheSofox force-pushed the reparent-container-undo-fix branch from 01329e6 to 5614e6d Compare November 22, 2023 09:37
@akien-mga akien-mga merged commit a8bc207 into godotengine:master Dec 4, 2023
15 checks passed
@akien-mga
Copy link
Member

Thanks!

@TheSofox TheSofox deleted the reparent-container-undo-fix branch December 4, 2023 22:30
@YuriSizov
Copy link
Contributor

Cherry-picked for 4.2.1.

@YuriSizov YuriSizov removed the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Undo fails to fully restore parenting control to container
5 participants