UNPKG

polygonjs-engine

Version:

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

58 lines (57 loc) 3.04 kB
import {TypedSopNode} from "./_Base"; import {ObjectPropertiesSopOperation} from "../../../core/operations/sop/ObjectProperties"; import {NodeParamsConfig, ParamConfig} from "../utils/params/ParamsConfig"; const DEFAULT = ObjectPropertiesSopOperation.DEFAULT_PARAMS; class ObjectPropertiesSopParamsConfig extends NodeParamsConfig { constructor() { super(...arguments); this.applyToChildren = ParamConfig.BOOLEAN(DEFAULT.applyToChildren); this.separatorApplyToChildren = ParamConfig.SEPARATOR(); this.tname = ParamConfig.BOOLEAN(DEFAULT.tname); this.name = ParamConfig.STRING(DEFAULT.name, {visibleIf: {tname: true}}); this.separatorName = ParamConfig.SEPARATOR(null, {visibleIf: {tname: true}}); this.trenderOrder = ParamConfig.BOOLEAN(DEFAULT.trenderOrder); this.renderOrder = ParamConfig.INTEGER(DEFAULT.renderOrder, { visibleIf: {trenderOrder: true}, range: [0, 10], rangeLocked: [false, false] }); this.separatorRenderOrder = ParamConfig.SEPARATOR(null, {visibleIf: {trenderOrder: true}}); this.tfrustumCulled = ParamConfig.BOOLEAN(DEFAULT.tfrustumCulled); this.frustumCulled = ParamConfig.BOOLEAN(DEFAULT.frustumCulled, {visibleIf: {tfrustumCulled: true}}); this.separatorFrustumCulled = ParamConfig.SEPARATOR(null, {visibleIf: {tfrustumCulled: true}}); this.tmatrixAutoUpdate = ParamConfig.BOOLEAN(DEFAULT.tmatrixAutoUpdate); this.matrixAutoUpdate = ParamConfig.BOOLEAN(DEFAULT.matrixAutoUpdate, {visibleIf: {tmatrixAutoUpdate: true}}); this.separatorMatrixAutoUpdate = ParamConfig.SEPARATOR(null, {visibleIf: {tmatrixAutoUpdate: true}}); this.tvisible = ParamConfig.BOOLEAN(DEFAULT.tvisible); this.visible = ParamConfig.BOOLEAN(DEFAULT.visible, {visibleIf: {tvisible: true}}); this.separatorVisible = ParamConfig.SEPARATOR(null, {visibleIf: {tvisible: true}}); this.tcastShadow = ParamConfig.BOOLEAN(DEFAULT.tcastShadow); this.castShadow = ParamConfig.BOOLEAN(DEFAULT.castShadow, {visibleIf: {tcastShadow: true}}); this.separatorCastShadow = ParamConfig.SEPARATOR(null, {visibleIf: {tcastShadow: true}}); this.treceiveShadow = ParamConfig.BOOLEAN(DEFAULT.treceiveShadow); this.receiveShadow = ParamConfig.BOOLEAN(DEFAULT.receiveShadow, {visibleIf: {treceiveShadow: true}}); } } const ParamsConfig2 = new ObjectPropertiesSopParamsConfig(); export class ObjectPropertiesSopNode extends TypedSopNode { constructor() { super(...arguments); this.params_config = ParamsConfig2; } static type() { return "objectProperties"; } static displayedInputNames() { return ["objects to change properties of"]; } initializeNode() { this.io.inputs.setCount(1); this.io.inputs.initInputsClonedState(ObjectPropertiesSopOperation.INPUT_CLONED_STATE); } async cook(input_contents) { this._operation = this._operation || new ObjectPropertiesSopOperation(this.scene(), this.states); const core_group = this._operation.cook(input_contents, this.pv); this.setCoreGroup(core_group); } }