Ignore empty Font resources as theme override.

Add range hint to font_size properties.
Remove excessive `base_size` Font property.
This commit is contained in:
bruvzg 2021-10-25 11:49:18 +03:00
parent 92a2380d96
commit ebbc25e89c
19 changed files with 99 additions and 144 deletions

View file

@ -400,7 +400,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
}
p_list->push_back(PropertyInfo(Variant::INT, "theme_override_font_sizes/" + E, PROPERTY_HINT_NONE, "", usage));
p_list->push_back(PropertyInfo(Variant::INT, "theme_override_font_sizes/" + E, PROPERTY_HINT_RANGE, "1,256,1,or_greater", usage));
}
}
{
@ -985,7 +985,7 @@ Ref<StyleBox> Control::get_theme_stylebox(const StringName &p_name, const String
Ref<Font> Control::get_theme_font(const StringName &p_name, const StringName &p_theme_type) const {
if (p_theme_type == StringName() || p_theme_type == get_class_name() || p_theme_type == data.theme_type_variation) {
const Ref<Font> *font = data.font_override.getptr(p_name);
if (font) {
if (font && (*font)->get_data_count() > 0) {
return *font;
}
}
@ -998,7 +998,7 @@ Ref<Font> Control::get_theme_font(const StringName &p_name, const StringName &p_
int Control::get_theme_font_size(const StringName &p_name, const StringName &p_theme_type) const {
if (p_theme_type == StringName() || p_theme_type == get_class_name() || p_theme_type == data.theme_type_variation) {
const int *font_size = data.font_size_override.getptr(p_name);
if (font_size) {
if (font_size && (*font_size) > 0) {
return *font_size;
}
}
@ -2586,16 +2586,6 @@ void Control::warp_mouse(const Point2 &p_to_pos) {
}
bool Control::is_text_field() const {
/*
if (get_script_instance()) {
Variant v=p_point;
const Variant *p[2]={&v,&p_data};
Callable::CallError ce;
Variant ret = get_script_instance()->call("is_text_field",p,2,ce);
if (ce.error==Callable::CallError::CALL_OK)
return ret;
}
*/
return false;
}