From bfe2874a850e1e838ad34bb44f9847d9eac2a843 Mon Sep 17 00:00:00 2001 From: sunag Date: Sun, 4 Feb 2024 01:21:45 -0300 Subject: [PATCH] Node: Add increaseUsage() (#27672) --- examples/jsm/nodes/core/Node.js | 14 +++++++++++--- examples/jsm/nodes/core/TempNode.js | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/examples/jsm/nodes/core/Node.js b/examples/jsm/nodes/core/Node.js index 74fa2f1fc9a3b6..fd7f109c8387af 100644 --- a/examples/jsm/nodes/core/Node.js +++ b/examples/jsm/nodes/core/Node.js @@ -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 diff --git a/examples/jsm/nodes/core/TempNode.js b/examples/jsm/nodes/core/TempNode.js index cd643c79819e7c..5862075c2e3edf 100644 --- a/examples/jsm/nodes/core/TempNode.js +++ b/examples/jsm/nodes/core/TempNode.js @@ -12,7 +12,7 @@ class TempNode extends Node { hasDependencies( builder ) { - return builder.getDataFromNode( this ).dependenciesCount > 1; + return builder.getDataFromNode( this ).usageCount > 1; }