@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.
62 lines (58 loc) • 2.51 kB
JavaScript
import { F as FlowGraphBlock, g as getNumericValue, G as GetFlowGraphAssetWithType } from './KHR_interactivity-CEwUaqxQ.esm.js';
import { R as RichTypeAny, F as FlowGraphInteger } 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 */
/**
* A block that will deliver an asset as an output, based on its type and place in the assets index.
*
* The assets are loaded from the assetsContext defined in the context running this block. The assetsContext is a class extending AbstractClass,
* meaning it can be a Scene, an AssetsContainers, and any other class that extends AbstractClass.
*/
class FlowGraphGetAssetBlock extends FlowGraphBlock {
constructor(
/**
* the configuration of the block
*/
config) {
super(config);
this.config = config;
this.type = this.registerDataInput("type", RichTypeAny, config.type);
this.value = this.registerDataOutput("value", RichTypeAny);
this.index = this.registerDataInput("index", RichTypeAny, new FlowGraphInteger(getNumericValue(config.index ?? -1)));
}
_updateOutputs(context) {
const type = this.type.getValue(context);
const index = this.index.getValue(context);
// get the asset from the context
const asset = GetFlowGraphAssetWithType(context.assetsContext, type, getNumericValue(index), this.config.useIndexAsUniqueId);
this.value.setValue(asset, context);
}
/**
* Gets the class name of this block
* @returns the class name
*/
getClassName() {
return "FlowGraphGetAssetBlock" /* FlowGraphBlockNames.GetAsset */;
}
}
let _Registered = false;
/**
* Register side effects for flowGraphGetAssetBlock.
* Safe to call multiple times; only the first call has an effect.
*/
function RegisterFlowGraphGetAssetBlock() {
if (_Registered) {
return;
}
_Registered = true;
RegisterClass("FlowGraphGetAssetBlock" /* FlowGraphBlockNames.GetAsset */, FlowGraphGetAssetBlock);
}
/**
* Re-exports pure implementation and applies runtime side effects.
* Import flowGraphGetAssetBlock.pure for tree-shakeable, side-effect-free usage.
*/
RegisterFlowGraphGetAssetBlock();
export { FlowGraphGetAssetBlock, RegisterFlowGraphGetAssetBlock };
//# sourceMappingURL=flowGraphGetAssetBlock-BrgJK_p8.esm.js.map