[Cleanup] Remove LGraphNode.isValidWidgetLink (#3549)

This commit is contained in:
Chenlei Hu
2025-04-21 15:48:55 -04:00
committed by GitHub
parent 6e5930c355
commit 2b024bb186

View File

@@ -18,16 +18,6 @@ import { mergeInputSpec } from '@/utils/nodeDefUtil'
import { applyTextReplacements } from '@/utils/searchAndReplace'
import { isPrimitiveNode } from '@/utils/typeGuardUtil'
const VALID_TYPES = [
'STRING',
'combo',
'number',
'toggle',
'BOOLEAN',
'text',
'string'
]
const replacePropertyName = 'Run widget replace on values'
export class PrimitiveNode extends LGraphNode {
controlValues?: any[]
@@ -352,31 +342,6 @@ export class PrimitiveNode extends LGraphNode {
}
}
isValidWidgetLink(
originSlot: number,
targetNode: LGraphNode,
targetWidget: IWidget
) {
const config2 = getConfig.call(targetNode, targetWidget.name) ?? [
targetWidget.type,
targetWidget.options || {}
]
if (!isConvertibleWidget(targetWidget, config2)) return false
const output = this.outputs[originSlot]
if (
!(
output.widget?.[CONFIG] ??
(output.widget?.[GET_CONFIG] as () => InputSpec)?.()
)
) {
// No widget defined for this primitive yet so allow it
return true
}
return !!mergeIfValid.call(this, output, config2)
}
#isValidConnection(input: INodeInputSlot, forceUpdate?: boolean) {
// Only allow connections where the configs match
const output = this.outputs?.[0]
@@ -445,13 +410,6 @@ function getConfig(this: LGraphNode, widgetName: string) {
)
}
function isConvertibleWidget(widget: IWidget, config: InputSpec): boolean {
return (
// @ts-expect-error InputSpec is not typed correctly
VALID_TYPES.includes(widget.type) || VALID_TYPES.includes(config[0])
)
}
/**
* Convert a widget to an input slot.
* @deprecated Widget to socket conversion is no longer necessary, as they co-exist now.