mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-05 07:30:11 +00:00
[TMP] Support downstream output widget in serialisation (#735)
- Ref: https://github.com/Comfy-Org/litegraph.js/pull/732#issuecomment-2710796369
This commit is contained in:
@@ -38,23 +38,31 @@ export function shallowCloneCommonProps(slot: CommonIoSlotProps): CommonIoSlotPr
|
||||
}
|
||||
|
||||
export function inputAsSerialisable(slot: INodeInputSlot): ISerialisableNodeInput {
|
||||
const widgetInputProps = slot.widget
|
||||
const { link } = slot
|
||||
const widgetOrPos = slot.widget
|
||||
? { widget: { name: slot.widget.name } }
|
||||
: { pos: slot.pos }
|
||||
|
||||
return {
|
||||
...shallowCloneCommonProps(slot),
|
||||
...widgetInputProps,
|
||||
link: slot.link,
|
||||
...widgetOrPos,
|
||||
link,
|
||||
}
|
||||
}
|
||||
|
||||
export function outputAsSerialisable(slot: INodeOutputSlot): ISerialisableNodeOutput {
|
||||
export function outputAsSerialisable(slot: INodeOutputSlot & { widget?: IWidget }): ISerialisableNodeOutput {
|
||||
const { pos, slot_index, links, widget } = slot
|
||||
// Output widgets do not exist in Litegraph; this is a temporary downstream workaround.
|
||||
const outputWidget = widget
|
||||
? { widget: { name: widget.name } }
|
||||
: null
|
||||
|
||||
return {
|
||||
...shallowCloneCommonProps(slot),
|
||||
pos: slot.pos,
|
||||
slot_index: slot.slot_index,
|
||||
links: slot.links,
|
||||
...outputWidget,
|
||||
pos,
|
||||
slot_index,
|
||||
links,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,9 @@ export interface SerialisableGraph {
|
||||
export type ISerialisableNodeInput = Omit<INodeInputSlot, "_layoutElement" | "widget"> & {
|
||||
widget?: { name: string }
|
||||
}
|
||||
export type ISerialisableNodeOutput = Omit<INodeOutputSlot, "_layoutElement" | "_data">
|
||||
export type ISerialisableNodeOutput = Omit<INodeOutputSlot, "_layoutElement" | "_data"> & {
|
||||
widget?: { name: string }
|
||||
}
|
||||
|
||||
/** Serialised LGraphNode */
|
||||
export interface ISerialisedNode {
|
||||
|
||||
Reference in New Issue
Block a user