UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

45 lines (44 loc) 3.01 kB
/** * processes input events * * */ import { NodeParamsConfig } from '../utils/params/ParamsConfig'; import { TypedJsNode } from './_Base'; import { BaseCodeProcessor } from '../../../core/code/FunctionBuilderUtils'; import { JsLinesCollectionController } from './code/utils/JsLinesCollectionController'; import { JsType } from '../../poly/registers/nodes/types/Js'; interface CompileOptions { triggerFunctionNode: boolean; } export declare const JS_CODE_DEFAULT_TS = "\nexport class CodeJsProcessor extends BaseCodeJsProcessor {\n\toverride initializeProcessor(){\n\t\tthis.io.inputs.setNamedInputConnectionPoints([\n\t\t\tnew JsConnectionPoint('myBoolParam', JsConnectionPointType.BOOLEAN),\n\t\t]);\n\t\tthis.io.outputs.setNamedOutputConnectionPoints([\n\t\t\tnew JsConnectionPoint(JsConnectionPointType.TRIGGER, JsConnectionPointType.TRIGGER),\n\t\t]);\n\t}\n\toverride setTriggerableLines(controller: JsLinesCollectionController) {\n\t\tconst object3D = this.inputObject3D(this, controller);\n\t\tconst myBoolParam = this.variableForInput(controller, 'myBoolParam');\n\n\t\tconst bodyLines = [\n\t\t\tobject3D + '.position.y += ' + myBoolParam + ' ? -1 : 1;',\n\t\t\tobject3D + '.updateMatrix()'\n\t\t];\n\t\tthis.addTriggerableLines(controller, bodyLines);\n\t}\n}\n"; export declare class BaseCodeJsProcessor extends BaseCodeProcessor { protected node: CodeJsNode; constructor(node: CodeJsNode); get pv(): import("../utils/params/ParamsValueAccessor").ParamsValueAccessorType<CodeJsParamsConfig>; get p(): import("../utils/params/ParamsAccessor").ParamsAccessorType<CodeJsParamsConfig>; get io(): import("../utils/io/IOController").IOController<import("../../poly/NodeContext").NodeContext.JS>; initializeProcessor(): void; setTriggerableLines(controller: JsLinesCollectionController): void; inputObject3D(processor: BaseCodeJsProcessor, controller: JsLinesCollectionController): string; protected variableForInput(controller: JsLinesCollectionController, inputName: string): string; protected addTriggerableLines(controller: JsLinesCollectionController, bodyLines: string[]): void; } declare class CodeJsParamsConfig extends NodeParamsConfig { codeTypescript: import("../utils/params/ParamsConfig").ParamTemplate<import("../../index_all").ParamType.STRING>; codeJavascript: import("../utils/params/ParamsConfig").ParamTemplate<import("../../index_all").ParamType.STRING>; } export declare class CodeJsNode extends TypedJsNode<CodeJsParamsConfig> { paramsConfig: CodeJsParamsConfig; static BaseCodeJsProcessor: typeof BaseCodeJsProcessor; static type(): JsType; protected _processor: BaseCodeJsProcessor | undefined; initializeNode(): void; setTriggerableLines(controller: JsLinesCollectionController): void; private _lastCompiledCode; private _compilationSuccessful; compiled(): boolean; compile(options: CompileOptions): void; static PARAM_CALLBACK_requestCompile(node: CodeJsNode): void; } export {};