@babylonjs/viewer
Version:
The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.
61 lines (57 loc) • 2.27 kB
JavaScript
import { F as FlowGraphBlock } from './KHR_interactivity-CEwUaqxQ.esm.js';
import { a as RichTypeBoolean, R as RichTypeAny } from './declarationMapper-CqO08-WM.esm.js';
import { u as RegisterClass } from './index-MZPybX0H.esm.js';
import './objectModelMapping-De5EKNEZ.esm.js';
import './spotLight.pure-CRdZC6Ci.esm.js';
/** This file must only contain pure code and pure imports */
/**
* Block that returns a value based on a condition.
*/
class FlowGraphConditionalDataBlock extends FlowGraphBlock {
/**
* Creates a new instance of the block
* @param config optional configuration for this block
*/
constructor(config) {
super(config);
this.condition = this.registerDataInput("condition", RichTypeBoolean);
this.onTrue = this.registerDataInput("onTrue", RichTypeAny);
this.onFalse = this.registerDataInput("onFalse", RichTypeAny);
this.output = this.registerDataOutput("output", RichTypeAny);
}
/**
* @internal
*/
_updateOutputs(context) {
// get the value of the condition
const condition = this.condition.getValue(context);
// set the value based on the condition truth-ness.
this.output.setValue(condition ? this.onTrue.getValue(context) : this.onFalse.getValue(context), context);
}
/**
* Gets the class name of this block
* @returns the class name
*/
getClassName() {
return "FlowGraphConditionalBlock" /* FlowGraphBlockNames.Conditional */;
}
}
let _Registered = false;
/**
* Register side effects for flowGraphConditionalDataBlock.
* Safe to call multiple times; only the first call has an effect.
*/
function RegisterFlowGraphConditionalDataBlock() {
if (_Registered) {
return;
}
_Registered = true;
RegisterClass("FlowGraphConditionalBlock" /* FlowGraphBlockNames.Conditional */, FlowGraphConditionalDataBlock);
}
/**
* Re-exports pure implementation and applies runtime side effects.
* Import flowGraphConditionalDataBlock.pure for tree-shakeable, side-effect-free usage.
*/
RegisterFlowGraphConditionalDataBlock();
export { FlowGraphConditionalDataBlock, RegisterFlowGraphConditionalDataBlock };
//# sourceMappingURL=flowGraphConditionalDataBlock-C_baDlAs.esm.js.map