Line data Source code
1 : import { syncConcatOrderWithLinks } from '@/composables/videoConcat/syncConcatOrderWithLinks'
2 : import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
3 : import type {
4 : IVideoConcatWidget,
5 : IWidgetVideoConcatOptions
6 : } from '@comfyorg/graph-model/widgets'
7 : import { isVideoConcatInputSpec } from '@comfyorg/object-info-parser/schemas/nodeDefSchemaV2'
8 : import type { InputSpec as InputSpecV2 } from '@comfyorg/object-info-parser/schemas/nodeDefSchemaV2'
9 : import type { ComfyWidgetConstructorV2 } from '@/types/widgetConstructor'
10 :
11 2356 : export const useVideoConcatWidget = (): ComfyWidgetConstructorV2 => {
12 2356 : return (node: LGraphNode, inputSpec: InputSpecV2): IVideoConcatWidget => {
13 0 : const spec = isVideoConcatInputSpec(inputSpec) ? inputSpec : undefined
14 0 : const options: IWidgetVideoConcatOptions = {
15 : source: spec?.source ?? '',
16 : serialize: true,
17 : hideInPanel: true
18 : }
19 :
20 : const rawWidget = node.addWidget(
21 : 'videoconcat',
22 : inputSpec.name,
23 : { order: [...(spec?.default?.order ?? [])] },
24 : () => {},
25 : options
26 : )
27 :
28 0 : const widget = rawWidget as IVideoConcatWidget
29 0 : syncConcatOrderWithLinks(node, widget, options.source)
30 0 : return widget
31 : }
32 : }
|