summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2022-08-22 22:07:02 +0300
committerYuri Sizov <yuris@humnom.net>2022-09-07 23:31:31 +0300
commit817d4db21f183d4e1bdb5c1101f221aa3ed10da0 (patch)
treed119acddd84380336d056ad425dfc6c2b9eb6574 /core/io
parent6b92dbfce2868f71926d2720014e45af999f21be (diff)
Allow images to be imported "for editor use" and respect editor settings
Diffstat (limited to 'core/io')
-rw-r--r--core/io/image_loader.h1
-rw-r--r--core/io/resource_importer.cpp9
2 files changed, 10 insertions, 0 deletions
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;
}