1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-04 17:04:49 +00:00

Add EditorStringNames singleton

This commit is contained in:
kobewi
2023-08-13 02:33:39 +02:00
parent fa3428ff25
commit 6de34fde27
176 changed files with 2549 additions and 2325 deletions

View File

@@ -33,6 +33,7 @@
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "editor/editor_string_names.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/filesystem_dock.h"
#include "editor/gui/editor_file_dialog.h"
@@ -424,33 +425,33 @@ void InspectorDock::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED:
case NOTIFICATION_TRANSLATION_CHANGED:
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
resource_new_button->set_icon(get_theme_icon(SNAME("New"), SNAME("EditorIcons")));
resource_load_button->set_icon(get_theme_icon(SNAME("Load"), SNAME("EditorIcons")));
resource_save_button->set_icon(get_theme_icon(SNAME("Save"), SNAME("EditorIcons")));
resource_extra_button->set_icon(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons")));
open_docs_button->set_icon(get_theme_icon(SNAME("HelpSearch"), SNAME("EditorIcons")));
resource_new_button->set_icon(get_editor_theme_icon(SNAME("New")));
resource_load_button->set_icon(get_editor_theme_icon(SNAME("Load")));
resource_save_button->set_icon(get_editor_theme_icon(SNAME("Save")));
resource_extra_button->set_icon(get_editor_theme_icon(SNAME("GuiTabMenuHl")));
open_docs_button->set_icon(get_editor_theme_icon(SNAME("HelpSearch")));
PopupMenu *resource_extra_popup = resource_extra_button->get_popup();
resource_extra_popup->set_item_icon(resource_extra_popup->get_item_index(RESOURCE_EDIT_CLIPBOARD), get_theme_icon(SNAME("ActionPaste"), SNAME("EditorIcons")));
resource_extra_popup->set_item_icon(resource_extra_popup->get_item_index(RESOURCE_COPY), get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")));
resource_extra_popup->set_item_icon(resource_extra_popup->get_item_index(RESOURCE_EDIT_CLIPBOARD), get_editor_theme_icon(SNAME("ActionPaste")));
resource_extra_popup->set_item_icon(resource_extra_popup->get_item_index(RESOURCE_COPY), get_editor_theme_icon(SNAME("ActionCopy")));
if (is_layout_rtl()) {
backward_button->set_icon(get_theme_icon(SNAME("Forward"), SNAME("EditorIcons")));
forward_button->set_icon(get_theme_icon(SNAME("Back"), SNAME("EditorIcons")));
backward_button->set_icon(get_editor_theme_icon(SNAME("Forward")));
forward_button->set_icon(get_editor_theme_icon(SNAME("Back")));
} else {
backward_button->set_icon(get_theme_icon(SNAME("Back"), SNAME("EditorIcons")));
forward_button->set_icon(get_theme_icon(SNAME("Forward"), SNAME("EditorIcons")));
backward_button->set_icon(get_editor_theme_icon(SNAME("Back")));
forward_button->set_icon(get_editor_theme_icon(SNAME("Forward")));
}
history_menu->set_icon(get_theme_icon(SNAME("History"), SNAME("EditorIcons")));
object_menu->set_icon(get_theme_icon(SNAME("Tools"), SNAME("EditorIcons")));
search->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
history_menu->set_icon(get_editor_theme_icon(SNAME("History")));
object_menu->set_icon(get_editor_theme_icon(SNAME("Tools")));
search->set_right_icon(get_editor_theme_icon(SNAME("Search")));
if (info_is_warning) {
info->set_icon(get_theme_icon(SNAME("NodeWarning"), SNAME("EditorIcons")));
info->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor")));
info->set_icon(get_editor_theme_icon(SNAME("NodeWarning")));
info->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
} else {
info->set_icon(get_theme_icon(SNAME("NodeInfo"), SNAME("EditorIcons")));
info->add_theme_color_override("font_color", get_theme_color(SNAME("font_color"), SNAME("Editor")));
info->set_icon(get_editor_theme_icon(SNAME("NodeInfo")));
info->add_theme_color_override("font_color", get_theme_color(SNAME("font_color"), EditorStringName(Editor)));
}
} break;
}
@@ -485,11 +486,11 @@ void InspectorDock::set_info(const String &p_button_text, const String &p_messag
info_is_warning = p_is_warning;
if (info_is_warning) {
info->set_icon(get_theme_icon(SNAME("NodeWarning"), SNAME("EditorIcons")));
info->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor")));
info->set_icon(get_editor_theme_icon(SNAME("NodeWarning")));
info->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
} else {
info->set_icon(get_theme_icon(SNAME("NodeInfo"), SNAME("EditorIcons")));
info->add_theme_color_override("font_color", get_theme_color(SNAME("font_color"), SNAME("Editor")));
info->set_icon(get_editor_theme_icon(SNAME("NodeInfo")));
info->add_theme_color_override("font_color", get_theme_color(SNAME("font_color"), EditorStringName(Editor)));
}
if (!p_button_text.is_empty() && !p_message.is_empty()) {
@@ -540,8 +541,8 @@ void InspectorDock::update(Object *p_object) {
PopupMenu *p = object_menu->get_popup();
p->clear();
p->add_icon_shortcut(get_theme_icon(SNAME("GuiTreeArrowDown"), SNAME("EditorIcons")), ED_SHORTCUT("property_editor/expand_all", TTR("Expand All")), EXPAND_ALL);
p->add_icon_shortcut(get_theme_icon(SNAME("GuiTreeArrowRight"), SNAME("EditorIcons")), ED_SHORTCUT("property_editor/collapse_all", TTR("Collapse All")), COLLAPSE_ALL);
p->add_icon_shortcut(get_editor_theme_icon(SNAME("GuiTreeArrowDown")), ED_SHORTCUT("property_editor/expand_all", TTR("Expand All")), EXPAND_ALL);
p->add_icon_shortcut(get_editor_theme_icon(SNAME("GuiTreeArrowRight")), ED_SHORTCUT("property_editor/collapse_all", TTR("Collapse All")), COLLAPSE_ALL);
// Calling it 'revertable' internally, because that's what the implementation is based on, but labeling it as 'non-default' because that's more user friendly, even if not 100% accurate.
p->add_shortcut(ED_SHORTCUT("property_editor/expand_revertable", TTR("Expand Non-Default")), EXPAND_REVERTABLE);