diff options
| author | Pieter-Jan Briers | 2018-05-12 16:53:45 +0200 |
|---|---|---|
| committer | Pieter-Jan Briers | 2018-05-14 19:11:41 +0200 |
| commit | 622a754584d2b9442aee3d5c3835556451225262 (patch) | |
| tree | b5ea9e05c90b43b4a50aa477a8e3fce71d5ebca8 /scene/resources | |
| parent | 81b1d3c846de263cf843e9e0e9d7c0c0a94f65c8 (diff) | |
| download | godot-622a754584d2b9442aee3d5c3835556451225262.tar.gz godot-622a754584d2b9442aee3d5c3835556451225262.tar.zst godot-622a754584d2b9442aee3d5c3835556451225262.zip | |
Diffstat (limited to 'scene/resources')
| -rw-r--r-- | scene/resources/texture.cpp | 9 | ||||
| -rw-r--r-- | scene/resources/texture.h | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index c0f6756fd..56a2e7afb 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -220,12 +220,15 @@ Image::Format ImageTexture::get_format() const { return format; } -void ImageTexture::load(const String &p_path) { +Error ImageTexture::load(const String &p_path) { Ref<Image> img; img.instance(); - img->load(p_path); - create_from_image(img); + Error err = img->load(p_path); + if (err == OK) { + create_from_image(img); + } + return err; } void ImageTexture::set_data(const Ref<Image> &p_image) { diff --git a/scene/resources/texture.h b/scene/resources/texture.h index 93d7ec4ef..d81fd3b19 100644 --- a/scene/resources/texture.h +++ b/scene/resources/texture.h @@ -124,7 +124,7 @@ public: void set_flags(uint32_t p_flags); uint32_t get_flags() const; Image::Format get_format() const; - void load(const String &p_path); + Error load(const String &p_path); void set_data(const Ref<Image> &p_image); Ref<Image> get_data() const; |
