Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve canvas layer index documentation #81270

Merged
merged 1 commit into from
Sep 26, 2023

Conversation

Sauermann
Copy link
Contributor

Document special case of identical canvas layer index.

resolve #81257
related to #81262

@@ -53,6 +53,7 @@
</member>
<member name="layer" type="int" setter="set_layer" getter="get_layer" default="1">
Layer index for draw order. Lower values are drawn behind higher values.
[b]Note:[/b] If multiple CanvasLayers have the same layer index, [CanvasItem]-children of one CanvasLayer are drawn behind the [CanvasItem]-children of the other CanvasLayer. Which CanvasLayer is drawn in front is non-deterministic.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really non-deterministic, or is it in scene tree order of the CanvasLayers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not only the scene tree order. You can see that in the Video of the linked issue.

Copy link
Member

@lawnjelly lawnjelly Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See also #69952 which made canvas layer ordering deterministic in 3.x (i.e. that PR makes layers render in scene tree order).
It may be an idea to say nothing about the determinism until this is fixed in 4.x.

If I remember correctly, the canvas layers were previously sorted by RID in 3.x, which was kind of haphazard and pseudo-deterministic. I don't know the current situation in 4.x.

This comment suggests it may be deterministic in 4.x, so maybe it warrants some investigation / issue:
#25384 (comment)

@YuriSizov YuriSizov requested a review from a team September 5, 2023 14:33
Document special case of identical canvas layer index.
@Sauermann Sauermann force-pushed the fix-canvas-layer-index-doc branch from 1489d56 to fffbb42 Compare September 18, 2023 19:33
@akien-mga akien-mga merged commit b9c36c9 into godotengine:master Sep 26, 2023
15 checks passed
@akien-mga
Copy link
Member

Thanks!

@Sauermann Sauermann deleted the fix-canvas-layer-index-doc branch September 26, 2023 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CanvasLayer Child Controls Z-Index Layering Issue
4 participants