From 96618b2cf8ca0ea2aca9c1b68c02f65c2b04a117 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 19 Sep 2025 23:43:29 +0200 Subject: [PATCH] Document CanvasItem visibility layers not being inherited from parent nodes --- doc/classes/CanvasItem.xml | 1 + doc/classes/Viewport.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index df94945848a..dfb06a494f3 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -655,6 +655,7 @@ The rendering layer in which this [CanvasItem] is rendered by [Viewport] nodes. A [Viewport] will render a [CanvasItem] if it and all its parents share a layer with the [Viewport]'s canvas cull mask. + [b]Note:[/b] A [CanvasItem] does not inherit its parents' visibility layers. This means that if a parent [CanvasItem] does not have all the same layers as its child, the child may not be visible even if both the parent and child have [member visible] set to [code]true[/code]. For example, if a parent has layer 1 and a child has layer 2, the child will not be visible in a [Viewport] with the canvas cull mask set to layer 1 or 2 (see [member Viewport.canvas_cull_mask]). To ensure that both the parent and child are visible, the parent must have both layers 1 and 2, or the child must have [member top_level] set to [code]true[/code]. If [code]true[/code], this [CanvasItem] may be drawn. Whether this [CanvasItem] is actually drawn depends on the visibility of all of its [CanvasItem] ancestors. In other words: this [CanvasItem] will be drawn when [method is_visible_in_tree] returns [code]true[/code] and all [CanvasItem] ancestors share at least one [member visibility_layer] with this [CanvasItem]. diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index 40b720c7422..54f87ca72b8 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -325,6 +325,7 @@ The rendering layers in which this [Viewport] renders [CanvasItem] nodes. + [b]Note:[/b] A [CanvasItem] does not inherit its parents' visibility layers. See [member CanvasItem.visibility_layer]'s description for details. Sets the default filter mode used by [CanvasItem]s in this Viewport.