You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-30 16:26:50 +00:00
Add EditorStringNames singleton
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#include "editor/editor_resource_picker.h"
|
||||
#include "editor/editor_scale.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/editor_string_names.h"
|
||||
#include "editor/gui/editor_file_dialog.h"
|
||||
#include "editor/gui/editor_spin_slider.h"
|
||||
#include "editor/gui/scene_tree_editor.h"
|
||||
@@ -162,8 +163,8 @@ void EditorPropertyMultilineText::_open_big_text() {
|
||||
big_text = memnew(TextEdit);
|
||||
if (expression) {
|
||||
big_text->set_syntax_highlighter(text->get_syntax_highlighter());
|
||||
big_text->add_theme_font_override("font", get_theme_font(SNAME("expression"), SNAME("EditorFonts")));
|
||||
big_text->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("expression_size"), SNAME("EditorFonts")));
|
||||
big_text->add_theme_font_override("font", get_theme_font(SNAME("expression"), EditorStringName(EditorFonts)));
|
||||
big_text->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("expression_size"), EditorStringName(EditorFonts)));
|
||||
}
|
||||
big_text->connect("text_changed", callable_mp(this, &EditorPropertyMultilineText::_big_text_changed));
|
||||
big_text->set_line_wrapping_mode(TextEdit::LineWrappingMode::LINE_WRAPPING_BOUNDARY);
|
||||
@@ -192,14 +193,14 @@ void EditorPropertyMultilineText::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_THEME_CHANGED:
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
Ref<Texture2D> df = get_theme_icon(SNAME("DistractionFree"), SNAME("EditorIcons"));
|
||||
Ref<Texture2D> df = get_editor_theme_icon(SNAME("DistractionFree"));
|
||||
open_big_text->set_icon(df);
|
||||
|
||||
Ref<Font> font;
|
||||
int font_size;
|
||||
if (expression) {
|
||||
font = get_theme_font(SNAME("expression"), SNAME("EditorFonts"));
|
||||
font_size = get_theme_font_size(SNAME("expression_size"), SNAME("EditorFonts"));
|
||||
font = get_theme_font(SNAME("expression"), EditorStringName(EditorFonts));
|
||||
font_size = get_theme_font_size(SNAME("expression_size"), EditorStringName(EditorFonts));
|
||||
|
||||
text->add_theme_font_override("font", font);
|
||||
text->add_theme_font_size_override("font_size", font_size);
|
||||
@@ -347,9 +348,9 @@ void EditorPropertyTextEnum::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE:
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
edit_button->set_icon(get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")));
|
||||
accept_button->set_icon(get_theme_icon(SNAME("ImportCheck"), SNAME("EditorIcons")));
|
||||
cancel_button->set_icon(get_theme_icon(SNAME("ImportFail"), SNAME("EditorIcons")));
|
||||
edit_button->set_icon(get_editor_theme_icon(SNAME("Edit")));
|
||||
accept_button->set_icon(get_editor_theme_icon(SNAME("ImportCheck")));
|
||||
cancel_button->set_icon(get_editor_theme_icon(SNAME("ImportFail")));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
@@ -435,7 +436,7 @@ void EditorPropertyLocale::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE:
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
locale_edit->set_icon(get_theme_icon(SNAME("Translation"), SNAME("EditorIcons")));
|
||||
locale_edit->set_icon(get_editor_theme_icon(SNAME("Translation")));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
@@ -531,7 +532,7 @@ void EditorPropertyPath::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE:
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
path_edit->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
|
||||
path_edit->set_icon(get_editor_theme_icon(SNAME("Folder")));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
@@ -989,12 +990,12 @@ void EditorPropertyLayersGrid::_notification(int p_what) {
|
||||
const int bsize = (grid_size.height * 80 / 100) / 2;
|
||||
const int h = bsize * 2 + 1;
|
||||
|
||||
Color color = get_theme_color(read_only ? SNAME("disabled_highlight_color") : SNAME("highlight_color"), SNAME("Editor"));
|
||||
Color color = get_theme_color(read_only ? SNAME("disabled_highlight_color") : SNAME("highlight_color"), EditorStringName(Editor));
|
||||
|
||||
Color text_color = get_theme_color(read_only ? SNAME("disabled_font_color") : SNAME("font_color"), SNAME("Editor"));
|
||||
Color text_color = get_theme_color(read_only ? SNAME("disabled_font_color") : SNAME("font_color"), EditorStringName(Editor));
|
||||
text_color.a *= 0.5;
|
||||
|
||||
Color text_color_on = get_theme_color(read_only ? SNAME("disabled_font_color") : SNAME("font_hover_color"), SNAME("Editor"));
|
||||
Color text_color_on = get_theme_color(read_only ? SNAME("disabled_font_color") : SNAME("font_hover_color"), EditorStringName(Editor));
|
||||
text_color_on.a *= 0.7;
|
||||
|
||||
const int vofs = (grid_size.height - h) / 2;
|
||||
@@ -1080,7 +1081,7 @@ void EditorPropertyLayersGrid::_notification(int p_what) {
|
||||
Ref<Texture2D> arrow = get_theme_icon(SNAME("arrow"), SNAME("Tree"));
|
||||
ERR_FAIL_COND(arrow.is_null());
|
||||
|
||||
Color arrow_color = get_theme_color(SNAME("highlight_color"), SNAME("Editor"));
|
||||
Color arrow_color = get_theme_color(SNAME("highlight_color"), EditorStringName(Editor));
|
||||
arrow_color.a = expand_hovered ? 1.0 : 0.6;
|
||||
|
||||
arrow_pos.x += 2.0;
|
||||
@@ -1117,9 +1118,9 @@ void EditorPropertyLayers::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE:
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
button->set_texture_normal(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons")));
|
||||
button->set_texture_pressed(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons")));
|
||||
button->set_texture_disabled(get_theme_icon(SNAME("GuiTabMenu"), SNAME("EditorIcons")));
|
||||
button->set_texture_normal(get_editor_theme_icon(SNAME("GuiTabMenuHl")));
|
||||
button->set_texture_pressed(get_editor_theme_icon(SNAME("GuiTabMenuHl")));
|
||||
button->set_texture_disabled(get_editor_theme_icon(SNAME("GuiTabMenu")));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
@@ -1244,7 +1245,7 @@ void EditorPropertyLayers::_button_pressed() {
|
||||
layers->set_item_disabled(0, true);
|
||||
}
|
||||
layers->add_separator();
|
||||
layers->add_icon_item(get_theme_icon("Edit", "EditorIcons"), TTR("Edit Layer Names"), grid->layer_count);
|
||||
layers->add_icon_item(get_editor_theme_icon("Edit"), TTR("Edit Layer Names"), grid->layer_count);
|
||||
|
||||
Rect2 gp = button->get_screen_rect();
|
||||
layers->reset_size();
|
||||
@@ -1408,7 +1409,7 @@ void EditorPropertySignal::update_property() {
|
||||
|
||||
edit->set_text("Signal: " + signal.get_name());
|
||||
edit->set_disabled(false);
|
||||
edit->set_icon(get_theme_icon(SNAME("Signals"), SNAME("EditorIcons")));
|
||||
edit->set_icon(get_editor_theme_icon(SNAME("Signals")));
|
||||
}
|
||||
|
||||
void EditorPropertySignal::_bind_methods() {
|
||||
@@ -1430,7 +1431,7 @@ void EditorPropertyCallable::update_property() {
|
||||
|
||||
edit->set_text("Callable");
|
||||
edit->set_disabled(true);
|
||||
edit->set_icon(get_theme_icon(SNAME("Callable"), SNAME("EditorIcons")));
|
||||
edit->set_icon(get_editor_theme_icon(SNAME("Callable")));
|
||||
}
|
||||
|
||||
void EditorPropertyCallable::_bind_methods() {
|
||||
@@ -1579,7 +1580,7 @@ void EditorPropertyEasing::_draw_easing() {
|
||||
const Color font_color = get_theme_color(is_read_only() ? SNAME("font_uneditable_color") : SNAME("font_color"), SNAME("LineEdit"));
|
||||
Color line_color;
|
||||
if (dragging) {
|
||||
line_color = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
|
||||
line_color = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));
|
||||
} else {
|
||||
line_color = get_theme_color(is_read_only() ? SNAME("font_uneditable_color") : SNAME("font_color"), SNAME("LineEdit")) * Color(1, 1, 1, 0.9);
|
||||
}
|
||||
@@ -1672,13 +1673,13 @@ void EditorPropertyEasing::_notification(int p_what) {
|
||||
case NOTIFICATION_THEME_CHANGED:
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
preset->clear();
|
||||
preset->add_icon_item(get_theme_icon(SNAME("CurveLinear"), SNAME("EditorIcons")), "Linear", EASING_LINEAR);
|
||||
preset->add_icon_item(get_theme_icon(SNAME("CurveIn"), SNAME("EditorIcons")), "Ease In", EASING_IN);
|
||||
preset->add_icon_item(get_theme_icon(SNAME("CurveOut"), SNAME("EditorIcons")), "Ease Out", EASING_OUT);
|
||||
preset->add_icon_item(get_theme_icon(SNAME("CurveConstant"), SNAME("EditorIcons")), "Zero", EASING_ZERO);
|
||||
preset->add_icon_item(get_editor_theme_icon(SNAME("CurveLinear")), "Linear", EASING_LINEAR);
|
||||
preset->add_icon_item(get_editor_theme_icon(SNAME("CurveIn")), "Ease In", EASING_IN);
|
||||
preset->add_icon_item(get_editor_theme_icon(SNAME("CurveOut")), "Ease Out", EASING_OUT);
|
||||
preset->add_icon_item(get_editor_theme_icon(SNAME("CurveConstant")), "Zero", EASING_ZERO);
|
||||
if (!positive_only) {
|
||||
preset->add_icon_item(get_theme_icon(SNAME("CurveInOut"), SNAME("EditorIcons")), "Ease In-Out", EASING_IN_OUT);
|
||||
preset->add_icon_item(get_theme_icon(SNAME("CurveOutIn"), SNAME("EditorIcons")), "Ease Out-In", EASING_OUT_IN);
|
||||
preset->add_icon_item(get_editor_theme_icon(SNAME("CurveInOut")), "Ease In-Out", EASING_IN_OUT);
|
||||
preset->add_icon_item(get_editor_theme_icon(SNAME("CurveOutIn")), "Ease Out-In", EASING_OUT_IN);
|
||||
}
|
||||
easing_draw->set_custom_minimum_size(Size2(0, get_theme_font(SNAME("font"), SNAME("Label"))->get_height(get_theme_font_size(SNAME("font_size"), SNAME("Label"))) * 2));
|
||||
} break;
|
||||
@@ -2114,10 +2115,10 @@ void EditorPropertyQuaternion::_notification(int p_what) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
euler[i]->add_theme_color_override("label_color", colors[i]);
|
||||
}
|
||||
edit_button->set_icon(get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")));
|
||||
euler_label->add_theme_color_override(SNAME("font_color"), get_theme_color(SNAME("property_color"), SNAME("Editor")));
|
||||
warning->set_icon(get_theme_icon(SNAME("NodeWarning"), SNAME("EditorIcons")));
|
||||
warning->add_theme_color_override(SNAME("font_color"), get_theme_color(SNAME("warning_color"), SNAME("Editor")));
|
||||
edit_button->set_icon(get_editor_theme_icon(SNAME("Edit")));
|
||||
euler_label->add_theme_color_override(SNAME("font_color"), get_theme_color(SNAME("property_color"), EditorStringName(Editor)));
|
||||
warning->set_icon(get_editor_theme_icon(SNAME("NodeWarning")));
|
||||
warning->add_theme_color_override(SNAME("font_color"), get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
@@ -2724,7 +2725,7 @@ void EditorPropertyColor::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE:
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
picker->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), SNAME("Editor"))));
|
||||
picker->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), EditorStringName(Editor))));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
@@ -2921,7 +2922,7 @@ void EditorPropertyNodePath::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE:
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
Ref<Texture2D> t = get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"));
|
||||
Ref<Texture2D> t = get_editor_theme_icon(SNAME("Clear"));
|
||||
clear->set_icon(t);
|
||||
} break;
|
||||
}
|
||||
@@ -3210,9 +3211,9 @@ void EditorPropertyResource::_update_property_bg() {
|
||||
}
|
||||
count_subinspectors = MIN(15, count_subinspectors);
|
||||
|
||||
add_theme_color_override("property_color", get_theme_color(SNAME("sub_inspector_property_color"), SNAME("Editor")));
|
||||
add_theme_style_override("bg_selected", get_theme_stylebox("sub_inspector_property_bg" + itos(count_subinspectors), SNAME("Editor")));
|
||||
add_theme_style_override("bg", get_theme_stylebox("sub_inspector_property_bg" + itos(count_subinspectors), SNAME("Editor")));
|
||||
add_theme_color_override("property_color", get_theme_color(SNAME("sub_inspector_property_color"), EditorStringName(Editor)));
|
||||
add_theme_style_override("bg_selected", get_theme_stylebox("sub_inspector_property_bg" + itos(count_subinspectors), EditorStringName(Editor)));
|
||||
add_theme_style_override("bg", get_theme_stylebox("sub_inspector_property_bg" + itos(count_subinspectors), EditorStringName(Editor)));
|
||||
|
||||
add_theme_constant_override("v_separation", 0);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user