mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-30 12:59:55 +00:00
Type LGraphNode.getInnerNodes (#2498)
This commit is contained in:
@@ -856,6 +856,7 @@ export class GroupNodeHandler {
|
||||
for (let i = 0; i < c.nodes.length; i++) {
|
||||
let id = innerNodes?.[i]?.id
|
||||
// Use existing IDs if they are set on the inner nodes
|
||||
// @ts-expect-error id can be string or number
|
||||
if (id == null || isNaN(id)) {
|
||||
id = undefined
|
||||
} else {
|
||||
|
||||
@@ -151,7 +151,6 @@ app.registerExtension({
|
||||
height
|
||||
)
|
||||
|
||||
// @ts-expect-error hacky override
|
||||
sceneWidget.serializeValue = async () => {
|
||||
node.properties['Camera Info'] = load3d.getCameraState()
|
||||
|
||||
@@ -314,7 +313,6 @@ app.registerExtension({
|
||||
height
|
||||
)
|
||||
|
||||
// @ts-expect-error hacky override
|
||||
sceneWidget.serializeValue = async () => {
|
||||
node.properties['Camera Info'] = load3d.getCameraState()
|
||||
|
||||
|
||||
@@ -101,10 +101,8 @@ app.registerExtension({
|
||||
capture
|
||||
)
|
||||
btn.disabled = true
|
||||
// @ts-expect-error hacky override
|
||||
btn.serializeValue = () => undefined
|
||||
|
||||
// @ts-expect-error hacky override
|
||||
camera.serializeValue = async () => {
|
||||
if (captureOnQueue.value) {
|
||||
capture()
|
||||
|
||||
@@ -1287,7 +1287,7 @@ export class ComfyApp {
|
||||
|
||||
// Store all widget values
|
||||
if (widgets) {
|
||||
for (const i in widgets) {
|
||||
for (let i = 0; i < widgets.length; i++) {
|
||||
const widget = widgets[i]
|
||||
if (!widget.options || widget.options.serialize !== false) {
|
||||
inputs[widget.name] = widget.serializeValue
|
||||
@@ -1298,7 +1298,7 @@ export class ComfyApp {
|
||||
}
|
||||
|
||||
// Store all node links
|
||||
for (let i in node.inputs) {
|
||||
for (let i = 0; i < node.inputs.length; i++) {
|
||||
let parent = node.getInputNode(i)
|
||||
if (parent) {
|
||||
let link = node.getInputLink(i)
|
||||
@@ -1318,14 +1318,18 @@ export class ComfyApp {
|
||||
} else if (link && parent.mode === LGraphEventMode.BYPASS) {
|
||||
let all_inputs = [link.origin_slot]
|
||||
if (parent.inputs) {
|
||||
// @ts-expect-error convert list of strings to list of numbers
|
||||
all_inputs = all_inputs.concat(Object.keys(parent.inputs))
|
||||
for (let parent_input in all_inputs) {
|
||||
// @ts-expect-error assign string to number
|
||||
parent_input = all_inputs[parent_input]
|
||||
if (
|
||||
parent.inputs[parent_input]?.type === node.inputs[i].type
|
||||
) {
|
||||
// @ts-expect-error convert string to number
|
||||
link = parent.getInputLink(parent_input)
|
||||
if (link) {
|
||||
// @ts-expect-error convert string to number
|
||||
parent = parent.getInputNode(parent_input)
|
||||
}
|
||||
found = true
|
||||
@@ -1347,6 +1351,7 @@ export class ComfyApp {
|
||||
if (link) {
|
||||
inputs[node.inputs[i].name] = [
|
||||
String(link.origin_id),
|
||||
// @ts-expect-error link.origin_slot is already number.
|
||||
parseInt(link.origin_slot)
|
||||
]
|
||||
}
|
||||
|
||||
4
src/types/litegraph-augmentation.d.ts
vendored
4
src/types/litegraph-augmentation.d.ts
vendored
@@ -16,6 +16,7 @@ declare module '@comfyorg/litegraph/dist/types/widgets' {
|
||||
interface IBaseWidget {
|
||||
onRemove?: () => void
|
||||
beforeQueued?: () => unknown
|
||||
serializeValue?: (node: LGraphNode, index: number) => Promise<unknown>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +44,7 @@ declare module '@comfyorg/litegraph' {
|
||||
onExecuted?(output: any): void
|
||||
onNodeCreated?(this: LGraphNode): void
|
||||
setInnerNodes?(nodes: LGraphNode[]): void
|
||||
// TODO: Requires several coercion changes to runtime code.
|
||||
getInnerNodes?() // : LGraphNode[]
|
||||
getInnerNodes?(): LGraphNode[]
|
||||
convertToNodes?(): LGraphNode[]
|
||||
recreate?(): Promise<LGraphNode>
|
||||
refreshComboInNode?(defs: Record<string, ComfyNodeDef>)
|
||||
|
||||
Reference in New Issue
Block a user