summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/canvas_item.cpp11
-rw-r--r--scene/2d/canvas_item.h2
2 files changed, 13 insertions, 0 deletions
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index 8eb5c9dfc8..b9cddfa572 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -821,6 +821,17 @@ void CanvasItem::_bind_methods() {
}
+Matrix32 CanvasItem::get_canvas_transform() const {
+
+ ERR_FAIL_COND_V(!is_inside_scene(),Matrix32());
+
+ if (canvas_layer)
+ return canvas_layer->get_transform();
+ else
+ return get_viewport()->get_canvas_transform();
+
+}
+
Matrix32 CanvasItem::get_viewport_transform() const {
ERR_FAIL_COND_V(!is_inside_scene(),Matrix32());
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index 397b206677..1c104c5fc2 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -195,6 +195,8 @@ public:
void set_block_transform_notify(bool p_enable);
bool is_block_transform_notify_enabled() const;
+
+ Matrix32 get_canvas_transform() const;
Matrix32 get_viewport_transform() const;
Rect2 get_viewport_rect() const;
RID get_viewport_rid() const;