UNPKG

@polygonjs/polygonjs

Version:

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

45 lines (44 loc) 1.47 kB
"use strict"; import { TypedSopNode } from "./_Base"; import { TransformResetSopOperation, TRANSFORM_RESET_MODES } from "../../operations/sop/TransformReset"; import { ParamConfig, NodeParamsConfig } from "../utils/params/ParamsConfig"; import { SopType } from "../../poly/registers/nodes/types/Sop"; const DEFAULT = TransformResetSopOperation.DEFAULT_PARAMS; class TransformResetSopParamConfig extends NodeParamsConfig { constructor() { super(...arguments); /** @param mode to reset the geometry and object */ this.mode = ParamConfig.INTEGER(DEFAULT.mode, { menu: { entries: TRANSFORM_RESET_MODES.map((target_type, i) => { return { name: target_type, value: i }; }) } }); } } const ParamsConfig = new TransformResetSopParamConfig(); export class TransformResetSopNode extends TypedSopNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; } static type() { return SopType.TRANSFORM_RESET; } initializeNode() { this.io.inputs.setCount(1, 2); this.io.inputs.initInputsClonedState(TransformResetSopOperation.INPUT_CLONED_STATE); } setMode(mode) { this.p.mode.set(TRANSFORM_RESET_MODES.indexOf(mode)); } cook(inputCoreGroups) { this._operation = this._operation || new TransformResetSopOperation(this.scene(), this.states, this); const coreGroup = this._operation.cook(inputCoreGroups, this.pv); this.setCoreGroup(coreGroup); } }