Compare commits

...

5 Commits

Author SHA1 Message Date
Austin Mroz
3e6244f499 Revert flake snapshot 2026-03-13 13:48:00 -07:00
github-actions
c7725e6f32 [automated] Update test expectations 2026-03-13 16:56:16 +00:00
Austin Mroz
049597b715 Fix shape on disconnect 2026-03-12 13:14:30 -07:00
Austin Mroz
f0523e4cb1 Check all links subgraph input links for shape 2026-03-12 13:12:27 -07:00
Austin Mroz
dd465c4346 Display optional indicator on subgraphNode inputs 2026-03-12 13:12:24 -07:00
5 changed files with 39 additions and 17 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View File

@@ -73,6 +73,7 @@ export class ToInputFromIoNodeLink implements RenderLink {
if (inputNode && input)
this.node._disconnectNodeInput(inputNode, input, existingLink)
events.dispatch('input-moved', this)
fromSlot.events.dispatch('input-disconnected', { input: fromSlot })
} else {
// Creating a new link
events.dispatch('link-created', newLink)
@@ -146,9 +147,17 @@ export class ToInputFromIoNodeLink implements RenderLink {
}
disconnect(): boolean {
if (!this.existingLink) return false
const { input, inputNode } = this.existingLink.resolve(this.network)
const { input, inputNode, subgraphInput } = this.existingLink.resolve(
this.network
)
if (!inputNode || !input) return false
this.node._disconnectNodeInput(inputNode, input, this.existingLink)
if (subgraphInput)
subgraphInput.events.dispatch('input-disconnected', {
input: subgraphInput
})
return true
}
}

View File

@@ -8,8 +8,8 @@ import type { LGraphEventMap } from './LGraphEventMap'
export interface SubgraphInputEventMap extends LGraphEventMap {
'input-connected': {
input: INodeInputSlot
widget: IBaseWidget
node: LGraphNode
widget?: IBaseWidget
node?: LGraphNode
}
'input-disconnected': {

View File

@@ -95,6 +95,8 @@ export class SubgraphInput extends SubgraphSlot {
widget: inputWidget,
node
})
} else {
this.events.dispatch('input-connected', { input: slot })
}
const link = new LLink(

View File

@@ -496,8 +496,9 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph {
subgraphInput.events.addEventListener(
'input-connected',
(e) => {
input.shape = this.getSlotShape(subgraphInput, e.detail.input)
const widget = subgraphInput._widget
if (!widget) return
if (!widget || !e.detail.node) return
// If this widget is already promoted, demote it first
// so it transitions cleanly to being linked via SubgraphInput.
@@ -519,6 +520,8 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph {
}
const widgetLocator = e.detail.input.widget
if (!widgetLocator) return
this._setWidget(
subgraphInput,
input,
@@ -534,6 +537,7 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph {
subgraphInput.events.addEventListener(
'input-disconnected',
() => {
input.shape = this.getSlotShape(subgraphInput)
// If the input is connected to more than one widget, don't remove the widget
const connectedWidgets = subgraphInput.getConnectedWidgets()
if (connectedWidgets.length > 0) return
@@ -561,19 +565,19 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph {
this.inputs.length = 0
this.inputs.push(
...this.subgraph.inputNode.slots.map(
(slot) =>
new NodeInputSlot(
{
name: slot.name,
localized_name: slot.localized_name,
label: slot.label,
type: slot.type,
link: null
},
this
)
)
...this.subgraph.inputNode.slots.map((slot) => {
return new NodeInputSlot(
{
name: slot.name,
localized_name: slot.localized_name,
label: slot.label,
shape: this.getSlotShape(slot),
type: slot.type,
link: null
},
this
)
})
)
this.outputs.length = 0
@@ -1086,4 +1090,11 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph {
return clone
}
getSlotShape(slot: SubgraphInput, extraInput?: INodeInputSlot) {
const shapes = slot.linkIds.map(
(id) => this.subgraph.links[id]?.resolve(this.subgraph)?.input?.shape
)
if (extraInput) shapes.push(extraInput.shape)
return shapes.every((shape) => shape === shapes[0]) ? shapes[0] : undefined
}
}