mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2026-03-16 14:17:03 +08:00
Fix ConditioningMultiCombine
This commit is contained in:
parent
c3f0a55adf
commit
c3dc82108a
@ -10,23 +10,25 @@ app.registerExtension({
|
|||||||
switch (nodeData.name) {
|
switch (nodeData.name) {
|
||||||
case "ConditioningMultiCombine":
|
case "ConditioningMultiCombine":
|
||||||
nodeType.prototype.onNodeCreated = function () {
|
nodeType.prototype.onNodeCreated = function () {
|
||||||
this.cond_type = "CONDITIONING"
|
this._type = "CONDITIONING"
|
||||||
this.inputs_offset = nodeData.name.includes("selective")?1:0
|
this.inputs_offset = nodeData.name.includes("selective")?1:0
|
||||||
this.addWidget("button", "Update inputs", null, () => {
|
this.addWidget("button", "Update inputs", null, () => {
|
||||||
if (!this.inputs) {
|
if (!this.inputs) {
|
||||||
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"];
|
||||||
const num_inputs = this.inputs.filter(input => input.type === this.cond_type).length
|
const num_inputs = this.inputs.filter(input => input.type === this._type).length
|
||||||
if(target_number_of_inputs===num_inputs)return; // already set, do nothing
|
if(target_number_of_inputs===num_inputs)return; // already set, do nothing
|
||||||
|
|
||||||
if(target_number_of_inputs < num_inputs){
|
if(target_number_of_inputs < num_inputs){
|
||||||
for(let i = num_inputs; i>=this.inputs_offset+target_number_of_inputs; i--)
|
const inputs_to_remove = num_inputs - target_number_of_inputs;
|
||||||
this.removeInput(i)
|
for(let i = 0; i < inputs_to_remove; i++) {
|
||||||
|
this.removeInput(this.inputs.length - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
for(let i = num_inputs+1-this.inputs_offset; i <= target_number_of_inputs; ++i)
|
for(let i = num_inputs+1; i <= target_number_of_inputs; ++i)
|
||||||
this.addInput(`conditioning_${i}`, this.cond_type)
|
this.addInput(`conditioning_${i}`, this._type)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -43,9 +45,7 @@ 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"];
|
||||||
console.log("target_number_of_inputs", target_number_of_inputs)
|
|
||||||
const num_inputs = this.inputs.filter(input => input.type === this._type).length
|
const num_inputs = this.inputs.filter(input => input.type === this._type).length
|
||||||
console.log("num_inputs", num_inputs)
|
|
||||||
if(target_number_of_inputs===num_inputs)return; // already set, do nothing
|
if(target_number_of_inputs===num_inputs)return; // already set, do nothing
|
||||||
|
|
||||||
if(target_number_of_inputs < num_inputs){
|
if(target_number_of_inputs < num_inputs){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user