mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 02:32:18 +00:00
Show dropped image in output node
- blobUrl is an optional paramtere in loadGraphData - sets the preview image on SaveImage and PreviewImage nodes - works for any dropped png or webp, also from the queue
This commit is contained in:
@@ -2277,7 +2277,8 @@ export class ComfyApp {
|
|||||||
clean: boolean = true,
|
clean: boolean = true,
|
||||||
restore_view: boolean = true,
|
restore_view: boolean = true,
|
||||||
workflow: string | null | ComfyWorkflow = null,
|
workflow: string | null | ComfyWorkflow = null,
|
||||||
{ showMissingNodesDialog = true, showMissingModelsDialog = true } = {}
|
{ showMissingNodesDialog = true, showMissingModelsDialog = true } = {},
|
||||||
|
droppedImageBlobUrl: string | undefined = undefined
|
||||||
) {
|
) {
|
||||||
if (clean !== false) {
|
if (clean !== false) {
|
||||||
this.clean()
|
this.clean()
|
||||||
@@ -2468,6 +2469,15 @@ export class ComfyApp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show dropped image on output nodes
|
||||||
|
if (
|
||||||
|
droppedImageBlobUrl &&
|
||||||
|
(node.type === 'SaveImage' || node.type === 'PreviewImage')
|
||||||
|
) {
|
||||||
|
// @ts-expect-error
|
||||||
|
this.nodePreviewImages[String(node.id)] = [droppedImageBlobUrl]
|
||||||
|
}
|
||||||
|
|
||||||
this.#invokeExtensions('loadedGraphNode', node)
|
this.#invokeExtensions('loadedGraphNode', node)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2759,7 +2769,9 @@ export class ComfyApp {
|
|||||||
JSON.parse(pngInfo.workflow),
|
JSON.parse(pngInfo.workflow),
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
fileName
|
fileName,
|
||||||
|
undefined,
|
||||||
|
URL.createObjectURL(file)
|
||||||
)
|
)
|
||||||
} else if (pngInfo?.prompt) {
|
} else if (pngInfo?.prompt) {
|
||||||
this.loadApiJson(JSON.parse(pngInfo.prompt), fileName)
|
this.loadApiJson(JSON.parse(pngInfo.prompt), fileName)
|
||||||
@@ -2777,7 +2789,14 @@ export class ComfyApp {
|
|||||||
const prompt = pngInfo?.prompt || pngInfo?.Prompt
|
const prompt = pngInfo?.prompt || pngInfo?.Prompt
|
||||||
|
|
||||||
if (workflow) {
|
if (workflow) {
|
||||||
this.loadGraphData(JSON.parse(workflow), true, true, fileName)
|
this.loadGraphData(
|
||||||
|
JSON.parse(workflow),
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
fileName,
|
||||||
|
undefined,
|
||||||
|
URL.createObjectURL(file)
|
||||||
|
)
|
||||||
} else if (prompt) {
|
} else if (prompt) {
|
||||||
this.loadApiJson(JSON.parse(prompt), fileName)
|
this.loadApiJson(JSON.parse(prompt), fileName)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user