From d20333cc29551b6d451c9f360252b2b231c553fb Mon Sep 17 00:00:00 2001 From: alpacat Date: Mon, 2 Jun 2025 22:18:53 +0800 Subject: [PATCH] Make svg files respect `interface/theme/icon_saturation` setting when being imported as `Texture2D`. --- editor/import/resource_importer_texture.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp index e6f4bcefbb..59e8c79586 100644 --- a/editor/import/resource_importer_texture.cpp +++ b/editor/import/resource_importer_texture.cpp @@ -35,6 +35,7 @@ #include "core/io/image_loader.h" #include "core/version.h" #include "editor/editor_file_system.h" +#include "editor/editor_settings.h" #include "editor/gui/editor_toaster.h" #include "editor/import/resource_importer_texture_settings.h" #include "editor/themes/editor_scale.h" @@ -794,9 +795,8 @@ Error ResourceImporterTexture::import(ResourceUID::ID p_source_id, const String // Load the editor-only image. Ref editor_image; - bool import_editor_image = use_editor_scale || convert_editor_colors; - if (import_editor_image) { + if (use_editor_scale || convert_editor_colors) { float editor_scale = use_editor_scale ? scale * EDSCALE : scale; int32_t editor_loader_flags = loader_flags; @@ -810,6 +810,11 @@ Error ResourceImporterTexture::import(ResourceUID::ID p_source_id, const String if (err != OK) { WARN_PRINT(vformat("Failed to import an image resource for editor use from '%s'.", p_source_file)); } else { + if (convert_editor_colors) { + float image_saturation = EDITOR_GET("interface/theme/icon_saturation"); + editor_image->adjust_bcs(1.0, 1.0, image_saturation); + } + images_imported.push_back(editor_image); } }