mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-02 22:37:32 +00:00
[Cleanup] Remove LGraphNode.isValidWidgetLink (#3549)
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user