diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 063a13efc0c..76b322dc8ce 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -1272,6 +1272,14 @@ bool AtlasTexture::is_pixel_opaque(int p_x, int p_y) const { return atlas->is_pixel_opaque(x, y); } +Ref AtlasTexture::get_image() const { + if (!atlas.is_valid()) { + return Ref(); + } + + return atlas->get_image()->get_rect(region); +} + AtlasTexture::AtlasTexture() {} ///////////////////////////////////////// diff --git a/scene/resources/texture.h b/scene/resources/texture.h index f6b991c3359..576c053c25c 100644 --- a/scene/resources/texture.h +++ b/scene/resources/texture.h @@ -252,6 +252,8 @@ public: bool is_pixel_opaque(int p_x, int p_y) const override; + virtual Ref get_image() const override; + AtlasTexture(); };