Compare commits

...

3 Commits

Author SHA1 Message Date
bezo97
76cf77b901 Use 'output_node_id' metadata from dropped file
- The file is displayed only on the node it was saved by.
- No longer restricted to specific supported node types
2024-10-13 17:35:04 +02:00
bezo97
6b2cbacc09 Merge remote-tracking branch 'origin/main' into feature/show_dropped_image_in_output_node 2024-10-13 15:43:01 +02:00
bezo97
186ff3a78e 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
2024-10-07 20:55:35 +02:00

View File

@@ -2226,7 +2226,9 @@ export class ComfyApp {
clean: boolean = true,
restore_view: boolean = true,
workflow: string | null | ComfyWorkflow = null,
{ showMissingNodesDialog = true, showMissingModelsDialog = true } = {}
{ showMissingNodesDialog = true, showMissingModelsDialog = true } = {},
droppedImageBlobUrl: string | undefined = undefined,
output_node_id = undefined
) {
if (clean !== false) {
this.clean()
@@ -2417,6 +2419,12 @@ export class ComfyApp {
}
}
// Show dropped image on its original output node
if (droppedImageBlobUrl && String(node.id) === output_node_id) {
// @ts-expect-error
this.nodePreviewImages[output_node_id] = [droppedImageBlobUrl]
}
this.#invokeExtensions('loadedGraphNode', node)
}
@@ -2708,7 +2716,10 @@ export class ComfyApp {
JSON.parse(pngInfo.workflow),
true,
true,
fileName
fileName,
undefined,
URL.createObjectURL(file),
pngInfo.output_node_id
)
} else if (pngInfo?.prompt) {
this.loadApiJson(JSON.parse(pngInfo.prompt), fileName)
@@ -2726,7 +2737,15 @@ export class ComfyApp {
const prompt = pngInfo?.prompt || pngInfo?.Prompt
if (workflow) {
this.loadGraphData(JSON.parse(workflow), true, true, fileName)
this.loadGraphData(
JSON.parse(workflow),
true,
true,
fileName,
undefined,
URL.createObjectURL(file),
pngInfo.output_node_id
)
} else if (prompt) {
this.loadApiJson(JSON.parse(prompt), fileName)
} else {