diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-09-28 18:52:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-28 18:52:53 +0200 |
commit | 9556c3a30a9cb7cd8e67fafa5b30b4c4cfa8ade9 (patch) | |
tree | 73f26a7f5264a21833b0ef381f28bc7dbe158c3a /scene | |
parent | 0a3aa85a7bb9bbc887a34d8b17671cc5cb394ca8 (diff) | |
parent | 2cc2adedaaf4a0c99915c781b68ccb6b17e59a98 (diff) | |
download | redot-engine-9556c3a30a9cb7cd8e67fafa5b30b4c4cfa8ade9.tar.gz |
Merge pull request #53180 from boruok/4.0-fix-atlas-texture-return-null
Diffstat (limited to 'scene')
-rw-r--r-- | scene/resources/texture.cpp | 8 | ||||
-rw-r--r-- | scene/resources/texture.h | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 3dc32632cc..80cab99373 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -1248,6 +1248,14 @@ bool AtlasTexture::is_pixel_opaque(int p_x, int p_y) const { return atlas->is_pixel_opaque(x, y); } +Ref<Image> AtlasTexture::get_image() const { + if (!atlas.is_valid()) { + return Ref<Image>(); + } + + return atlas->get_image()->get_rect(region); +} + AtlasTexture::AtlasTexture() {} ///////////////////////////////////////// diff --git a/scene/resources/texture.h b/scene/resources/texture.h index 93f4e2de5a..862b9a47a6 100644 --- a/scene/resources/texture.h +++ b/scene/resources/texture.h @@ -250,6 +250,8 @@ public: bool is_pixel_opaque(int p_x, int p_y) const override; + virtual Ref<Image> get_image() const override; + AtlasTexture(); }; |