@@ -247,9 +247,30 @@ void Window::_validate_property(PropertyInfo &p_property) const {
247247 } else if (p_property.name == " theme_type_variation" ) {
248248 List<StringName> names;
249249
250- // Only the default theme and the project theme are used for the list of options.
251- // This is an imposed limitation to simplify the logic needed to leverage those options.
252250 ThemeDB::get_singleton ()->get_default_theme ()->get_type_variation_list (get_class_name (), &names);
251+
252+ // Iterate to find all themes.
253+ Control *tmp_control = Object::cast_to<Control>(get_parent ());
254+ Window *tmp_window = Object::cast_to<Window>(get_parent ());
255+ while (tmp_control || tmp_window) {
256+ // We go up and any non Control/Window will break the chain.
257+ if (tmp_control) {
258+ if (tmp_control->get_theme ().is_valid ()) {
259+ tmp_control->get_theme ()->get_type_variation_list (get_class_name (), &names);
260+ }
261+ tmp_window = Object::cast_to<Window>(tmp_control->get_parent ());
262+ tmp_control = Object::cast_to<Control>(tmp_control->get_parent ());
263+ } else { // Window.
264+ if (tmp_window->get_theme ().is_valid ()) {
265+ tmp_window->get_theme ()->get_type_variation_list (get_class_name (), &names);
266+ }
267+ tmp_control = Object::cast_to<Control>(tmp_window->get_parent ());
268+ tmp_window = Object::cast_to<Window>(tmp_window->get_parent ());
269+ }
270+ }
271+ if (get_theme ().is_valid ()) {
272+ get_theme ()->get_type_variation_list (get_class_name (), &names);
273+ }
253274 if (ThemeDB::get_singleton ()->get_project_theme ().is_valid ()) {
254275 ThemeDB::get_singleton ()->get_project_theme ()->get_type_variation_list (get_class_name (), &names);
255276 }
0 commit comments