summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2018-07-18 20:34:21 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2018-07-18 20:34:21 +0200
commit49d0af3c8ef1f7add1aec66f66acbbe0c969677b (patch)
treeb10da6d5b52ab245f794d8c86f45dfae0f053874
parentb538254b1816668938aa63116accc147c97a0eb0 (diff)
Fix CanvasItem search for a CanvasLayer
This fixes the situation where a `CanvasItem` descendant of a `Viewport` which in turn is a descendant of a `CanvasLayer` prefers the more outer `CanvasLayer` rather than the `Vierport`'s. Because of that, `CanvasItem`s inside a `Viewport` inside a `CanvasLayer` were being rendered to the main `Viewport` instead of the render target of the innermost one.
-rw-r--r--scene/2d/canvas_item.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index 47326b9be2..a035d9021f 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -411,6 +411,9 @@ void CanvasItem::_enter_canvas() {
if (canvas_layer) {
break;
}
+ if (Object::cast_to<Viewport>(n)) {
+ break;
+ }
n = n->get_parent();
}