From 817d4db21f183d4e1bdb5c1101f221aa3ed10da0 Mon Sep 17 00:00:00 2001 From: Yuri Sizov Date: Mon, 22 Aug 2022 22:07:02 +0300 Subject: Allow images to be imported "for editor use" and respect editor settings --- core/io/image_loader.h | 1 + core/io/resource_importer.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) (limited to 'core/io') diff --git a/core/io/image_loader.h b/core/io/image_loader.h index cb64d2310e..bf78005e40 100644 --- a/core/io/image_loader.h +++ b/core/io/image_loader.h @@ -52,6 +52,7 @@ public: enum LoaderFlags { FLAG_NONE = 0, FLAG_FORCE_LINEAR = 1, + FLAG_CONVERT_COLORS = 2, }; virtual ~ImageFormatLoader() {} diff --git a/core/io/resource_importer.cpp b/core/io/resource_importer.cpp index aa7f96a047..d923522317 100644 --- a/core/io/resource_importer.cpp +++ b/core/io/resource_importer.cpp @@ -108,6 +108,15 @@ Error ResourceFormatImporter::_get_path_and_type(const String &p_path, PathAndTy } } +#ifdef TOOLS_ENABLED + if (r_path_and_type.metadata && !r_path_and_type.path.is_empty()) { + Dictionary metadata = r_path_and_type.metadata; + if (metadata.has("has_editor_variant")) { + r_path_and_type.path = r_path_and_type.path.get_basename() + ".editor." + r_path_and_type.path.get_extension(); + } + } +#endif + if (r_path_and_type.path.is_empty() || r_path_and_type.type.is_empty()) { return ERR_FILE_CORRUPT; } -- cgit v1.2.3