Line data Source code
1 : import { normalizeLightsValue } from '@comfyorg/viewport3d/lightInfo/lightsValue'
2 : import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
3 : import type { IBaseWidget } from '@comfyorg/graph-model/widgets'
4 : import type { InputSpec as InputSpecV2 } from '@comfyorg/object-info-parser/schemas/nodeDefSchemaV2'
5 : import type { ComfyWidgetConstructorV2 } from '@/types/widgetConstructor'
6 :
7 2356 : export const useLightInfoWidget = (): ComfyWidgetConstructorV2 => {
8 2356 : return (node: LGraphNode, inputSpec: InputSpecV2): IBaseWidget => {
9 0 : return node.addWidget(
10 : 'lightinfo',
11 : inputSpec.name,
12 : normalizeLightsValue(inputSpec.default),
13 : null,
14 : { serialize: true, hideInPanel: true }
15 : )
16 : }
17 : }
|