Fix onExecute

This commit is contained in:
space-nuko
2023-05-04 12:00:02 -05:00
parent 2252b65680
commit 705633d125
3 changed files with 23 additions and 2 deletions

View File

@@ -254,7 +254,7 @@
border-width: 2px; border-width: 2px;
border-style: dashed !important; border-style: dashed !important;
margin: 0.2em; margin: 0.2em;
padding: 0.2em; padding: 1.4em;
} }
.widget-edit-outline { .widget-edit-outline {

View File

@@ -67,7 +67,10 @@ export abstract class ComfyWidgetNode<T = any> extends ComfyGraphNode {
override onExecute() { override onExecute() {
// Assumption: we will have one output in the inherited class with the // Assumption: we will have one output in the inherited class with the
// correct type // 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 // TODO send event to linked nodes
} }
@@ -95,6 +98,8 @@ export abstract class ComfyWidgetNode<T = any> extends ComfyGraphNode {
} }
console.debug("Property copy", input, this.properties) console.debug("Property copy", input, this.properties)
this.setValue(get(this.value))
} }
return true; return true;

View File

@@ -10,6 +10,8 @@
let propsChanged: Writable<boolean> | null = null; let propsChanged: Writable<boolean> | null = null;
let option: any let option: any
export let debug: boolean = false;
$: widget && setNodeValue(widget); $: widget && setNodeValue(widget);
$: if (nodeValue !== null && (!$propsChanged || $propsChanged)) { $: if (nodeValue !== null && (!$propsChanged || $propsChanged)) {
@@ -35,6 +37,15 @@
$: if (nodeValue && option && option.value) { $: if (nodeValue && option && option.value) {
$nodeValue = option.value; $nodeValue = option.value;
} }
function getLinkValue() {
if (!node)
return "???";
const links = node.getOutputLinks(0)
if (links.length === 0)
return "???";
return links[0].data
}
</script> </script>
<div class="wrapper gr-combo"> <div class="wrapper gr-combo">
@@ -51,6 +62,11 @@
on:filter on:filter
on:blur on:blur
/> />
{#if debug}
<div>Value: {option?.value}</div>
<div>NodeValue: {$nodeValue}</div>
<div>LinkValue: {getLinkValue()}</div>
{/if}
</label> </label>
{/if} {/if}
</div> </div>