summaryrefslogtreecommitdiff
path: root/scene/main/viewport.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main/viewport.cpp')
-rw-r--r--scene/main/viewport.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 8df007dcc7..61d6fc7401 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -693,6 +693,13 @@ bool Viewport::use_arvr() {
return arvr;
}
+void Viewport::update_canvas_items() {
+ if (!is_inside_tree())
+ return;
+
+ _update_canvas_items(this);
+}
+
void Viewport::set_size(const Size2 &p_size) {
if (size == p_size.floor())
@@ -1128,6 +1135,26 @@ Transform2D Viewport::get_final_transform() const {
return stretch_transform * global_canvas_transform;
}
+void Viewport::_update_canvas_items(Node *p_node) {
+ if (p_node != this) {
+
+ Viewport *vp = Object::cast_to<Viewport>(p_node);
+ if (vp)
+ return;
+
+ CanvasItem *ci = Object::cast_to<CanvasItem>(p_node);
+ if (ci) {
+ ci->update();
+ }
+ }
+
+ int cc = p_node->get_child_count();
+
+ for (int i = 0; i < cc; i++) {
+ _update_canvas_items(p_node->get_child(i));
+ }
+}
+
void Viewport::set_size_override(bool p_enable, const Size2 &p_size, const Vector2 &p_margin) {
if (size_override == p_enable && p_size == size_override_size)