godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.48k stars 21.26k forks source link

Type Variation doesn't show new type when create it in the theme #96315

Open fkyah3 opened 3 months ago

fkyah3 commented 3 months ago

Tested versions

v4.3.stable.steam [77dcf97d8]

System information

windows 10

Issue description

image When I create a new Type in the theme, it doesn't show up in the Type Variation but I can use the created type manually image

Steps to reproduce

"First, create a new theme. Then, within the theme, create a new type under the types category.

Next, select the theme in the PanelContainer node.

After that, look for the newly created type variation under Type Variation.

If it cannot be found, manually entering the new variation name works to apply it."

Minimal reproduction project (MRP)

bug.zip

kleonc commented 3 months ago

Seems it's populating the options list based on only the default theme and the project theme, and it was done intentionally like that (lines 452-453): https://github.com/godotengine/godot/blob/a5830f6eb9fe25fbb7e58a723dbea8509aec8a85/scene/gui/control.cpp#L447-L473

I'm not familiar with the Theme code but I'd guess it was done like that for performance reasons, and thus might potentially need some internal rework to change/enhance that.

A simple improvement for now could be mentioning this quirk in the docs (shown as tooltip in the inspector):

https://github.com/godotengine/godot/blob/a5830f6eb9fe25fbb7e58a723dbea8509aec8a85/doc/classes/Control.xml#L1054-L1059

KoBeWi commented 3 months ago

I'm not familiar with the Theme code but I'd guess it was done like that for performance reasons

it's done like that, because it's difficult to determine the Theme that should be used for listing variations. Any Control's ancestor might have another Theme assigned or the theme can be changed at runtime etc. The default/project themes are the only reliable option.

Giganzo commented 3 months ago

There is also this issue on same topic https://github.com/godotengine/godot/issues/80732