From 705633d125e2ed83780640e238b8db623d4364e3 Mon Sep 17 00:00:00 2001 From: space-nuko <24979496+space-nuko@users.noreply.github.com> Date: Thu, 4 May 2023 12:00:02 -0500 Subject: [PATCH] Fix onExecute --- src/lib/components/BlockContainer.svelte | 2 +- src/lib/nodes/ComfyWidgetNodes.ts | 7 ++++++- src/lib/widgets/ComboWidget.svelte | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/lib/components/BlockContainer.svelte b/src/lib/components/BlockContainer.svelte index b96ba49..a6e999c 100644 --- a/src/lib/components/BlockContainer.svelte +++ b/src/lib/components/BlockContainer.svelte @@ -254,7 +254,7 @@ border-width: 2px; border-style: dashed !important; margin: 0.2em; - padding: 0.2em; + padding: 1.4em; } .widget-edit-outline { diff --git a/src/lib/nodes/ComfyWidgetNodes.ts b/src/lib/nodes/ComfyWidgetNodes.ts index b4f090f..e37dcba 100644 --- a/src/lib/nodes/ComfyWidgetNodes.ts +++ b/src/lib/nodes/ComfyWidgetNodes.ts @@ -67,7 +67,10 @@ export abstract class ComfyWidgetNode extends ComfyGraphNode { override onExecute() { // Assumption: we will have one output in the inherited class with the // correct type - this.setOutputData(0, this.properties.value) + this.setOutputData(0, get(this.value)) + + const outputLinks = this.getOutputLinks(0) + console.debug("[Widget] onExecute", this, outputLinks) // TODO send event to linked nodes } @@ -95,6 +98,8 @@ export abstract class ComfyWidgetNode extends ComfyGraphNode { } console.debug("Property copy", input, this.properties) + + this.setValue(get(this.value)) } return true; diff --git a/src/lib/widgets/ComboWidget.svelte b/src/lib/widgets/ComboWidget.svelte index 9bc7d94..da637dc 100644 --- a/src/lib/widgets/ComboWidget.svelte +++ b/src/lib/widgets/ComboWidget.svelte @@ -10,6 +10,8 @@ let propsChanged: Writable | null = null; let option: any + export let debug: boolean = false; + $: widget && setNodeValue(widget); $: if (nodeValue !== null && (!$propsChanged || $propsChanged)) { @@ -35,6 +37,15 @@ $: if (nodeValue && option && option.value) { $nodeValue = option.value; } + + function getLinkValue() { + if (!node) + return "???"; + const links = node.getOutputLinks(0) + if (links.length === 0) + return "???"; + return links[0].data + }
@@ -51,6 +62,11 @@ on:filter on:blur /> + {#if debug} +
Value: {option?.value}
+
NodeValue: {$nodeValue}
+
LinkValue: {getLinkValue()}
+ {/if} {/if}