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

Node: Add increaseUsage() #27672

Merged
merged 1 commit into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
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
14 changes: 11 additions & 3 deletions examples/jsm/nodes/core/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,20 @@ class Node extends EventDispatcher {

}

analyze( builder ) {
increaseUsage( builder ) {

const nodeData = builder.getDataFromNode( this );
nodeData.dependenciesCount = nodeData.dependenciesCount === undefined ? 1 : nodeData.dependenciesCount + 1;
nodeData.usageCount = nodeData.usageCount === undefined ? 1 : nodeData.usageCount + 1;

return nodeData.usageCount;

}

analyze( builder ) {

const usageCount = this.increaseUsage( builder );

if ( nodeData.dependenciesCount === 1 ) {
if ( usageCount === 1 ) {

// node flow children

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/nodes/core/TempNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TempNode extends Node {

hasDependencies( builder ) {

return builder.getDataFromNode( this ).dependenciesCount > 1;
return builder.getDataFromNode( this ).usageCount > 1;

}

Expand Down