Line data Source code
1 : import { intersection } from 'es-toolkit/compat'
2 :
3 : import { useChainCallback } from '@/composables/functional/useChainCallback'
4 : import { createWidgetRestorationState } from '@/lib/litegraph/src/LGraphNode'
5 : import { LGraphNode, LiteGraph } from '@/lib/litegraph/src/litegraph'
6 : import type {
7 : INodeInputSlot,
8 : INodeOutputSlot,
9 : ISerialisedNode,
10 : ISlotType,
11 : LLink
12 : } from '@/lib/litegraph/src/litegraph'
13 : import { NodeSlot } from '@/lib/litegraph/src/node/NodeSlot'
14 : import { outputHasLinks, outputLinks } from '@/lib/litegraph/src/node/slotLinks'
15 : import type { IBaseWidget, IWidgetLocator } from '@comfyorg/graph-model/widgets'
16 : import { assetService } from '@/platform/assets/services/assetService'
17 : import { createAssetWidget } from '@/platform/assets/utils/createAssetWidget'
18 : import {
19 : getComboSpecComboOptions,
20 : isComboInputSpec
21 : } from '@comfyorg/object-info-parser'
22 : import type { ComfyNodeDef, InputSpec } from '@comfyorg/object-info-parser'
23 : import { app } from '@/scripts/app'
24 : import { useWidgetValueStore } from '@/stores/widgetValueStore'
25 : import type { WidgetValue } from '@/types/simplifiedWidget'
26 : import { addValueControlWidgets } from '@/core/graph/widgets/valueControlWidgets'
27 : import { ComfyWidgets, isValidWidgetType } from '@/scripts/widgets'
28 : import { CONFIG, GET_CONFIG } from '@comfyorg/graph-model/widgets'
29 : import { mergeInputSpec } from '@/utils/nodeDefUtil'
30 : import { applyTextReplacements } from '@/utils/searchAndReplace'
31 :
32 : import { applyFirstWidgetValueToGraph } from './widgetValuePropagation'
33 : import type { ComfyExtension } from '@/types/comfy'
34 :
35 2355 : const replacePropertyName = 'Run widget replace on values'
36 2355 : const isPrimitiveNode = (
37 : node: LGraphNode
38 : ): node is PrimitiveNode & LGraphNode => node.type === 'PrimitiveNode'
39 :
40 2355 : export class PrimitiveNode extends LGraphNode {
41 : controlValues?: WidgetValue[]
42 : lastType?: string
43 : static override category: string
44 : constructor(title: string) {
45 60 : super(title)
46 60 : this.addOutput('connect to widget input', '*')
47 60 : this.serialize_widgets = true
48 60 : this.isVirtualNode = true
49 :
50 60 : if (!(replacePropertyName in this.properties)) {
51 60 : this.addProperty(replacePropertyName, false, 'boolean')
52 : }
53 : }
54 :
55 : override applyToGraph(extraLinks: LLink[] = []) {
56 13 : const sourceWidget = this.widgets?.[0]
57 13 : const graph = this.graph
58 13 : if (!sourceWidget || !graph) return
59 :
60 13 : let v = sourceWidget.value
61 13 : if (v && this.properties[replacePropertyName]) {
62 0 : v = applyTextReplacements(graph, v as string)
63 : }
64 13 : applyFirstWidgetValueToGraph(this, extraLinks, () => v)
65 : }
66 :
67 : override refreshComboInNode(defs?: Record<string, ComfyNodeDef>): void {
68 1 : const widget = this.widgets?.[0]
69 1 : if (widget?.type !== 'combo') return
70 :
71 1 : const newValues = this._resolveComboValues(defs)
72 1 : if (newValues === undefined) return
73 :
74 1 : widget.options.values = newValues
75 :
76 1 : const value = widget.value
77 1 : if (
78 : (typeof value !== 'string' && typeof value !== 'number') ||
79 : !newValues.includes(value)
80 : ) {
81 0 : widget.value = newValues[0]
82 0 : widget.callback?.(widget.value)
83 : }
84 : }
85 :
86 : private _resolveComboValues(
87 : defs?: Partial<Record<string, ComfyNodeDef>>
88 : ): (string | number)[] | undefined {
89 1 : const fromDefs = defs ? this._comboValuesFromDefs(defs) : undefined
90 1 : if (fromDefs !== undefined) return fromDefs
91 :
92 : const slotWidget = this.outputs[0].widget
93 1 : const config = slotWidget?.[GET_CONFIG]?.()
94 1 : if (!config || !isComboInputSpec(config)) return undefined
95 :
96 0 : return getComboSpecComboOptions(config)
97 : }
98 :
99 : private _comboValuesFromDefs(
100 : defs: Partial<Record<string, ComfyNodeDef>>
101 : ): (string | number)[] | undefined {
102 1 : const graph = this.graph
103 1 : const links = graph ? outputLinks(graph, this.id, 0) : []
104 1 : if (!graph || !links.length) return undefined
105 :
106 1 : let values: (string | number)[] | undefined
107 1 : for (const link of links) {
108 1 : const targetNode = graph.getNodeById(link.target_id)
109 1 : const targetType = targetNode?.type
110 1 : const targetInput = targetNode?.inputs.at(link.target_slot)
111 1 : const inputName = targetInput?.widget?.name ?? targetInput?.name
112 1 : if (!targetType || !inputName) return undefined
113 :
114 1 : const def = defs[targetType]
115 1 : const inputSpec =
116 : def?.input?.required?.[inputName] ?? def?.input?.optional?.[inputName]
117 1 : if (!inputSpec || !isComboInputSpec(inputSpec)) return undefined
118 :
119 1 : const options = getComboSpecComboOptions(inputSpec)
120 1 : values = values === undefined ? options : intersection(values, options)
121 : }
122 :
123 1 : return values
124 : }
125 :
126 : override configure(serialisedNode: ISerialisedNode) {
127 57 : const type = serialisedNode.outputs?.[0]?.type
128 57 : super.configure(serialisedNode)
129 57 : if (
130 : !this.graph ||
131 : this.widgets?.length ||
132 : typeof type !== 'string' ||
133 : !outputHasLinks(this.graph, this.id, 0)
134 : )
135 7 : return
136 :
137 50 : useWidgetValueStore().setNodeWidgetRestoration(
138 : this.graph.rootGraph.id,
139 : this.id,
140 : createWidgetRestorationState(serialisedNode)
141 : )
142 : }
143 :
144 : override onAfterGraphConfigured() {
145 53 : if (
146 : this.graph &&
147 : outputHasLinks(this.graph, this.id, 0) &&
148 : !this.widgets?.length
149 : ) {
150 41 : this._onFirstConnection()
151 :
152 : // Merge values if required
153 41 : this._mergeWidgetConfig()
154 : }
155 : }
156 :
157 : private _clearWidgetRestoration() {
158 67 : if (this.graph)
159 67 : useWidgetValueStore().clearNodeWidgetRestoration(
160 : this.graph.rootGraph.id,
161 : this.id
162 : )
163 : }
164 :
165 : override onConnectionsChange(
166 : _type: ISlotType,
167 : _index: number,
168 : connected: boolean
169 : ) {
170 72 : if (app.configuringGraph) {
171 : // Dont run while the graph is still setting up
172 59 : return
173 : }
174 :
175 72 : const hasLinks = this.graph ? outputHasLinks(this.graph, this.id, 0) : false
176 72 : if (connected) {
177 4 : if (hasLinks && !this.widgets?.length) {
178 4 : this._onFirstConnection()
179 : }
180 : } else {
181 : // We may have removed a link that caused the constraints to change
182 9 : this._mergeWidgetConfig()
183 :
184 9 : if (!hasLinks) {
185 9 : this.onLastDisconnect()
186 : }
187 : }
188 : }
189 :
190 : override onConnectOutput(
191 : slot: number,
192 : _type: string,
193 : input: INodeInputSlot,
194 : target_node: LGraphNode,
195 : target_slot: number
196 : ) {
197 : // Fires before the link is made allowing us to reject it if it isn't valid
198 : // No widget, we can't connect
199 4 : if (
200 : !input.widget &&
201 : (typeof input.type !== 'string' || !(input.type in ComfyWidgets))
202 : ) {
203 0 : return false
204 : }
205 :
206 4 : if (this.graph && outputHasLinks(this.graph, this.id, slot)) {
207 0 : const valid = this._isValidConnection(input)
208 0 : if (valid) {
209 : // On connect of additional outputs, copy our value to their widget
210 0 : this.applyToGraph([{ target_id: target_node.id, target_slot } as LLink])
211 : }
212 0 : return valid
213 : }
214 :
215 4 : return true
216 : }
217 :
218 : private _onFirstConnection(recreating = false) {
219 : // First connection can fire before the graph is ready on initial load so random things can be missing
220 52 : if (!this.graph) {
221 0 : this.onLastDisconnect()
222 0 : return
223 : }
224 52 : const link = outputLinks(this.graph, this.id, 0).at(0)
225 52 : if (!link) {
226 0 : if (outputHasLinks(this.graph, this.id, 0)) {
227 0 : console.warn(
228 : `PrimitiveNode ${this.id}: link store reports output 0 connected but no link resolves in the graph; resetting the widget.`
229 : )
230 : }
231 0 : this.onLastDisconnect()
232 0 : return
233 : }
234 :
235 52 : const theirNode = this.graph.getNodeById(link.target_id)
236 52 : if (!theirNode) return
237 :
238 52 : const input = theirNode.inputs.at(link.target_slot)
239 52 : if (!input) return
240 :
241 52 : let widget: IWidgetLocator
242 52 : if (!input.widget) {
243 0 : const inputType = input.type
244 0 : if (typeof inputType !== 'string' || !(inputType in ComfyWidgets)) return
245 0 : widget = { name: input.name, [GET_CONFIG]: () => [inputType, {}] } //fake widget
246 : } else {
247 52 : widget = input.widget
248 : }
249 :
250 52 : const config = widget[GET_CONFIG]?.()
251 52 : if (!config) return
252 :
253 49 : const { type } = getWidgetType(config)
254 52 : if (recreating || this.outputs[0].type !== type)
255 9 : this._clearWidgetRestoration()
256 : // Update our output to restrict to the widget type
257 49 : this.outputs[0].type = type
258 49 : this.outputs[0].name = type
259 49 : this.outputs[0].widget = widget
260 :
261 52 : this._createWidget(
262 : widget[CONFIG] ?? config,
263 : theirNode,
264 : widget.name,
265 : recreating
266 : )
267 : }
268 :
269 : private _createWidget(
270 : inputData: InputSpec,
271 : node: LGraphNode,
272 : widgetName: string,
273 : recreating: boolean
274 : ) {
275 49 : let type = inputData[0]
276 :
277 49 : if (type instanceof Array) {
278 13 : type = 'COMBO'
279 : }
280 :
281 49 : const [oldWidth, oldHeight] = this.size
282 49 : let widget: IBaseWidget
283 :
284 49 : try {
285 49 : if (
286 : type === 'COMBO' &&
287 : assetService.shouldUseWidgetAssetPicker(node.comfyClass, widgetName)
288 : ) {
289 0 : widget = this._createAssetWidget(node, widgetName, inputData)
290 0 : const theirWidget = node.widgets?.find((w) => w.name === widgetName)
291 0 : if (theirWidget) widget.value = theirWidget.value
292 0 : this._restoreSavedValue(widget)
293 0 : this._finalizeWidget(widget, oldWidth, oldHeight, recreating)
294 0 : return
295 : }
296 :
297 49 : if (isValidWidgetType(type)) {
298 49 : widget = ComfyWidgets[type](this, 'value', inputData, app).widget
299 : } else {
300 0 : widget = this.addCustomWidget({
301 : type: type.toLowerCase(),
302 : name: 'value',
303 : value: null,
304 : callback: () => {},
305 : options: {},
306 : y: 0
307 : })
308 : }
309 :
310 49 : if (node.widgets) {
311 49 : const theirWidget = node.widgets.find((w) => w.name === widgetName)
312 49 : if (theirWidget) {
313 49 : widget.value = theirWidget.value
314 : }
315 : }
316 49 : this._restoreSavedValue(widget)
317 :
318 49 : if (
319 : !inputData[1]?.control_after_generate &&
320 : (widget.type === 'number' || widget.type === 'combo')
321 : ) {
322 40 : addValueControlWidgets(this, widget, 'fixed', undefined, inputData)
323 40 : if (this.widgets?.[1]) widget.linkedWidgets = [this.widgets[1]]
324 : }
325 :
326 49 : const controlValues = this.controlValues
327 49 : if (
328 : this.widgets &&
329 : this.lastType === this.widgets[0]?.type &&
330 : controlValues?.length === this.widgets.length - 1
331 : ) {
332 7 : for (let i = 0; i < controlValues.length; i++) {
333 7 : this.widgets[i + 1].value = controlValues[i]
334 : }
335 : }
336 :
337 49 : this._finalizeWidget(widget, oldWidth, oldHeight, recreating)
338 : } finally {
339 49 : this._clearWidgetRestoration()
340 : }
341 : }
342 :
343 : private _restoreSavedValue(widget: IBaseWidget) {
344 49 : if (!this.graph) return
345 49 : const restored = useWidgetValueStore().getRestoredWidgetValue(
346 : this.graph.rootGraph.id,
347 : this.id,
348 : widget,
349 : 0
350 : )
351 49 : if (restored) widget.value = restored.value
352 : }
353 :
354 : private _createAssetWidget(
355 : targetNode: LGraphNode,
356 : targetInputName: string,
357 : inputData: InputSpec
358 : ): IBaseWidget {
359 0 : const defaultValue = inputData[1]?.default as string | undefined
360 0 : return createAssetWidget({
361 : node: this,
362 : widgetName: 'value',
363 : nodeTypeForBrowser: targetNode.comfyClass ?? '',
364 : inputNameForBrowser: targetInputName,
365 : defaultValue
366 : })
367 : }
368 :
369 : private _finalizeWidget(
370 : widget: IBaseWidget,
371 : oldWidth: number,
372 : oldHeight: number,
373 : recreating: boolean
374 : ) {
375 49 : widget.callback = useChainCallback(widget.callback, () => {
376 13 : this.applyToGraph()
377 : })
378 :
379 49 : this.setSize([
380 : Math.max(this.size[0], oldWidth),
381 : Math.max(this.size[1], oldHeight)
382 : ])
383 :
384 49 : if (!recreating) {
385 42 : const sz = this.computeSize()
386 42 : this.size = [Math.max(this.size[0], sz[0]), Math.max(this.size[1], sz[1])]
387 :
388 42 : requestAnimationFrame(() => {
389 42 : this.onResize?.(this.size)
390 : })
391 : }
392 : }
393 :
394 : recreateWidget() {
395 7 : const values = this.widgets?.map((w) => w.value)
396 7 : this._removeWidgets()
397 7 : this._onFirstConnection(!!values?.length)
398 7 : if (values?.length && this.widgets) {
399 7 : for (let i = 0; i < this.widgets.length; i++)
400 14 : this.widgets[i].value = values[i]
401 : }
402 7 : return this.widgets?.[0]
403 : }
404 :
405 : private _mergeWidgetConfig() {
406 : // Merge widget configs if the node has multiple outputs
407 50 : const output = this.outputs[0]
408 50 : const links = this.graph ? outputLinks(this.graph, this.id, 0) : []
409 :
410 50 : const hasConfig = !!output.widget?.[CONFIG]
411 50 : if (hasConfig) {
412 0 : delete output.widget?.[CONFIG]
413 : }
414 :
415 50 : if (links.length < 2 && hasConfig) {
416 : // Copy the widget options from the source
417 0 : if (links.length) {
418 0 : this.recreateWidget()
419 : }
420 :
421 0 : return
422 : }
423 50 : const config1 = output.widget?.[GET_CONFIG]?.()
424 50 : if (!config1) return
425 : const isNumber = config1[0] === 'INT' || config1[0] === 'FLOAT'
426 50 : if (!isNumber || !this.graph) return
427 :
428 11 : for (const link of links) {
429 10 : const theirNode = this.graph.getNodeById(link.target_id)
430 10 : if (!theirNode) continue
431 10 : const theirInput = theirNode.inputs[link.target_slot]
432 :
433 : // Call is valid connection so it can merge the configs when validating
434 10 : this._isValidConnection(theirInput, hasConfig)
435 : }
436 : }
437 :
438 : private _isValidConnection(input: INodeInputSlot, forceUpdate?: boolean) {
439 : // Only allow connections where the configs match
440 10 : const output = this.outputs[0]
441 10 : const config2 = input.widget?.[GET_CONFIG]?.()
442 10 : if (!config2) return false
443 :
444 7 : return !!mergeIfValid(output, config2, forceUpdate, () =>
445 : this.recreateWidget()
446 : )
447 : }
448 :
449 : private _removeWidgets() {
450 16 : if (this.widgets) {
451 : // Allow widgets to cleanup
452 16 : for (const w of this.widgets) {
453 46 : if (w.onRemove) {
454 3 : w.onRemove()
455 : }
456 : }
457 :
458 : // Temporarily store the current values in case the node is being recreated
459 16 : this.controlValues = []
460 16 : this.lastType = this.widgets[0]?.type
461 16 : for (let i = 1; i < this.widgets.length; i++) {
462 30 : this.controlValues.push(this.widgets[i].value)
463 : }
464 16 : setTimeout(() => {
465 16 : delete this.lastType
466 16 : delete this.controlValues
467 : }, 15)
468 16 : this.widgets.length = 0
469 : }
470 : }
471 :
472 : onLastDisconnect() {
473 9 : this._clearWidgetRestoration()
474 : // We can't remove + re-add the output here as if you drag a link over the same link
475 : // it removes, then re-adds, causing it to break
476 9 : this.outputs[0].type = '*'
477 9 : this.outputs[0].name = 'connect to widget input'
478 9 : delete this.outputs[0].widget
479 :
480 9 : this._removeWidgets()
481 : }
482 : }
483 :
484 7 : export function getWidgetConfig(
485 : slot: Pick<INodeInputSlot | INodeOutputSlot, 'widget'>
486 : ): InputSpec {
487 7 : return slot.widget?.[CONFIG] ?? slot.widget?.[GET_CONFIG]?.() ?? ['*', {}]
488 : }
489 :
490 108 : function getConfig(this: LGraphNode, widgetName: string) {
491 108 : const { nodeData } = this.constructor
492 108 : return (
493 : nodeData?.input?.required?.[widgetName] ??
494 : nodeData?.input?.optional?.[widgetName]
495 : )
496 : }
497 :
498 : /**
499 : * Convert a widget to an input slot.
500 : * @deprecated Widget to socket conversion is no longer necessary, as they co-exist now.
501 : * @param node The node to convert the widget to an input slot for.
502 : * @param widget The widget to convert to an input slot.
503 : * @returns The input slot that was converted from the widget or undefined if the widget is not found.
504 : */
505 0 : export function convertToInput(
506 : node: LGraphNode,
507 : widget: IBaseWidget
508 : ): INodeInputSlot | undefined {
509 0 : console.warn(
510 : 'Please remove call to convertToInput. Widget to socket conversion is no longer necessary, as they co-exist now.'
511 : )
512 0 : return node.inputs.find((slot) => slot.widget?.name === widget.name)
513 : }
514 :
515 49 : function getWidgetType(config: InputSpec) {
516 : // Special handling for COMBO so we restrict links based on the entries
517 49 : let type = config[0]
518 49 : if (type instanceof Array) {
519 13 : type = 'COMBO'
520 : }
521 49 : return { type }
522 : }
523 :
524 6 : export function setWidgetConfig(slot: INodeInputSlot, config?: InputSpec) {
525 6 : if (!slot.widget) return
526 0 : if (config) {
527 0 : slot.widget[GET_CONFIG] = () => config
528 : } else {
529 0 : delete slot.widget
530 : }
531 :
532 0 : if (!(slot instanceof NodeSlot)) return
533 0 : const { node } = slot
534 0 : if (!node.graph) return
535 0 : const link = node.getInputLink(node.inputs.indexOf(slot))
536 0 : if (!link) return
537 0 : const originNode = node.graph.getNodeById(link.origin_id)
538 6 : if (!originNode || !isPrimitiveNode(originNode)) return
539 0 : if (config) {
540 0 : originNode.recreateWidget()
541 0 : } else if (!app.configuringGraph) {
542 0 : originNode.disconnectOutput(0)
543 0 : originNode.onLastDisconnect()
544 : }
545 : }
546 :
547 11 : export function mergeIfValid(
548 : output: Pick<INodeOutputSlot | INodeInputSlot, 'widget'>,
549 : config2: InputSpec,
550 : forceUpdate?: boolean,
551 : recreateWidget?: () => IBaseWidget | undefined | void,
552 : config1?: InputSpec
553 : ): { customConfig: InputSpec[1] } {
554 11 : if (!config1) {
555 7 : config1 = getWidgetConfig(output)
556 : }
557 :
558 11 : const customSpec = mergeInputSpec(config1, config2)
559 :
560 11 : if (customSpec || forceUpdate) {
561 11 : if (customSpec) {
562 11 : if (output.widget) output.widget[CONFIG] = customSpec
563 : }
564 :
565 11 : const widget = recreateWidget?.()
566 : // When deleting a node this can be null
567 11 : if (widget) {
568 7 : const { min, max } = widget.options
569 7 : if (typeof widget.value === 'number') {
570 7 : if (min != null && widget.value < min) widget.value = min
571 7 : if (max != null && widget.value > max) widget.value = max
572 : }
573 7 : widget.callback?.(widget.value)
574 : }
575 : }
576 :
577 11 : return { customConfig: customSpec?.[1] ?? {} }
578 : }
579 :
580 2355 : export const widgetInputsExtension: ComfyExtension = {
581 : name: 'Comfy.WidgetInputs',
582 : async beforeRegisterNodeDef(
583 : nodeType: typeof LGraphNode,
584 : _nodeData: ComfyNodeDef
585 : ) {
586 2439372 : nodeType.prototype.convertWidgetToInput = function (this: LGraphNode) {
587 0 : console.warn(
588 : 'Please remove call to convertWidgetToInput. Widget to socket conversion is no longer necessary, as they co-exist now.'
589 : )
590 0 : return false
591 : }
592 :
593 2439372 : nodeType.prototype.onGraphConfigured = useChainCallback(
594 : nodeType.prototype.onGraphConfigured,
595 : function (this: LGraphNode) {
596 21912 : this.widgets ??= []
597 :
598 21912 : for (const input of this.inputs) {
599 70465 : if (input.widget) {
600 42052 : const name = input.widget.name
601 42052 : if (!input.widget[GET_CONFIG]) {
602 41097 : input.widget[GET_CONFIG] = () => getConfig.call(this, name)
603 : }
604 :
605 : const w = this.widgets.find((w) => w.name === name)
606 42052 : if (!w) {
607 2 : this.removeInput(this.inputs.findIndex((i) => i === input))
608 : }
609 : }
610 : }
611 : }
612 : )
613 :
614 2439372 : nodeType.prototype.onConfigure = useChainCallback(
615 : nodeType.prototype.onConfigure,
616 : function (this: LGraphNode) {
617 22361 : if (!app.configuringGraph) {
618 : // On copy + paste of nodes, ensure that widget configs are set up
619 191 : for (const input of this.inputs) {
620 920 : if (input.widget && !input.widget[GET_CONFIG]) {
621 541 : const name = input.widget.name
622 541 : input.widget[GET_CONFIG] = () => getConfig.call(this, name)
623 : }
624 : }
625 : }
626 : }
627 : )
628 :
629 : // Double click a widget input to automatically attach a primitive
630 2439372 : const origOnInputDblClick = nodeType.prototype.onInputDblClick
631 2439372 : nodeType.prototype.onInputDblClick = function (
632 : this: LGraphNode,
633 : ...[slot, ...args]: Parameters<NonNullable<typeof origOnInputDblClick>>
634 : ) {
635 0 : const r = origOnInputDblClick?.apply(this, [slot, ...args])
636 :
637 0 : const input = this.inputs[slot]
638 0 : if (!input.widget) {
639 : // Not a widget input or already handled input
640 0 : if (typeof input.type !== 'string' || !(input.type in ComfyWidgets)) {
641 0 : return r //also Not a ComfyWidgets input or combo (do nothing)
642 : }
643 : }
644 :
645 : // Create a primitive node
646 0 : const node = LiteGraph.createNode('PrimitiveNode')
647 0 : const graph = app.canvas.graph
648 0 : if (!node || !graph) return r
649 :
650 0 : graph.add(node)
651 :
652 : // Calculate a position that won't directly overlap another node
653 0 : const pos: [number, number] = [
654 : this.pos[0] - node.size[0] - 30,
655 : this.pos[1]
656 : ]
657 0 : while (graph.getNodeOnPos(pos[0], pos[1], graph.nodes))
658 0 : pos[1] += LiteGraph.NODE_TITLE_HEIGHT
659 :
660 0 : node.pos = pos
661 0 : node.connect(0, this, slot)
662 0 : node.title = input.name
663 :
664 0 : return r
665 : }
666 : },
667 : registerCustomNodes() {
668 2355 : LiteGraph.registerNodeType(
669 : 'PrimitiveNode',
670 : Object.assign(PrimitiveNode, {
671 : title: 'Primitive'
672 : })
673 : )
674 2355 : PrimitiveNode.category = 'utilities/primitive'
675 : }
676 : }
|