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

The Clip Children option in Sprite2D does not work correctly #79885

Open
Aidaxo opened this issue Jul 25, 2023 · 5 comments
Open

The Clip Children option in Sprite2D does not work correctly #79885

Aidaxo opened this issue Jul 25, 2023 · 5 comments

Comments

@Aidaxo
Copy link

Aidaxo commented Jul 25, 2023

Godot version

4.1.1.stable

System information

Godot v4.1.1.stable - Windows 10.0.20348 - Vulkan (Forward+) - dedicated NVIDIA RTX A2000 12GB (NVIDIA; 31.0.15.3625) - Intel(R) Xeon(R) Gold 6342 CPU @ 2.80GHz (48 Threads)

Issue description

The 2D Masking / Clipping feature was introduced in version 4.0.
https://godotengine.org/article/godots-2d-engine-gets-several-improvements-upcoming-40/

It was a really handy feature, but when updating 4.0->4.1.1 it suddenly stopped working.

The test project opened in Godot 4.0 is displayed correctly.

image

The same project opened in 4.1.1 looks bad.

image

Experimentally, we were able to establish that the changes in the behaviour of the function occurred in 4.0.1.

Steps to reproduce

When Clip Children=Clip Only is enabled in the properties of the masking Sprite2D, its texture continues to be displayed and no masking occurs.

Minimal reproduction project

N/A

@Calinou
Copy link
Member

Calinou commented Jul 25, 2023

@Aidaxo Please upload a minimal reproduction project to make this easier to troubleshoot.

@Aidaxo
Copy link
Author

Aidaxo commented Jul 25, 2023

Minimal reproduction project is attached
test_project.zip

@Swarkin
Copy link
Contributor

Swarkin commented Aug 6, 2023

Most likely related:
Having a parent with clip_children enabled will make all children's clip_children behave as if they were set to Clip + Draw.
Trying to show it here:

unknown_2023.08.06-03.01.mp4

This does not seem like intended behaviour.

@klaritan
Copy link

Can confirm this is an issue. Sprite2D parent simply cannot clip children (also Sprite2D) at all. Still an issue for latest Godot 4.2

@clayjohn
Copy link
Member

clayjohn commented Jan 6, 2024

The problem here is that you are trying to enable clip_children on a node that is a child of a CanvasGroup.

The docs explicitly say that you cannot do that:

Note: Since CanvasGroup and CanvasItem.clip_children both utilize the backbuffer, children of a CanvasGroup who have their CanvasItem.clip_children set to anything other than CanvasItem.CLIP_CHILDREN_DISABLED will not function correctly.

That being said, there is already a PR to change the behaviour of clip_children so that it will support nesting. See #74859

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants