mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2026-06-03 05:13:30 +08:00
Account for frontend counting all widgets as inputs now
This commit is contained in:
parent
58668a44cc
commit
d41ad755ef
@ -17,16 +17,17 @@ app.registerExtension({
|
|||||||
this.inputs = [];
|
this.inputs = [];
|
||||||
}
|
}
|
||||||
const target_number_of_inputs = this.widgets.find(w => w.name === "inputcount")["value"];
|
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
|
const num_inputs = this.inputs.filter(input => input.type !== "INT").length
|
||||||
|
if(target_number_of_inputs===num_inputs)return; // already set, do nothing
|
||||||
|
|
||||||
if(target_number_of_inputs < this.inputs.length){
|
if(target_number_of_inputs < num_inputs){
|
||||||
for(let i = this.inputs.length; i>=this.inputs_offset+target_number_of_inputs; i--)
|
for(let i = num_inputs; i>=this.inputs_offset+target_number_of_inputs; i--)
|
||||||
this.removeInput(i)
|
this.removeInput(i)
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
for(let i = this.inputs.length+1-this.inputs_offset; i <= target_number_of_inputs; ++i)
|
for(let i = num_inputs+1-this.inputs_offset; i <= target_number_of_inputs; ++i)
|
||||||
this.addInput(`conditioning_${i}`, this.cond_type)
|
this.addInput(`conditioning_${i}`, this.cond_type)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -43,16 +44,17 @@ app.registerExtension({
|
|||||||
this.inputs = [];
|
this.inputs = [];
|
||||||
}
|
}
|
||||||
const target_number_of_inputs = this.widgets.find(w => w.name === "inputcount")["value"];
|
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
|
const num_inputs = this.inputs.filter(input => input.type !== "INT").length
|
||||||
|
if(target_number_of_inputs===num_inputs)return; // already set, do nothing
|
||||||
|
|
||||||
if(target_number_of_inputs < this.inputs.length){
|
if(target_number_of_inputs < num_inputs){
|
||||||
for(let i = this.inputs.length; i>=this.inputs_offset+target_number_of_inputs; i--)
|
for(let i = num_inputs; i>=this.inputs_offset+target_number_of_inputs; i--)
|
||||||
this.removeInput(i)
|
this.removeInput(i)
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
for(let i = this.inputs.length+1-this.inputs_offset; i <= target_number_of_inputs; ++i)
|
for(let i = num_inputs+1-this.inputs_offset; i <= target_number_of_inputs; ++i)
|
||||||
this.addInput(`image_${i}`, this._type)
|
this.addInput(`image_${i}`, this._type)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -65,17 +67,18 @@ app.registerExtension({
|
|||||||
this.inputs = [];
|
this.inputs = [];
|
||||||
}
|
}
|
||||||
const target_number_of_inputs = this.widgets.find(w => w.name === "inputcount")["value"];
|
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
|
const num_inputs = this.inputs.filter(input => input.type !== "INT").length
|
||||||
|
if(target_number_of_inputs===num_inputs)return; // already set, do nothing
|
||||||
|
|
||||||
if(target_number_of_inputs < this.inputs.length){
|
if(target_number_of_inputs < num_inputs){
|
||||||
for(let i = this.inputs.length; i>=this.inputs_offset+target_number_of_inputs; i--)
|
for(let i = num_inputs; i>=this.inputs_offset+target_number_of_inputs; i--)
|
||||||
this.removeInput(i)
|
this.removeInput(i)
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
for(let i = num_inputs+1-this.inputs_offset; i <= target_number_of_inputs; ++i)
|
||||||
|
this.addInput(`mask_${i}`, this._type)
|
||||||
}
|
}
|
||||||
else{
|
});
|
||||||
for(let i = this.inputs.length+1-this.inputs_offset; i <= target_number_of_inputs; ++i)
|
|
||||||
this.addInput(`mask_${i}`, this._type)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -228,13 +231,14 @@ app.registerExtension({
|
|||||||
this.inputs = [];
|
this.inputs = [];
|
||||||
}
|
}
|
||||||
const target_number_of_inputs = this.widgets.find(w => w.name === "inputcount")["value"];
|
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
|
const num_inputs = this.inputs.filter(input => input.type !== "INT").length
|
||||||
|
if (target_number_of_inputs === num_inputs) return; // already set, do nothing
|
||||||
|
|
||||||
if (target_number_of_inputs < this.inputs.length) {
|
if (target_number_of_inputs < num_inputs) {
|
||||||
for (let i = this.inputs.length; i >= this.inputs_offset + target_number_of_inputs; i--)
|
for (let i = num_inputs; i >= this.inputs_offset + target_number_of_inputs; i--)
|
||||||
this.removeInput(i);
|
this.removeInput(i);
|
||||||
} else {
|
} else {
|
||||||
for (let i = this.inputs.length + 1 - this.inputs_offset; i <= target_number_of_inputs; ++i)
|
for (let i = num_inputs + 1 - this.inputs_offset; i <= target_number_of_inputs; ++i)
|
||||||
this.addInput(`string_${i}`, this._type);
|
this.addInput(`string_${i}`, this._type);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user