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

[batcher-2d.ts] Add a new hook-method , to check whether 'node' can be walked. #17203

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
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
15 changes: 14 additions & 1 deletion cocos/2d/renderer/batcher-2d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -789,8 +789,21 @@
this._currMaterial = mat;
}

/**
* @en
* check whether 'node' can be walked.
* Developers can override this method to implement custom behavior.
*
* @zh
* 判断 `node` 是否可以被 walk.

Check failure on line 798 in cocos/2d/renderer/batcher-2d.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Trailing spaces not allowed
* 开发者可以重写该方法, 以实现自定义的行为.
*/
public canWalkNode (node: Node): boolean {
return node._activeInHierarchy;

Check failure on line 802 in cocos/2d/renderer/batcher-2d.ts

View workflow job for this annotation

GitHub Actions / npm_test

Property '_activeInHierarchy' is protected and only accessible within class 'Node' and its subclasses.
}

public walk (node: Node, level = 0): void {
if (!node.activeInHierarchy) {
if (!this.canWalkNode(node)) {
return;
}
const children = node.children;
Expand Down
Loading