diff options
author | Thaddeus Crews <repiteo@outlook.com> | 2024-11-14 14:52:01 -0600 |
---|---|---|
committer | Thaddeus Crews <repiteo@outlook.com> | 2024-11-14 14:52:01 -0600 |
commit | 8726f84d5f1857e24f729e41ecd04d62b1195ce3 (patch) | |
tree | c5fbfabaf619fd1481b9c63891d7397c7d2a9710 /core/io/image.cpp | |
parent | 36fac3df7a551213379853aec4cde2294a1fd215 (diff) | |
parent | 0dabcd99413665bbc5fe72bdaa6a353efb65f7cd (diff) | |
download | redot-engine-8726f84d5f1857e24f729e41ecd04d62b1195ce3.tar.gz |
Merge pull request #99226 from KoBeWi/uidification
Resource UID fixes and improvements
Diffstat (limited to 'core/io/image.cpp')
-rw-r--r-- | core/io/image.cpp | 14 |
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)); } |