From 49d0af3c8ef1f7add1aec66f66acbbe0c969677b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Wed, 18 Jul 2018 20:34:21 +0200 Subject: [PATCH] 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. --- scene/2d/canvas_item.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index 47326b9be21..a035d9021f3 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(n)) { + break; + } n = n->get_parent(); }