From ef5095720b56e72d99b8ca2773e2a5fa24f7097d Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 14 Aug 2018 16:52:40 -0300 Subject: -Deprecate ImageTexture::load -Add warning to Image::load when loading resources -Add script binding for get_configuration_warning --- core/image.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/image.cpp b/core/image.cpp index 65905c83e8..c94f2c3534 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -36,8 +36,8 @@ #include "math_funcs.h" #include "print_string.h" +#include "io/resource_loader.h" #include "thirdparty/misc/hq2x.h" - #include const char *Image::format_names[Image::FORMAT_MAX] = { @@ -1582,7 +1582,11 @@ Image::AlphaMode Image::detect_alpha() const { } Error Image::load(const String &p_path) { - +#ifdef DEBUG_ENABLED + if (p_path.begins_with("res://") && ResourceLoader::exists(p_path)) { + WARN_PRINTS("Loaded resource as image file, this will not work on export: '" + p_path + "'. Instead, import the image file as an Image resource and load it normally as a resource."); + } +#endif return ImageLoader::load_image(p_path, this); } -- cgit v1.2.3