polygonjs-engine
Version:
node-based webgl 3D engine https://polygonjs.com
45 lines (44 loc) • 1.61 kB
JavaScript
import {TypedSopNode} from "./_Base";
import {Css2DObjectSopOperation} from "../../../core/operations/sop/Css2DObject";
import {NodeParamsConfig, ParamConfig} from "../utils/params/ParamsConfig";
const DEFAULT = Css2DObjectSopOperation.DEFAULT_PARAMS;
class Css2DObjectSopParamsConfig extends NodeParamsConfig {
constructor() {
super(...arguments);
this.useIdAttrib = ParamConfig.BOOLEAN(DEFAULT.useIdAttrib);
this.id = ParamConfig.STRING(DEFAULT.id, {
visibleIf: {useIdAttrib: 0}
});
this.useClassAttrib = ParamConfig.BOOLEAN(DEFAULT.useClassAttrib);
this.className = ParamConfig.STRING(DEFAULT.className, {
visibleIf: {useClassAttrib: 0}
});
this.useHtmlAttrib = ParamConfig.BOOLEAN(DEFAULT.useHtmlAttrib);
this.html = ParamConfig.STRING(DEFAULT.html, {
visibleIf: {useHtmlAttrib: 0},
multiline: true
});
this.copyAttributes = ParamConfig.BOOLEAN(DEFAULT.copyAttributes);
this.attributesToCopy = ParamConfig.STRING(DEFAULT.attributesToCopy, {
visibleIf: {copyAttributes: true}
});
}
}
const ParamsConfig2 = new Css2DObjectSopParamsConfig();
export class Css2DObjectSopNode extends TypedSopNode {
constructor() {
super(...arguments);
this.params_config = ParamsConfig2;
}
static type() {
return "css2DObject";
}
initializeNode() {
this.io.inputs.setCount(0, 1);
}
cook(input_contents) {
this._operation = this._operation || new Css2DObjectSopOperation(this.scene(), this.states);
const core_group = this._operation.cook(input_contents, this.pv);
this.setCoreGroup(core_group);
}
}