diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 2eb710316fd..6e44956246b 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -338,17 +338,48 @@ bool Control::_get(const StringName &p_name, Variant &r_ret) const { return true; } + void Control::_get_property_list(List *p_list) const { Ref theme = Theme::get_default(); - /* Using the default theme since the properties below are meant for editor only - if (data.theme.is_valid()) { - theme = data.theme; - } else { - theme = Theme::get_default(); + p_list->push_back(PropertyInfo(Variant::NIL, "Theme Overrides", PROPERTY_HINT_NONE, "custom_", PROPERTY_USAGE_GROUP)); - }*/ + { + List names; + theme->get_color_list(get_class_name(), &names); + for (List::Element *E = names.front(); E; E = E->next()) { + uint32_t hint = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE; + if (data.color_override.has(E->get())) { + hint |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED; + } + p_list->push_back(PropertyInfo(Variant::COLOR, "custom_colors/" + E->get(), PROPERTY_HINT_NONE, "", hint)); + } + } + { + List names; + theme->get_constant_list(get_class_name(), &names); + for (List::Element *E = names.front(); E; E = E->next()) { + uint32_t hint = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE; + if (data.constant_override.has(E->get())) { + hint |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED; + } + + p_list->push_back(PropertyInfo(Variant::INT, "custom_constants/" + E->get(), PROPERTY_HINT_RANGE, "-16384,16384", hint)); + } + } + { + List names; + theme->get_font_list(get_class_name(), &names); + for (List::Element *E = names.front(); E; E = E->next()) { + uint32_t hint = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE; + if (data.font_override.has(E->get())) { + hint |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED; + } + + p_list->push_back(PropertyInfo(Variant::OBJECT, "custom_fonts/" + E->get(), PROPERTY_HINT_RESOURCE_TYPE, "Font", hint)); + } + } { List names; theme->get_icon_list(get_class_name(), &names); @@ -385,42 +416,6 @@ void Control::_get_property_list(List *p_list) const { p_list->push_back(PropertyInfo(Variant::OBJECT, "custom_styles/" + E->get(), PROPERTY_HINT_RESOURCE_TYPE, "StyleBox", hint)); } } - { - List names; - theme->get_font_list(get_class_name(), &names); - for (List::Element *E = names.front(); E; E = E->next()) { - uint32_t hint = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE; - if (data.font_override.has(E->get())) { - hint |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED; - } - - p_list->push_back(PropertyInfo(Variant::OBJECT, "custom_fonts/" + E->get(), PROPERTY_HINT_RESOURCE_TYPE, "Font", hint)); - } - } - { - List names; - theme->get_color_list(get_class_name(), &names); - for (List::Element *E = names.front(); E; E = E->next()) { - uint32_t hint = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE; - if (data.color_override.has(E->get())) { - hint |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED; - } - - p_list->push_back(PropertyInfo(Variant::COLOR, "custom_colors/" + E->get(), PROPERTY_HINT_NONE, "", hint)); - } - } - { - List names; - theme->get_constant_list(get_class_name(), &names); - for (List::Element *E = names.front(); E; E = E->next()) { - uint32_t hint = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE; - if (data.constant_override.has(E->get())) { - hint |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED; - } - - p_list->push_back(PropertyInfo(Variant::INT, "custom_constants/" + E->get(), PROPERTY_HINT_RANGE, "-16384,16384", hint)); - } - } } Control *Control::get_parent_control() const { @@ -2912,7 +2907,6 @@ void Control::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "size_flags_stretch_ratio", PROPERTY_HINT_RANGE, "0,20,0.01,or_greater"), "set_stretch_ratio", "get_stretch_ratio"); ADD_GROUP("Theme", ""); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "theme", PROPERTY_HINT_RESOURCE_TYPE, "Theme"), "set_theme", "get_theme"); - ADD_GROUP("", ""); BIND_ENUM_CONSTANT(FOCUS_NONE); BIND_ENUM_CONSTANT(FOCUS_CLICK);