Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type INodeOutputSlot widget hack on PrimitiveNode #2728

Merged
merged 1 commit into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/extensions/core/widgetInputs.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// @ts-strict-ignore
import { LGraphNode, LiteGraph } from '@comfyorg/litegraph'
import type {
IFoundSlot,
INodeInputSlot,
INodeOutputSlot,
IWidget,
LiteGraphCanvasEvent
} from '@comfyorg/litegraph'
import type { IFoundSlot } from '@comfyorg/litegraph'
import { INodeSlot } from '@comfyorg/litegraph'

import { useNodeDefStore } from '@/stores/nodeDefStore'
import { useSettingStore } from '@/stores/settingStore'
Expand Down Expand Up @@ -422,7 +422,7 @@ export class PrimitiveNode extends LGraphNode {
}
}

export function getWidgetConfig(slot: INodeSlot) {
export function getWidgetConfig(slot: INodeInputSlot | INodeOutputSlot) {
return slot.widget[CONFIG] ?? slot.widget[GET_CONFIG]?.() ?? ['*', {}]
}

Expand Down
8 changes: 8 additions & 0 deletions src/types/litegraph-augmentation.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ declare module '@comfyorg/litegraph' {
/** Callback for pasting multiple files into the node */
pasteFiles?(files: File[]): void
}
/**
* Only used by the Primitive node. Primitive node is using the widget property
* to store/access the widget config.
* We should remove this hacky solution once we have a proper solution.
*/
interface INodeOutputSlot {
widget?: IWidget
}
}

/**
Expand Down