summaryrefslogtreecommitdiffstats
path: root/core/io/image.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/io/image.cpp')
-rw-r--r--core/io/image.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/core/io/image.cpp b/core/io/image.cpp
index fbf37cbee7..fa4484bb63 100644
--- a/core/io/image.cpp
+++ b/core/io/image.cpp
@@ -2611,23 +2611,25 @@ Image::AlphaMode Image::detect_alpha() const {
}
Error Image::load(const String &p_path) {
+ String path = ResourceUID::ensure_path(p_path);
#ifdef DEBUG_ENABLED
- if (p_path.begins_with("res://") && ResourceLoader::exists(p_path)) {
- WARN_PRINT(vformat("Loaded resource as image file, this will not work on export: '%s'. Instead, import the image file as an Image resource and load it normally as a resource.", p_path));
+ if (path.begins_with("res://") && ResourceLoader::exists(path)) {
+ WARN_PRINT(vformat("Loaded resource as image file, this will not work on export: '%s'. Instead, import the image file as an Image resource and load it normally as a resource.", path));
}
#endif
- return ImageLoader::load_image(p_path, this);
+ return ImageLoader::load_image(ResourceUID::ensure_path(p_path), this);
}
Ref<Image> Image::load_from_file(const String &p_path) {
+ String path = ResourceUID::ensure_path(p_path);
#ifdef DEBUG_ENABLED
- if (p_path.begins_with("res://") && ResourceLoader::exists(p_path)) {
- WARN_PRINT(vformat("Loaded resource as image file, this will not work on export: '%s'. Instead, import the image file as an Image resource and load it normally as a resource.", p_path));
+ if (path.begins_with("res://") && ResourceLoader::exists(path)) {
+ WARN_PRINT(vformat("Loaded resource as image file, this will not work on export: '%s'. Instead, import the image file as an Image resource and load it normally as a resource.", path));
}
#endif
Ref<Image> image;
image.instantiate();
- Error err = ImageLoader::load_image(p_path, image);
+ Error err = ImageLoader::load_image(path, image);
if (err != OK) {
ERR_FAIL_V_MSG(Ref<Image>(), vformat("Failed to load image. Error %d", err));
}