diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2018-10-30 21:53:00 +0100 |
---|---|---|
committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2018-10-30 21:53:00 +0100 |
commit | cf8976de415573ed170c60fafa997725916bff55 (patch) | |
tree | 068ae7d3dfbae793458ab001b45a5097a6cd22f4 /scene | |
parent | aeddb30fa38215acf8620238209cb53f5bddc28d (diff) |
Fix canvas stacking not deterministic on same layer
Fixes #22687.
Diffstat (limited to 'scene')
-rw-r--r-- | scene/main/canvas_layer.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp index a2e890e7a7..0f5fd99281 100644 --- a/scene/main/canvas_layer.cpp +++ b/scene/main/canvas_layer.cpp @@ -35,7 +35,7 @@ void CanvasLayer::set_layer(int p_xform) { layer = p_xform; if (viewport.is_valid()) - VisualServer::get_singleton()->viewport_set_canvas_layer(viewport, canvas, layer); + VisualServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_position_in_parent()); } int CanvasLayer::get_layer() const { @@ -149,7 +149,7 @@ void CanvasLayer::_notification(int p_what) { viewport = vp->get_viewport_rid(); VisualServer::get_singleton()->viewport_attach_canvas(viewport, canvas); - VisualServer::get_singleton()->viewport_set_canvas_layer(viewport, canvas, layer); + VisualServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_position_in_parent()); VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas, transform); } break; @@ -159,6 +159,10 @@ void CanvasLayer::_notification(int p_what) { viewport = RID(); } break; + case NOTIFICATION_MOVED_IN_PARENT: { + + VisualServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_position_in_parent()); + } break; } } @@ -201,7 +205,7 @@ void CanvasLayer::set_custom_viewport(Node *p_viewport) { viewport = vp->get_viewport_rid(); VisualServer::get_singleton()->viewport_attach_canvas(viewport, canvas); - VisualServer::get_singleton()->viewport_set_canvas_layer(viewport, canvas, layer); + VisualServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_position_in_parent()); VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas, transform); } } |