From d734340d31f5bab103b24735b97fc7a049e9f27c Mon Sep 17 00:00:00 2001 From: kobewi Date: Fri, 15 Nov 2024 14:10:08 +0100 Subject: [PATCH] Fix boot splash loading when path is UID --- core/io/image.cpp | 14 ++++++-------- editor/editor_node.cpp | 2 +- main/main.cpp | 4 ++-- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/core/io/image.cpp b/core/io/image.cpp index fa4484bb63b4..fbf37cbee7c7 100644 --- a/core/io/image.cpp +++ b/core/io/image.cpp @@ -2611,25 +2611,23 @@ Image::AlphaMode Image::detect_alpha() const { } Error Image::load(const String &p_path) { - String path = ResourceUID::ensure_path(p_path); #ifdef DEBUG_ENABLED - 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)); + 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)); } #endif - return ImageLoader::load_image(ResourceUID::ensure_path(p_path), this); + return ImageLoader::load_image(p_path, this); } Ref Image::load_from_file(const String &p_path) { - String path = ResourceUID::ensure_path(p_path); #ifdef DEBUG_ENABLED - 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)); + 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)); } #endif Ref image; image.instantiate(); - Error err = ImageLoader::load_image(path, image); + Error err = ImageLoader::load_image(p_path, image); if (err != OK) { ERR_FAIL_V_MSG(Ref(), vformat("Failed to load image. Error %d", err)); } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 87f1f1b8a021..3b05a9ed8c39 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -5428,7 +5428,7 @@ void EditorNode::redo() { bool EditorNode::ensure_main_scene(bool p_from_native) { pick_main_scene->set_meta("from_native", p_from_native); // Whether from play button or native run. - String main_scene = GLOBAL_GET("application/run/main_scene"); + String main_scene = ResourceUID::ensure_path(GLOBAL_GET("application/run/main_scene")); if (main_scene.is_empty()) { current_menu_option = -1; diff --git a/main/main.cpp b/main/main.cpp index 0a905f16cac6..8c6fb2330da1 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -3457,7 +3457,7 @@ void Main::setup_boot_logo() { if (show_logo) { //boot logo! const bool boot_logo_image = GLOBAL_DEF_BASIC("application/boot_splash/show_image", true); - const String boot_logo_path = String(GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "application/boot_splash/image", PROPERTY_HINT_FILE, "*.png"), String())).strip_edges(); + const String boot_logo_path = ResourceUID::ensure_path(GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "application/boot_splash/image", PROPERTY_HINT_FILE, "*.png"), String())).strip_edges(); const bool boot_logo_scale = GLOBAL_DEF_BASIC("application/boot_splash/fullsize", true); const bool boot_logo_filter = GLOBAL_DEF_BASIC("application/boot_splash/use_filter", true); @@ -4221,7 +4221,7 @@ int Main::start() { } #endif - String icon_path = GLOBAL_GET("application/config/icon"); + const String icon_path = ResourceUID::ensure_path(GLOBAL_GET("application/config/icon")); if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_ICON) && !icon_path.is_empty() && !has_icon) { Ref icon; icon.instantiate();