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.
This commit is contained in:
Pedro J. Estébanez 2018-07-18 20:34:21 +02:00
parent b538254b18
commit 49d0af3c8e

View file

@ -411,6 +411,9 @@ void CanvasItem::_enter_canvas() {
if (canvas_layer) { if (canvas_layer) {
break; break;
} }
if (Object::cast_to<Viewport>(n)) {
break;
}
n = n->get_parent(); n = n->get_parent();
} }