[Scene] Add SceneStringNames::font(_size/_color)

This commit is contained in:
A Thousand Ships
2024-05-14 15:57:29 +02:00
parent b435551682
commit d519715d94
77 changed files with 453 additions and 446 deletions

View File

@@ -69,8 +69,8 @@ bool EditorInspector::_property_path_matches(const String &p_property_path, cons
Size2 EditorProperty::get_minimum_size() const {
Size2 ms;
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Tree"));
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Tree"));
Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Tree"));
int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Tree"));
ms.height = label.is_empty() ? 0 : font->get_height(font_size) + 4 * EDSCALE;
for (int i = 0; i < get_child_count(); i++) {
@@ -132,8 +132,8 @@ void EditorProperty::_notification(int p_what) {
{
int child_room = size.width * (1.0 - split_ratio);
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Tree"));
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Tree"));
Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Tree"));
int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Tree"));
int height = label.is_empty() ? 0 : font->get_height(font_size) + 4 * EDSCALE;
bool no_children = true;
@@ -240,8 +240,8 @@ void EditorProperty::_notification(int p_what) {
} break;
case NOTIFICATION_DRAW: {
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Tree"));
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Tree"));
Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Tree"));
int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Tree"));
bool rtl = is_layout_rtl();
Size2 size = get_size();
@@ -1251,7 +1251,7 @@ void EditorInspectorCategory::_notification(int p_what) {
w -= hs + icon_size;
}
Color color = get_theme_color(SNAME("font_color"), SNAME("Tree"));
Color color = get_theme_color(SceneStringName(font_color), SNAME("Tree"));
if (is_layout_rtl()) {
ofs = get_size().width - ofs - w;
}
@@ -1452,7 +1452,7 @@ void EditorInspectorSection::_notification(int p_what) {
Ref<Font> font = get_theme_font(SNAME("bold"), EditorStringName(EditorFonts));
int font_size = get_theme_font_size(SNAME("bold_size"), EditorStringName(EditorFonts));
Color font_color = get_theme_color(SNAME("font_color"), EditorStringName(Editor));
Color font_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor));
if (folded && revertable_properties.size()) {
int label_width = font->get_string_size(label, HORIZONTAL_ALIGNMENT_LEFT, available, font_size, TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_CONSTRAIN_ELLIPSIS).x;
@@ -1545,8 +1545,8 @@ Size2 EditorInspectorSection::get_minimum_size() const {
ms = ms.max(minsize);
}
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Tree"));
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Tree"));
Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Tree"));
int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Tree"));
ms.height += font->get_height(font_size) + get_theme_constant(SNAME("v_separation"), SNAME("Tree"));
ms.width += get_theme_constant(SNAME("inspector_margin"), EditorStringName(Editor));
@@ -2252,7 +2252,7 @@ void EditorInspectorArray::_setup() {
if (numbered) {
ae.number = memnew(Label);
ae.number->add_theme_font_override("font", numbers_font);
ae.number->add_theme_font_override(SceneStringName(font), numbers_font);
ae.number->set_custom_minimum_size(Size2(numbers_min_w, 0));
ae.number->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
ae.number->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);