diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2018-07-18 20:34:21 +0200 |
---|---|---|
committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2018-07-18 20:34:21 +0200 |
commit | 49d0af3c8ef1f7add1aec66f66acbbe0c969677b (patch) | |
tree | b10da6d5b52ab245f794d8c86f45dfae0f053874 | |
parent | b538254b1816668938aa63116accc147c97a0eb0 (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.cpp | 3 |
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(); } |