Could be more than one combo in a backend node

This commit is contained in:
space-nuko
2023-05-10 15:40:47 -05:00
parent 7aa17581d0
commit fa307dc202
2 changed files with 16 additions and 7 deletions

View File

@@ -792,8 +792,8 @@ export default class ComfyApp {
continue; continue;
const backendNode = (node as ComfyBackendNode) const backendNode = (node as ComfyBackendNode)
const inputIndex = range(backendNode.inputs.length) const found = range(backendNode.inputs.length)
.find(i => { .filter(i => {
const input = backendNode.inputs[i] const input = backendNode.inputs[i]
const inputNode = backendNode.getInputNode(i) const inputNode = backendNode.getInputNode(i)
@@ -802,16 +802,19 @@ export default class ComfyApp {
&& "widgetNodeType" in input && "widgetNodeType" in input
&& input.widgetNodeType === "ui/combo"; && 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 comboNode = backendNode.getInputNode(inputIndex) as nodes.ComfyComboNode
const inputSlot = backendNode.inputs[inputIndex] as IComfyInputSlot; const inputSlot = backendNode.inputs[inputIndex] as IComfyInputSlot;
const def = defs[backendNode.type]; const def = defs[backendNode.type];
const hasBackendConfig = def["input"]["required"][inputSlot.name] !== undefined const hasBackendConfig = def["input"]["required"][inputSlot.name] !== undefined
console.log("hasBackendConfig", node.title, inputSlot.name, hasBackendConfig)
if (hasBackendConfig) { if (hasBackendConfig) {
backendCombos.add(comboNode.id) backendCombos.add(comboNode.id)

View File

@@ -142,10 +142,12 @@
{#if $valuesForCombo == null} {#if $valuesForCombo == null}
<span>Loading...</span> <span>Loading...</span>
{:else} {:else}
<span>Count {$valuesForCombo.length}</span>
<label> <label>
{#if widget.attrs.title !== ""} {#if widget.attrs.title !== ""}
<BlockTitle show_label={true}>{widget.attrs.title}</BlockTitle> <BlockTitle show_label={true}>
{widget.attrs.title}
<span class="count-text">({$valuesForCombo.length})</span>
</BlockTitle>
{/if} {/if}
<Select <Select
value={$nodeValue} value={$nodeValue}
@@ -209,6 +211,10 @@
padding: 2px; padding: 2px;
width: 100%; width: 100%;
.count-text {
font-size: smaller;
}
:global(.selected-item) { :global(.selected-item) {
// no idea how to get the select box to shrink in the flexbox otherwise... // no idea how to get the select box to shrink in the flexbox otherwise...
position: absolute !important; position: absolute !important;