UNPKG

@polygonjs/polygonjs

Version:

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

49 lines (48 loc) 1.74 kB
"use strict"; import { TypedSopNode } from "./_Base"; import { AttribClassMenuEntries, ATTRIBUTE_CLASSES } from "../../../core/geometry/Constant"; import { InputCloneMode } from "../../poly/InputCloneMode"; import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig"; import { SopType } from "../../poly/registers/nodes/types/Sop"; import { AttribDeleteSopOperation } from "../../operations/sop/AttribDelete"; const DEFAULT = AttribDeleteSopOperation.DEFAULT_PARAMS; class AttribDeleteSopParamsConfig extends NodeParamsConfig { constructor() { super(...arguments); /** @param the group this applies to */ this.group = ParamConfig.STRING(DEFAULT.group); /** @param attribute class (geometry or object) */ this.class = ParamConfig.INTEGER(DEFAULT.class, { menu: { entries: AttribClassMenuEntries } }); /** @param attribute name to delete */ this.name = ParamConfig.STRING(DEFAULT.name); } } const ParamsConfig = new AttribDeleteSopParamsConfig(); export class AttribDeleteSopNode extends TypedSopNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; } static type() { return SopType.ATTRIB_DELETE; } initializeNode() { this.io.inputs.setCount(1); this.io.inputs.initInputsClonedState(InputCloneMode.FROM_NODE); } setAttribClass(attribClass) { this.p.class.set(ATTRIBUTE_CLASSES.indexOf(attribClass)); } attribClass() { return ATTRIBUTE_CLASSES[this.pv.class]; } cook(inputCoreGroups) { this._operation = this._operation || new AttribDeleteSopOperation(this._scene, this.states, this); const coreGroup = this._operation.cook(inputCoreGroups, this.pv); this.setCoreGroup(coreGroup); } }