Fixes for combo node default value
This commit is contained in:
@@ -821,13 +821,15 @@ export default class ComfyApp {
|
||||
.flatMap(i => node.getInputSlotsConnectedTo(i))
|
||||
.find(inp => "config" in inp && Array.isArray((inp.config as any).values))
|
||||
|
||||
let defaultValue = null;
|
||||
if (foundInput != null) {
|
||||
const comfyInput = foundInput as IComfyInputSlot;
|
||||
console.warn("[refreshComboInNodes] found frontend config:", node.title, node.type, comfyInput.config.values)
|
||||
values = comfyInput.config.values;
|
||||
defaultValue = comfyInput.config.defaultValue;
|
||||
}
|
||||
|
||||
comboNode.formatValues(values);
|
||||
comboNode.formatValues(values, defaultValue);
|
||||
}
|
||||
|
||||
await tick();
|
||||
@@ -842,7 +844,7 @@ export default class ComfyApp {
|
||||
|
||||
comboNode.formatValues(rawValues as string[], true)
|
||||
if (!rawValues?.includes(get(comboNode.value))) {
|
||||
comboNode.setValue(rawValues[0])
|
||||
comboNode.setValue(rawValues[0], comfyInput.config.defaultValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export default class ComfyValueControl extends ComfyGraphNode {
|
||||
override properties: ComfyValueControlProperties = {
|
||||
tags: [],
|
||||
value: null,
|
||||
action: "fixed",
|
||||
action: "randomize",
|
||||
min: -INT_MAX,
|
||||
max: INT_MAX,
|
||||
step: 1,
|
||||
|
||||
@@ -55,7 +55,7 @@ export default class ComfyComboNode extends ComfyWidgetNode<string> {
|
||||
}
|
||||
}
|
||||
|
||||
formatValues(values: string[], lightUp: boolean = false) {
|
||||
formatValues(values: string[], defaultValue?: string, lightUp: boolean = false) {
|
||||
if (values == null)
|
||||
return;
|
||||
|
||||
@@ -65,7 +65,7 @@ export default class ComfyComboNode extends ComfyWidgetNode<string> {
|
||||
const oldValue = get(this.value)
|
||||
if (this.properties.values.indexOf(oldValue) === -1) {
|
||||
changed = true;
|
||||
this.value.set(this.properties.values[0])
|
||||
this.value.set(defaultValue || this.properties.values[0])
|
||||
}
|
||||
|
||||
if (lightUp && get(this.firstLoad) && changed)
|
||||
@@ -129,7 +129,7 @@ export default class ComfyComboNode extends ComfyWidgetNode<string> {
|
||||
thisProps.values = Array.from(otherProps.values);
|
||||
const value = get(this.value)
|
||||
if (thisProps.values.indexOf(value) === -1)
|
||||
this.setValue(thisProps.values[0])
|
||||
this.setValue(otherProps.defaultValue || thisProps.values[0])
|
||||
|
||||
console.warn("PASSED")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user