new list utility nodes (#13)

* add List-related nodes for Checkpoints / LoRAs / Samplers/ Schedulers
* wiki: reorg XY Plot 3rd tutorial and add example
* bump version
This commit is contained in:
Bug, Ltd.
2025-01-29 11:18:14 +01:00
committed by GitHub
parent 1c6034bbcb
commit 9dcf6660de
45 changed files with 1613 additions and 400 deletions
+20 -3
View File
@@ -1,5 +1,4 @@
import { LGraphNode, IWidget } from '@comfyorg/litegraph'
import type { ComfyApp } from '@comfyorg/comfyui-frontend-types'
import { InputSpec } from '~/.d.ts/comfyui-frontend-types_alt.js'
import {
@@ -8,6 +7,7 @@ import {
makeComboWidget,
} from '~/widgets/factories.js'
import { makeWidgetAsync } from '~/shared/utils.js'
import { log } from '~/shared/common.js'
/**
* Create an hidden widget. To be used in `getCustomWidgets(app)`
@@ -21,8 +21,8 @@ export function HIDDEN(
node: LGraphNode,
inputName: string,
inputData: InputSpec,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_app: ComfyApp | undefined,
// // eslint-disable-next-line @typescript-eslint/no-unused-vars
// _app: ComfyApp | undefined,
) {
// the value in inputData is only used when creating a new workdlow
// otherwise, the cached value will be used by Comfy
@@ -132,3 +132,20 @@ export function ERROR_DISPLAY(
)
return widget as ErrorDisplayWidget
}
export function SELECTION_LIST(
node: LGraphNode,
inputName: string,
inputData: InputSpec,
) {
inputData[1].value = { selected: [] } // wrap into dict to avoid issues on validation
if (!Array.isArray(inputData[1].all) || !inputData[1].all) {
log.error("SELECTION_LIST: 'all is invalid")
// overwrite `all`
inputData[1].all = []
}
const widget = HIDDEN(node, inputName, inputData)
widget.all = inputData[1].all
return widget
}