From fa307dc2029214a4b204b0d655157f2797928ac4 Mon Sep 17 00:00:00 2001 From: space-nuko <24979496+space-nuko@users.noreply.github.com> Date: Wed, 10 May 2023 15:40:47 -0500 Subject: [PATCH] Could be more than one combo in a backend node --- src/lib/components/ComfyApp.ts | 13 ++++++++----- src/lib/widgets/ComboWidget.svelte | 10 ++++++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/lib/components/ComfyApp.ts b/src/lib/components/ComfyApp.ts index 1d0d519..0df9e6d 100644 --- a/src/lib/components/ComfyApp.ts +++ b/src/lib/components/ComfyApp.ts @@ -792,8 +792,8 @@ export default class ComfyApp { continue; const backendNode = (node as ComfyBackendNode) - const inputIndex = range(backendNode.inputs.length) - .find(i => { + const found = range(backendNode.inputs.length) + .filter(i => { const input = backendNode.inputs[i] const inputNode = backendNode.getInputNode(i) @@ -802,16 +802,19 @@ export default class ComfyApp { && "widgetNodeType" in input && input.widgetNodeType === "ui/combo"; - return isComfyComboNode(inputNode) && isComfyInput + const isComfyCombo = isComfyComboNode(inputNode) + + console.debug("[refreshComboInNodes] CHECK", backendNode.type, input.name, "isComfyCombo", isComfyCombo, "isComfyInput", isComfyInput) + + return isComfyCombo && isComfyInput }); - if (inputIndex != null) { + for (const inputIndex of found) { const comboNode = backendNode.getInputNode(inputIndex) as nodes.ComfyComboNode const inputSlot = backendNode.inputs[inputIndex] as IComfyInputSlot; const def = defs[backendNode.type]; const hasBackendConfig = def["input"]["required"][inputSlot.name] !== undefined - console.log("hasBackendConfig", node.title, inputSlot.name, hasBackendConfig) if (hasBackendConfig) { backendCombos.add(comboNode.id) diff --git a/src/lib/widgets/ComboWidget.svelte b/src/lib/widgets/ComboWidget.svelte index fd26fd8..e7640d1 100644 --- a/src/lib/widgets/ComboWidget.svelte +++ b/src/lib/widgets/ComboWidget.svelte @@ -142,10 +142,12 @@ {#if $valuesForCombo == null} Loading... {:else} - Count {$valuesForCombo.length}