Make theme item overrides more obvious in the Inspector
This commit is contained in:
parent
c96377399c
commit
e7bd53b690
1 changed files with 37 additions and 43 deletions
|
@ -338,17 +338,48 @@ bool Control::_get(const StringName &p_name, Variant &r_ret) const {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Control::_get_property_list(List<PropertyInfo> *p_list) const {
|
||||
Ref<Theme> 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<StringName> names;
|
||||
theme->get_color_list(get_class_name(), &names);
|
||||
for (List<StringName>::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<StringName> names;
|
||||
theme->get_constant_list(get_class_name(), &names);
|
||||
for (List<StringName>::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<StringName> names;
|
||||
theme->get_font_list(get_class_name(), &names);
|
||||
for (List<StringName>::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<StringName> names;
|
||||
theme->get_icon_list(get_class_name(), &names);
|
||||
|
@ -385,42 +416,6 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
|
|||
p_list->push_back(PropertyInfo(Variant::OBJECT, "custom_styles/" + E->get(), PROPERTY_HINT_RESOURCE_TYPE, "StyleBox", hint));
|
||||
}
|
||||
}
|
||||
{
|
||||
List<StringName> names;
|
||||
theme->get_font_list(get_class_name(), &names);
|
||||
for (List<StringName>::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<StringName> names;
|
||||
theme->get_color_list(get_class_name(), &names);
|
||||
for (List<StringName>::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<StringName> names;
|
||||
theme->get_constant_list(get_class_name(), &names);
|
||||
for (List<StringName>::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);
|
||||
|
|
Loading…
Reference in a new issue