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

Fix the UIOpacity issue when the node is re-added to the scene. #17700

Merged
merged 6 commits into from
Oct 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cocos/2d/components/ui-opacity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ export class UIOpacity extends Component {
// there is a just UIRenderer but no UIOpacity on the node, we should just transport the parentOpacity to the node.
render.renderEntity.localOpacity = parentOpacity;
}
render.node._uiProps.localOpacity = render.renderEntity.localOpacity;
if (JSB) {
Copy link
Contributor

@qiuguohua qiuguohua Oct 12, 2024

Choose a reason for hiding this comment

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

It should be possible to remove it here? @yoki0805

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I got what you mean.
UIOpacity.setEntityLocalOpacityDirtyRecursively is only called on native platform.
I will remove the JSB checking here, thank you.

render.node._uiProps.localOpacity = render.renderEntity.localOpacity;
}
//No need for recursion here. Because it doesn't affect the capacity of the child nodes.
return;
}
Expand Down
Loading