summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_settings.cpp2
-rw-r--r--editor/import/resource_importer_texture.cpp6
-rw-r--r--editor/plugins/editor_preview_plugins.cpp4
3 files changed, 10 insertions, 2 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 68ac122e63..1ac1d6f048 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -1190,7 +1190,7 @@ bool EditorSettings::is_dark_theme() {
int LIGHT_COLOR = 2;
Color base_color = get("interface/theme/base_color");
int icon_font_color_setting = get("interface/theme/icon_and_font_color");
- return (icon_font_color_setting == AUTO_COLOR && ((base_color.r + base_color.g + base_color.b) / 3.0) < 0.5) || icon_font_color_setting == LIGHT_COLOR;
+ return (icon_font_color_setting == AUTO_COLOR && base_color.get_luminance() < 0.5) || icon_font_color_setting == LIGHT_COLOR;
}
void EditorSettings::list_text_editor_themes() {
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index b1fa2eda28..5ca61e4c39 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -37,6 +37,8 @@
#include "editor/editor_node.h"
void ResourceImporterTexture::_texture_reimport_roughness(const Ref<StreamTexture2D> &p_tex, const String &p_normal_path, RS::TextureDetectRoughnessChannel p_channel) {
+ ERR_FAIL_COND(p_tex.is_null());
+
MutexLock lock(singleton->mutex);
StringName path = p_tex->get_path();
@@ -51,6 +53,8 @@ void ResourceImporterTexture::_texture_reimport_roughness(const Ref<StreamTextur
}
void ResourceImporterTexture::_texture_reimport_3d(const Ref<StreamTexture2D> &p_tex) {
+ ERR_FAIL_COND(p_tex.is_null());
+
MutexLock lock(singleton->mutex);
StringName path = p_tex->get_path();
@@ -63,6 +67,8 @@ void ResourceImporterTexture::_texture_reimport_3d(const Ref<StreamTexture2D> &p
}
void ResourceImporterTexture::_texture_reimport_normal(const Ref<StreamTexture2D> &p_tex) {
+ ERR_FAIL_COND(p_tex.is_null());
+
MutexLock lock(singleton->mutex);
StringName path = p_tex->get_path();
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp
index 871b72d9c3..f7ec0f8c5c 100644
--- a/editor/plugins/editor_preview_plugins.cpp
+++ b/editor/plugins/editor_preview_plugins.cpp
@@ -852,7 +852,9 @@ Ref<Texture2D> EditorFontPreviewPlugin::generate_from_path(const String &p_path,
Ref<Font> font = sampled_font;
- font->draw_string(canvas_item, pos, sample, HORIZONTAL_ALIGNMENT_LEFT, -1.f, 50, Color(1, 1, 1));
+ const Color c = GLOBAL_GET("rendering/environment/defaults/default_clear_color");
+ const float fg = c.get_luminance() < 0.5 ? 1.0 : 0.0;
+ font->draw_string(canvas_item, pos, sample, HORIZONTAL_ALIGNMENT_LEFT, -1.f, 50, Color(fg, fg, fg));
RS::get_singleton()->connect(SNAME("frame_pre_draw"), callable_mp(const_cast<EditorFontPreviewPlugin *>(this), &EditorFontPreviewPlugin::_generate_frame_started), Vector<Variant>(), Object::CONNECT_ONESHOT);