You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Show theme_type_variations in the inspector on Controls that inherit a theme
`theme_type_variation`s are now shown in the children and children of children that inherit a theme from a parent `Control` node.
This commit is contained in:
committed by
Rémi Verschelde
parent
19bb18716e
commit
b22eba1285
@@ -461,9 +461,30 @@ void Control::_validate_property(PropertyInfo &p_property) const {
|
||||
if (p_property.name == "theme_type_variation") {
|
||||
List<StringName> names;
|
||||
|
||||
// Only the default theme and the project theme are used for the list of options.
|
||||
// This is an imposed limitation to simplify the logic needed to leverage those options.
|
||||
ThemeDB::get_singleton()->get_default_theme()->get_type_variation_list(get_class_name(), &names);
|
||||
|
||||
// Iterate to find all themes.
|
||||
Control *tmp_control = Object::cast_to<Control>(get_parent());
|
||||
Window *tmp_window = Object::cast_to<Window>(get_parent());
|
||||
while (tmp_control || tmp_window) {
|
||||
// We go up and any non Control/Window will break the chain.
|
||||
if (tmp_control) {
|
||||
if (tmp_control->get_theme().is_valid()) {
|
||||
tmp_control->get_theme()->get_type_variation_list(get_class_name(), &names);
|
||||
}
|
||||
tmp_window = Object::cast_to<Window>(tmp_control->get_parent());
|
||||
tmp_control = Object::cast_to<Control>(tmp_control->get_parent());
|
||||
} else { // Window.
|
||||
if (tmp_window->get_theme().is_valid()) {
|
||||
tmp_window->get_theme()->get_type_variation_list(get_class_name(), &names);
|
||||
}
|
||||
tmp_control = Object::cast_to<Control>(tmp_window->get_parent());
|
||||
tmp_window = Object::cast_to<Window>(tmp_window->get_parent());
|
||||
}
|
||||
}
|
||||
if (get_theme().is_valid()) {
|
||||
get_theme()->get_type_variation_list(get_class_name(), &names);
|
||||
}
|
||||
if (ThemeDB::get_singleton()->get_project_theme().is_valid()) {
|
||||
ThemeDB::get_singleton()->get_project_theme()->get_type_variation_list(get_class_name(), &names);
|
||||
}
|
||||
|
||||
@@ -247,9 +247,30 @@ void Window::_validate_property(PropertyInfo &p_property) const {
|
||||
} else if (p_property.name == "theme_type_variation") {
|
||||
List<StringName> names;
|
||||
|
||||
// Only the default theme and the project theme are used for the list of options.
|
||||
// This is an imposed limitation to simplify the logic needed to leverage those options.
|
||||
ThemeDB::get_singleton()->get_default_theme()->get_type_variation_list(get_class_name(), &names);
|
||||
|
||||
// Iterate to find all themes.
|
||||
Control *tmp_control = Object::cast_to<Control>(get_parent());
|
||||
Window *tmp_window = Object::cast_to<Window>(get_parent());
|
||||
while (tmp_control || tmp_window) {
|
||||
// We go up and any non Control/Window will break the chain.
|
||||
if (tmp_control) {
|
||||
if (tmp_control->get_theme().is_valid()) {
|
||||
tmp_control->get_theme()->get_type_variation_list(get_class_name(), &names);
|
||||
}
|
||||
tmp_window = Object::cast_to<Window>(tmp_control->get_parent());
|
||||
tmp_control = Object::cast_to<Control>(tmp_control->get_parent());
|
||||
} else { // Window.
|
||||
if (tmp_window->get_theme().is_valid()) {
|
||||
tmp_window->get_theme()->get_type_variation_list(get_class_name(), &names);
|
||||
}
|
||||
tmp_control = Object::cast_to<Control>(tmp_window->get_parent());
|
||||
tmp_window = Object::cast_to<Window>(tmp_window->get_parent());
|
||||
}
|
||||
}
|
||||
if (get_theme().is_valid()) {
|
||||
get_theme()->get_type_variation_list(get_class_name(), &names);
|
||||
}
|
||||
if (ThemeDB::get_singleton()->get_project_theme().is_valid()) {
|
||||
ThemeDB::get_singleton()->get_project_theme()->get_type_variation_list(get_class_name(), &names);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user