mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 06:11:29 +03:00
Add EditorStringNames singleton
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include "core/os/os.h"
|
||||
#include "editor/editor_scale.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/editor_string_names.h"
|
||||
#include "scene/resources/image_texture.h"
|
||||
|
||||
void EditorProfiler::_make_metric_ptrs(Metric &m) {
|
||||
@@ -140,11 +141,11 @@ String EditorProfiler::_get_time_as_text(const Metric &m, float p_time, int p_ca
|
||||
}
|
||||
|
||||
Color EditorProfiler::_get_color_from_signature(const StringName &p_signature) const {
|
||||
Color bc = get_theme_color(SNAME("error_color"), SNAME("Editor"));
|
||||
Color bc = get_theme_color(SNAME("error_color"), EditorStringName(Editor));
|
||||
double rot = ABS(double(p_signature.hash()) / double(0x7FFFFFFF));
|
||||
Color c;
|
||||
c.set_hsv(rot, bc.get_s(), bc.get_v());
|
||||
return c.lerp(get_theme_color(SNAME("base_color"), SNAME("Editor")), 0.07);
|
||||
return c.lerp(get_theme_color(SNAME("base_color"), EditorStringName(Editor)), 0.07);
|
||||
}
|
||||
|
||||
void EditorProfiler::_item_edited() {
|
||||
@@ -185,7 +186,7 @@ void EditorProfiler::_update_plot() {
|
||||
}
|
||||
|
||||
uint8_t *wr = graph_image.ptrw();
|
||||
const Color background_color = get_theme_color(SNAME("dark_color_2"), SNAME("Editor"));
|
||||
const Color background_color = get_theme_color(SNAME("dark_color_2"), EditorStringName(Editor));
|
||||
|
||||
// Clear the previous frame and set the background color.
|
||||
for (int i = 0; i < desired_len; i += 4) {
|
||||
@@ -379,10 +380,10 @@ void EditorProfiler::_update_frame() {
|
||||
|
||||
void EditorProfiler::_update_button_text() {
|
||||
if (activate->is_pressed()) {
|
||||
activate->set_icon(get_theme_icon(SNAME("Stop"), SNAME("EditorIcons")));
|
||||
activate->set_icon(get_editor_theme_icon(SNAME("Stop")));
|
||||
activate->set_text(TTR("Stop"));
|
||||
} else {
|
||||
activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons")));
|
||||
activate->set_icon(get_editor_theme_icon(SNAME("Play")));
|
||||
activate->set_text(TTR("Start"));
|
||||
}
|
||||
}
|
||||
@@ -409,8 +410,8 @@ void EditorProfiler::_notification(int p_what) {
|
||||
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
|
||||
case NOTIFICATION_THEME_CHANGED:
|
||||
case NOTIFICATION_TRANSLATION_CHANGED: {
|
||||
activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons")));
|
||||
clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")));
|
||||
activate->set_icon(get_editor_theme_icon(SNAME("Play")));
|
||||
clear_button->set_icon(get_editor_theme_icon(SNAME("Clear")));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user