Skip to content

Commit d06d498

Browse files
committed
add builder.flowBuildStage()
1 parent 9b40442 commit d06d498

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

src/nodes/core/NodeBuilder.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,6 +2216,28 @@ class NodeBuilder {
22162216

22172217
}
22182218

2219+
/**
2220+
* Executes the node in a specific build stage.
2221+
*
2222+
* @param {Node} node - The node to execute.
2223+
* @param {string} buildStage - The build stage to execute the node in.
2224+
* @param {Node|string|null} output - Expected output type. For example 'vec3'.
2225+
* @return {Node|string|null} The result of the node build.
2226+
*/
2227+
flowBuildStage( node, buildStage, output = null ) {
2228+
2229+
const previousBuildStage = this.getBuildStage();
2230+
2231+
this.setBuildStage( buildStage );
2232+
2233+
const result = node.build( this, output );
2234+
2235+
this.setBuildStage( previousBuildStage );
2236+
2237+
return result;
2238+
2239+
}
2240+
22192241
/**
22202242
* Runs the node flow through all the steps of creation, 'setup', 'analyze', 'generate'.
22212243
*

src/nodes/math/ConditionalNode.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ class ConditionalNode extends Node {
7373

7474
// fallback setup
7575

76-
// TODO: use build here
77-
78-
this.setup( builder );
76+
builder.flowBuildStage( this, 'setup' );
7977

8078
return this.getNodeType( builder );
8179

0 commit comments

Comments
 (0)