godot
godot copied to clipboard
Theme editor immediately closing after opening any theme item or simply clicking on viewport
Godot version
218bef90af2091afde3b1be816c87286c194a2a8
System information
Windows 11
Issue description
I think it's incorrect behaviour - clicking on theme items override or even a main viewport (regardless of 2D or 3D) immediately hides the theme editor.
Steps to reproduce
Open and try to use the theme editor
Minimal reproduction project
I can confirm this on Linux X11. Looks like this bug got introduced between Beta14 and Beta15.
CC @KoBeWi
Just want to mention that it also automatically hides itself if you make any changes to the theme while it is set as the global (custom) theme in the project settings. It produces the following error every time:
When you click a stylebox, it gets edited instead of the Theme, hence the editor gets closed. I think there used to be some hack to prevent that. Not sure why does it close when clicking viewport though. It happens even if the Theme is being edited outside any node.
As for the error, _update_type_list()
is called with a Timer and throws error if you click the stylebox too fast. To fix it we can stop the debounce timer when the Theme gets unassigned.
I think there used to be some hack to prevent that.
It still exists, the theme editor reports that it handles subresources of the currently edited theme, see https://github.com/godotengine/godot/blob/master/editor/plugins/theme_editor_plugin.cpp#L3715
However, I guess it doesn't prevent the new "edit null" call from happening, which closes the editor.
edit(null)
is needed to free the resource. Otherwise once the editor edits a resource, it will never get unloaded.
Part of this issue can be fixed now, but for complete fix I think we need a better way to handle editor persistence. I'm thinking of something like close button in the Theme editor to allow unloading the resource. Then we could make the editor an editing owner, so it doesn't receive null and allows to edit the Theme without disturbing.
So in the end all contextual editors will become persistent editors? 🤔 We "solved" the shader editor issues the same way, basically. I'm not sure this is a good direction, as it removes the perceived simplicity of Godot a bit. We also end up with a bunch of editors with their own open resource list this way, without any unified approach.
Overall, I think editing a subresource of a resource should not drop the context for the parent resource. Intuitively it doesn't make much sense. And that's where the root of the issue is.
No, the editor would be not visible until you edit a resource. Then once you edit it, you'd need to close it manually.
Overall, I think editing a subresource of a resource should not drop the context for the parent resource.
The problem is that inspector is the "editing owner" of the Theme. Once you click StyleBox, the inspector will display it instead of the Theme, hence the editor is closed. For the Theme to keep being edited, the editor needs to be still used in some editing context.
Link the similar problem (the case of bottom panel has inspector) https://github.com/godotengine/godot/issues/72262
I forgot to mention it before, but there was a plan to use instanced inspectors directly inside of the theme editor for all resources, which would solve the usability problem introduced here. Though this was more of a nice-to-have and thus bumped to an unknown release in a future. I could work on it for 4.0 though, if it would solve this more pressing issue.
I have this problem too, is there any workaround for this?
I can also confirm this issue. It occurs whenever pressing the + button to make a new override, and then when selecting an existing resource. (This is using a custom build I compiled today straight from master branch, running on Debian 11)
Edit: I can also confirm it occurs when removing an override using the bin icon.
It seems deleting types also causes this issue, and even may crash in deleting the types most commonly the "Fonts" type. If I delete a default imported "Fonts" type from my themes it'll freeze and crash the Godot editor.
Crashing is tracked in another issue and should be fully fixed by https://github.com/godotengine/godot/pull/73098. The editor closing unexpectedly is partially addressed by that PR, but only for regular properties. For sub-resources it's a big inconvenience, but a proper solution has to wait for the next version, where I'll use embedded inspectors in the Theme editor and avoid using the main inspector for that. You can click the back button in the inspector to go back to the theme once you're done with a font or a stylebox.
The theme editor does not close if you use the inspector for editing instead of the in-editor buttons.
Yeah, because I'm pretty sure I explicitly call the edit method of the main inspector, so it switches context. But your workaround is nice for those who are affected.
I've found making the theme part of the properties for one of the Control
nodes, and clicking/editing the theme from there, can be a temporary solution.