From 2b024bb186d79f049f2587d002e4b63724ad9fbc Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Mon, 21 Apr 2025 15:48:55 -0400 Subject: [PATCH] [Cleanup] Remove LGraphNode.isValidWidgetLink (#3549) --- src/extensions/core/widgetInputs.ts | 42 ----------------------------- 1 file changed, 42 deletions(-) diff --git a/src/extensions/core/widgetInputs.ts b/src/extensions/core/widgetInputs.ts index 837fefa00..5d64f0aef 100644 --- a/src/extensions/core/widgetInputs.ts +++ b/src/extensions/core/widgetInputs.ts @@ -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.