2
0
Эх сурвалжийг харах

CondNode: Fix duplicate conditional (#27828)

sunag 1 жил өмнө
parent
commit
3d07bacfe8

+ 10 - 0
examples/jsm/nodes/math/CondNode.js

@@ -41,11 +41,21 @@ class CondNode extends Node {
 		const type = this.getNodeType( builder );
 		const context = { tempWrite: false };
 
+		const nodeData = builder.getDataFromNode( this );
+
+		if ( nodeData.nodeProperty !== undefined ) {
+
+			return nodeData.nodeProperty;
+
+		}
+
 		const { ifNode, elseNode } = this;
 
 		const needsOutput = output !== 'void';
 		const nodeProperty = needsOutput ? property( type ).build( builder ) : '';
 
+		nodeData.nodeProperty = nodeProperty;
+
 		const nodeSnippet = contextNode( this.condNode/*, context*/ ).build( builder, 'bool' );
 
 		builder.addFlowCode( `\n${ builder.tab }if ( ${ nodeSnippet } ) {\n\n` ).addFlowTab();