summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/canvas_layer.cpp19
-rw-r--r--scene/main/canvas_layer.h1
2 files changed, 20 insertions, 0 deletions
diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp
index a2e890e7a7..c044443b51 100644
--- a/scene/main/canvas_layer.cpp
+++ b/scene/main/canvas_layer.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "canvas_layer.h"
+#include "scene/2d/canvas_item.h"
#include "viewport.h"
void CanvasLayer::set_layer(int p_xform) {
@@ -62,6 +63,24 @@ void CanvasLayer::_update_xform() {
transform.set_origin(ofs);
if (viewport.is_valid())
VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas, transform);
+
+ if (!is_inside_tree())
+ return;
+
+ _notify_xform(this);
+}
+
+void CanvasLayer::_notify_xform(Node *p_node) {
+
+ for (int i = 0; i < p_node->get_child_count(); i++) {
+
+ CanvasItem *ci = Object::cast_to<CanvasItem>(p_node->get_child(i));
+ if (ci) {
+ ci->_notify_transform(ci);
+ } else {
+ _notify_xform(p_node->get_child(i));
+ }
+ }
}
void CanvasLayer::_update_locrotscale() {
diff --git a/scene/main/canvas_layer.h b/scene/main/canvas_layer.h
index aae23fbb12..fd347c4739 100644
--- a/scene/main/canvas_layer.h
+++ b/scene/main/canvas_layer.h
@@ -56,6 +56,7 @@ class CanvasLayer : public Node {
int sort_index;
void _update_xform();
+ void _notify_xform(Node *p_node);
void _update_locrotscale();
protected: