@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
32 lines (31 loc) • 1.16 kB
JavaScript
;
import { TypedSopNode } from "./_Base";
import { SetChildrenSopOperation } from "../../operations/sop/SetChildren";
import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig";
import { SopType } from "../../poly/registers/nodes/types/Sop";
const DEFAULT = SetChildrenSopOperation.DEFAULT_PARAMS;
class SetChildrenSopParamsConfig extends NodeParamsConfig {
constructor() {
super(...arguments);
this.clearExistingChildren = ParamConfig.BOOLEAN(DEFAULT.clearExistingChildren);
}
}
const ParamsConfig = new SetChildrenSopParamsConfig();
export class SetChildrenSopNode extends TypedSopNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig;
}
static type() {
return SopType.SET_CHILDREN;
}
initializeNode() {
this.io.inputs.setCount(2);
this.io.inputs.initInputsClonedState(SetChildrenSopOperation.INPUT_CLONED_STATE);
}
cook(inputCoreGroups) {
this._operation = this._operation || new SetChildrenSopOperation(this._scene, this.states, this);
const core_group = this._operation.cook(inputCoreGroups, this.pv);
this.setCoreGroup(core_group);
}
}