Godot version:
N/A
OS/device including version:
N/A
Issue description:
CanvasLayer
uses layer
to describe what layer to draw its nodes on. But nearly every other 2D node uses the terminology "Z Index" (z_index
) to describe the same thing. This could be more consistent across them? One obvious solution could be to rename CanvasLayer
simply Canvas
and layer
to z_index
(although this would be API-breaking).
If I understand CanvasLayers correctly their layer
property works a bit differently than what z_index
does on 2D nodes. Naming them the same might be a little confusing, but it could be just me.
i agree with potato. layer also implies (to me anyway) something to do with the user interface. and canvaslayer is mostly used for ui stuff. so the distinction between them makes sense
It's not the same thing, because CanvasLayers are entirely separate from the z-index of Nodes.
The z-index controls the drawing order of Nodes inside of a CanvasLayer (by default, an invisible Layer 0 exists).
In the following tree you could change the z-index of either Sprite node to both 1000 or -1000 (with relative z on or off, doesn't matter) and neither of them would ever get drawn on top of the ColorRect because that one is in its own layer (default 1 for new CanvasLayer) above the base (default 0) layer.
As Pete said Z-Index and Layer values do not interact so it's both confusing and misleading to name them the same way.
We could, however, propose a better name for the layer. Like stack order/level or something like that.
@Sslaxx please recreate this post into https://github.com/godotengine/godot/issues/16863 - it's a place for renaming issues
Most helpful comment
It's not the same thing, because CanvasLayers are entirely separate from the z-index of Nodes.
The z-index controls the drawing order of Nodes inside of a CanvasLayer (by default, an invisible Layer 0 exists).
In the following tree you could change the z-index of either Sprite node to both 1000 or -1000 (with relative z on or off, doesn't matter) and neither of them would ever get drawn on top of the ColorRect because that one is in its own layer (default 1 for new CanvasLayer) above the base (default 0) layer.