-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Free submenu children when clearing PopupMenu #79965
Conversation
I don't like this being the default and only option (which also makes this change compatibility breaking). It makes sense in the editor codebase, and in other code-first cases, but it conflicts with the node-first approach that some of our users prefer. Say, you have a popup menu with a submenu, and you add both nodes in the editor UI. In the current form, what you see is what you get, and clearing the parent menu won't remove the submenu. You would only need to connect it as one of the items, which you need to do from code anyway. With the proposed change clearing the items of the parent menu will remove the node that you've added to the tree visually. You will no longer get what you see, and you will have to recreate it from code every time. This just makes things harder for no reason, and it wastes a tiny bit of time recreating nodes. As we discussed before, a flag can be added to the |
I could add a flag and make it on by default in C++ and off by default in GDScript (it's possible). |
e892557
to
286f9a7
Compare
Aye, it's possible, but it may be frowned upon. I remember we discussed a case like that before, though I don't recall any details. |
We use this for Node methods with internal children argument. |
Ah, right, that was it. Well, that works as well then. |
286f9a7
to
0a1b04d
Compare
0a1b04d
to
d8b2aed
Compare
Needs a rebase, then I guess it should be ready to merge. |
d8b2aed
to
df24882
Compare
Thanks! |
While doing something else, I noticed that PopupMenu doesn't free submenu children when calling
clear()
. This means for example that the Create New menu in filesystem is created every time you right-click, which results in infinite unused menus.