Return SubgraphNode widget values during execution (#1114)

This commit is contained in:
filtered
2025-07-11 19:45:20 +10:00
committed by GitHub
parent f90e7f1f3c
commit 6134452891

View File

@@ -19,9 +19,14 @@ export type ExecutionId = string
export type ExecutableLGraphNode = Omit<ExecutableNodeDTO, "graph" | "node" | "subgraphNode">
type ResolvedInput = {
/** DTO for the node that the link originates from. */
node: ExecutableLGraphNode
origin_id: NodeId
/** Full unique execution ID of the node that the link originates from. */
origin_id: ExecutionId
/** The slot index of the output on the node that the link originates from. */
origin_slot: number
/** Actual value (e.g. for widgets). */
value?: unknown
}
/**
@@ -139,7 +144,18 @@ export class ExecutableNodeDTO implements ExecutableLGraphNode {
// Nothing connected
const linkId = subgraphNodeInput.link
if (linkId == null) return
if (linkId == null) {
const widget = subgraphNode.getWidgetFromSlot(subgraphNodeInput)
if (!widget) return
// Special case: SubgraphNode widget.
return {
node: this,
origin_id: this.id,
origin_slot: slot,
value: widget.value,
}
}
const outerLink = subgraphNode.graph.getLink(linkId)
if (!outerLink) throw new InvalidLinkError(`No outer link found for slot [${link.origin_slot}] ${input.name}`)