import {TypedSopNode} from "./_Base";
import {NodeParamsConfig, ParamConfig} from "../utils/params/ParamsConfig";
import {InputCloneMode as InputCloneMode2} from "../../poly/InputCloneMode";
class LayerSopParamsConfig extends NodeParamsConfig {
  constructor() {
    super(...arguments);
    this.layer = ParamConfig.INTEGER(0, {
      range: [0, 31],
      rangeLocked: [true, true]
    });
  }
}
const ParamsConfig2 = new LayerSopParamsConfig();
export class LayerSopNode extends TypedSopNode {
  constructor() {
    super(...arguments);
    this.params_config = ParamsConfig2;
  }
  static type() {
    return "layer";
  }
  static displayedInputNames() {
    return ["objects to change layers of"];
  }
  initializeNode() {
    this.io.inputs.setCount(1);
    this.io.inputs.initInputsClonedState(InputCloneMode2.FROM_NODE);
    this.scene().dispatchController.onAddListener(() => {
      this.params.onParamsCreated("params_label", () => {
        this.params.label.init([this.p.layer]);
      });
    });
  }
  cook(input_contents) {
    const core_group = input_contents[0];
    for (let object of core_group.objects()) {
      object.layers.set(this.pv.layer);
    }
    this.setCoreGroup(core_group);
  }
}
