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

Fixed ClippingNode stencil needing global z set manually #1831

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

TyelorD
Copy link
Contributor

@TyelorD TyelorD commented Apr 17, 2024

Describe your changes

This bug has existed since the Cocos2d-x 3.x days. If you set the global z order of a ClippingNode to anything other than the default value, then the ClippingNode fails to clip anything unless the global z order is also set for the Stencil of that ClippingNode. This change makes the ClippingNode._stencil's global z order to follow the ClippingNode's.

Note: you can still manually set the global z order of the stencil as desired so as to break the clipping. But now the default behavior works correctly and the way one would expect, rather than the default behavior being broken and needing to set the global z order of the stencil to match so as to fix the clipping.

Issue ticket number and link

N/A

Checklist before requesting a review

For each PR

  • Add Copyright if it missed:
    - "Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md)."

  • I have performed a self-review of my code.

    Optional:

    • I have checked readme and add important infos to this PR.
    • I have added/adapted some tests too.

For core/new feature PR

  • I have checked readme and add important infos to this PR.
  • I have added thorough tests.

This bug has existed since the Cocos2d-x 3.x days. If you set the global z order of a ClippingNode to anything other than the default value, then the ClippingNode fails to clip anything unless the global z order is also set for the Stencil of that ClippingNode. This change makes the ClippingNode._stencil's global z order to follow the ClippingNode's. (Note: you could still manually set the global z order of the stencil as desired to break the clipping. But now the default behavior works correctly and the way one would expect.)
@halx99 halx99 merged commit 332eb9a into axmolengine:dev Apr 17, 2024
14 of 15 checks passed
@halx99 halx99 added this to the 2.1.3 milestone Apr 18, 2024
@halx99 halx99 added the enhancement New feature or request label Apr 18, 2024
@TyelorD TyelorD deleted the fix-clippingnode-global-z branch April 18, 2024 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants