From a47a0329684c3eff45bb90585404cdb5f76a2aaa Mon Sep 17 00:00:00 2001 From: space-nuko <24979496+space-nuko@users.noreply.github.com> Date: Thu, 25 May 2023 17:12:20 -0500 Subject: [PATCH] Strip default value from gallery --- public/workflows/defaultWorkflow.json | 120 +--------------------- src/lib/nodes/widgets/ComfyGalleryNode.ts | 9 +- src/lib/nodes/widgets/ComfyWidgetNode.ts | 2 +- 3 files changed, 13 insertions(+), 118 deletions(-) diff --git a/public/workflows/defaultWorkflow.json b/public/workflows/defaultWorkflow.json index 82cd3cb..8a59831 100644 --- a/public/workflows/defaultWorkflow.json +++ b/public/workflows/defaultWorkflow.json @@ -97,50 +97,7 @@ "title": "UI.Gallery", "properties": { "tags": [], - "defaultValue": [ - { - "isComfyBoxImageMetadata": true, - "comfyUIFile": { - "filename": "ComfyUI_06374_.png", - "subfolder": "", - "type": "output" - }, - "name": "File", - "tags": [], - "width": 512, - "height": 512 - }, - { - "isComfyBoxImageMetadata": true, - "comfyUIFile": { - "filename": "ComfyUI_06375_.png", - "subfolder": "", - "type": "output" - }, - "name": "File", - "tags": [] - }, - { - "isComfyBoxImageMetadata": true, - "comfyUIFile": { - "filename": "ComfyUI_06376_.png", - "subfolder": "", - "type": "output" - }, - "name": "File", - "tags": [] - }, - { - "isComfyBoxImageMetadata": true, - "comfyUIFile": { - "filename": "ComfyUI_06377_.png", - "subfolder": "", - "type": "output" - }, - "name": "File", - "tags": [] - } - ], + "defaultValue": [], "index": 0, "updateMode": "append", "autoSelectOnUpdate": true @@ -148,50 +105,7 @@ "widgets_values": [], "color": "#223", "bgColor": "#335", - "comfyValue": [ - { - "isComfyBoxImageMetadata": true, - "comfyUIFile": { - "filename": "ComfyUI_06374_.png", - "subfolder": "", - "type": "output" - }, - "name": "File", - "tags": [], - "width": 512, - "height": 512 - }, - { - "isComfyBoxImageMetadata": true, - "comfyUIFile": { - "filename": "ComfyUI_06375_.png", - "subfolder": "", - "type": "output" - }, - "name": "File", - "tags": [] - }, - { - "isComfyBoxImageMetadata": true, - "comfyUIFile": { - "filename": "ComfyUI_06376_.png", - "subfolder": "", - "type": "output" - }, - "name": "File", - "tags": [] - }, - { - "isComfyBoxImageMetadata": true, - "comfyUIFile": { - "filename": "ComfyUI_06377_.png", - "subfolder": "", - "type": "output" - }, - "name": "File", - "tags": [] - } - ], + "comfyValue": [], "shownOutputProperties": {}, "saveUserState": false }, @@ -2586,20 +2500,7 @@ "title": "UI.Gallery", "properties": { "tags": [], - "defaultValue": [ - { - "isComfyBoxImageMetadata": true, - "comfyUIFile": { - "filename": "ComfyUI_06378_.png", - "subfolder": "", - "type": "output" - }, - "name": "File", - "tags": [], - "width": 0, - "height": 0 - } - ], + "defaultValue": [], "index": 0, "updateMode": "append", "autoSelectOnUpdate": true @@ -2607,20 +2508,7 @@ "widgets_values": [], "color": "#223", "bgColor": "#335", - "comfyValue": [ - { - "isComfyBoxImageMetadata": true, - "comfyUIFile": { - "filename": "ComfyUI_06378_.png", - "subfolder": "", - "type": "output" - }, - "name": "File", - "tags": [], - "width": 0, - "height": 0 - } - ], + "comfyValue": [], "shownOutputProperties": {}, "saveUserState": false }, diff --git a/src/lib/nodes/widgets/ComfyGalleryNode.ts b/src/lib/nodes/widgets/ComfyGalleryNode.ts index 2d2e579..afbe8ff 100644 --- a/src/lib/nodes/widgets/ComfyGalleryNode.ts +++ b/src/lib/nodes/widgets/ComfyGalleryNode.ts @@ -1,5 +1,5 @@ import { parseWhateverIntoImageMetadata, type ComfyBoxImageMetadata, type ComfyUploadImageType } from "$lib/utils"; -import { BuiltInSlotType, LiteGraph, type IComboWidget, type ITextWidget, type PropertyLayout, type SlotLayout, type INumberWidget, clamp } from "@litegraph-ts/core"; +import { BuiltInSlotType, LiteGraph, type IComboWidget, type ITextWidget, type PropertyLayout, type SlotLayout, type INumberWidget, clamp, type SerializedLGraphNode } from "@litegraph-ts/core"; import { get, writable, type Writable } from "svelte/store"; import GalleryWidget from "$lib/widgets/GalleryWidget.svelte"; @@ -58,6 +58,7 @@ export default class ComfyGalleryNode extends ComfyWidgetNode extends ComfyGraphNode { override stripUserState(o: SerializedLGraphNode) { super.stripUserState(o); - (o as any).comfyValue = this.properties.defaultValue; + (o as any).comfyValue = LiteGraph.cloneObject(this.properties.defaultValue); } }