ComfyUI-KJNodes/web/js/jsnodes.js
kijai ca73cb8e8e New nodes and bugfixing
Added GrowMaskWithBlur -node
fixing set/get functionality, still buggy especially when loading workflows, added .js alert for the errors to troubleshoot
2023-10-01 02:33:02 +03:00

33 lines
970 B
JavaScript

import { app } from "../../../scripts/app.js";
app.registerExtension({
name: "KJNodes.ConditioningMultiCombine",
async beforeRegisterNodeDef(nodeType, nodeData, app) {
switch (nodeData.name) {
case "ConditioningMultiCombine":
nodeType.prototype.onNodeMoved = function () {
console.log(this.pos[0])
}
nodeType.prototype.onNodeCreated = function () {
this.inputs_offset = nodeData.name.includes("selective")?1:0
this.cond_type = "CONDITIONING"
this.addWidget("button", "Add", null, () => {
if (!this.inputs) {
this.inputs = [];
}
if (this.inputs.length < 20) {
const newInputName = `conditioning_${this.inputs.length + 1}`;
this.addInput(newInputName, this.cond_type);
}
});
this.addWidget("button", "Remove", null, () => {
if (this.inputs.length > 2) {
const lastInputIndex = this.inputs.length - 1;
this.removeInput(lastInputIndex);
}
});
}
break;
}
},
});