@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
46 lines (45 loc) • 1.89 kB
JavaScript
;
import { TRIGGER_CONNECTION_NAME, TypedJsNode } from "./_Base";
import { NodeParamsConfig } from "../utils/params/ParamsConfig";
import { JsConnectionPoint, JsConnectionPointType, JS_CONNECTION_POINT_IN_NODE_DEF } from "../utils/io/connections/Js";
import { JsType } from "../../poly/registers/nodes/types/Js";
import { inputObject3D } from "./_BaseObject3D";
import { Poly } from "../../Poly";
import { InitFunctionJsDefinition } from "./utils/JsDefinition";
import { nodeMethodName } from "./code/assemblers/actor/ActorAssemblerUtils";
const CONNECTION_OPTIONS = JS_CONNECTION_POINT_IN_NODE_DEF;
class OnObjectBeforeDeleteJsParamsConfig extends NodeParamsConfig {
}
const ParamsConfig = new OnObjectBeforeDeleteJsParamsConfig();
export class OnObjectBeforeDeleteJsNode extends TypedJsNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig;
}
static type() {
return JsType.ON_OBJECT_BEFORE_DELETE;
}
isTriggering() {
return true;
}
initializeNode() {
super.initializeNode();
this.io.inputs.setNamedInputConnectionPoints([]);
this.io.outputs.setNamedOutputConnectionPoints([
new JsConnectionPoint(TRIGGER_CONNECTION_NAME, JsConnectionPointType.TRIGGER, CONNECTION_OPTIONS)
]);
}
setTriggeringLines(linesController, triggeredMethods) {
const object3D = inputObject3D(this, linesController);
const func = Poly.namedFunctionsRegister.getFunction(
"objectAddOnBeforeDeleteEventListener",
this,
linesController
);
const bodyLine = func.asString(object3D, `this`, `this.${nodeMethodName(this)}.bind(this)`);
linesController.addDefinitions(this, [
new InitFunctionJsDefinition(this, linesController, JsConnectionPointType.OBJECT_3D, this.path(), bodyLine)
]);
linesController.addTriggeringLines(this, [triggeredMethods], { gatherable: false });
}
}