mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2026-03-31 03:46:59 +08:00
fix JoinStringMulti
This commit is contained in:
parent
58f234d544
commit
48cf28c7d0
@ -151,27 +151,29 @@ app.registerExtension({
|
||||
break;
|
||||
|
||||
case "JoinStringMulti":
|
||||
const originalOnNodeCreated = nodeType.prototype.onNodeCreated || function() {};
|
||||
nodeType.prototype.onNodeCreated = function () {
|
||||
this._type = "STRING"
|
||||
this.inputs_offset = nodeData.name.includes("selective")?1:0
|
||||
this.addWidget("button", "Update inputs", null, () => {
|
||||
if (!this.inputs) {
|
||||
this.inputs = [];
|
||||
}
|
||||
const target_number_of_inputs = this.widgets.find(w => w.name === "inputcount")["value"];
|
||||
if(target_number_of_inputs===this.inputs.length)return; // already set, do nothing
|
||||
|
||||
if(target_number_of_inputs < this.inputs.length){
|
||||
for(let i = this.inputs.length; i>=this.inputs_offset+target_number_of_inputs; i--)
|
||||
this.removeInput(i)
|
||||
originalOnNodeCreated.apply(this, arguments);
|
||||
|
||||
this._type = "STRING";
|
||||
this.inputs_offset = nodeData.name.includes("selective") ? 1 : 0;
|
||||
this.addWidget("button", "Update inputs", null, () => {
|
||||
if (!this.inputs) {
|
||||
this.inputs = [];
|
||||
}
|
||||
else{
|
||||
for(let i = this.inputs.length+1-this.inputs_offset; i <= target_number_of_inputs; ++i)
|
||||
this.addInput(`string_${i}`, this._type)
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
const target_number_of_inputs = this.widgets.find(w => w.name === "inputcount")["value"];
|
||||
if (target_number_of_inputs === this.inputs.length) return; // already set, do nothing
|
||||
|
||||
if (target_number_of_inputs < this.inputs.length) {
|
||||
for (let i = this.inputs.length; i >= this.inputs_offset + target_number_of_inputs; i--)
|
||||
this.removeInput(i);
|
||||
} else {
|
||||
for (let i = this.inputs.length + 1 - this.inputs_offset; i <= target_number_of_inputs; ++i)
|
||||
this.addInput(`string_${i}`, this._type);
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "SoundReactive":
|
||||
nodeType.prototype.onNodeCreated = function () {
|
||||
let audioContext;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user