|
@@ -2611,23 +2611,25 @@ Image::AlphaMode Image::detect_alpha() const {
|
|
}
|
|
}
|
|
|
|
|
|
Error Image::load(const String &p_path) {
|
|
Error Image::load(const String &p_path) {
|
|
|
|
+ String path = ResourceUID::ensure_path(p_path);
|
|
#ifdef DEBUG_ENABLED
|
|
#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
|
|
#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) {
|
|
Ref<Image> Image::load_from_file(const String &p_path) {
|
|
|
|
+ String path = ResourceUID::ensure_path(p_path);
|
|
#ifdef DEBUG_ENABLED
|
|
#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
|
|
#endif
|
|
Ref<Image> image;
|
|
Ref<Image> image;
|
|
image.instantiate();
|
|
image.instantiate();
|
|
- Error err = ImageLoader::load_image(p_path, image);
|
|
|
|
|
|
+ Error err = ImageLoader::load_image(path, image);
|
|
if (err != OK) {
|
|
if (err != OK) {
|
|
ERR_FAIL_V_MSG(Ref<Image>(), vformat("Failed to load image. Error %d", err));
|
|
ERR_FAIL_V_MSG(Ref<Image>(), vformat("Failed to load image. Error %d", err));
|
|
}
|
|
}
|