Strip default value from gallery
This commit is contained in:
@@ -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
|
||||
},
|
||||
|
||||
@@ -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<ComfyBoxImageMetad
|
||||
this.selectedIndexWidget = this.addWidget("text", "Selected", String(get(this.selectedImage)))
|
||||
this.selectedIndexWidget.disabled = true;
|
||||
this.modeWidget = this.addWidget("combo", "Mode", this.properties.updateMode, null, { property: "updateMode", values: ["replace", "append"] })
|
||||
this.defaultValue = []
|
||||
}
|
||||
|
||||
override onPropertyChanged(property: any, value: any) {
|
||||
@@ -103,6 +104,12 @@ export default class ComfyGalleryNode extends ComfyWidgetNode<ComfyBoxImageMetad
|
||||
|
||||
private _newSelectedIndex: number | null = null;
|
||||
|
||||
override stripUserState(o: SerializedLGraphNode) {
|
||||
super.stripUserState(o);
|
||||
o.properties.defaultValue = [];
|
||||
(o as any).comfyValue = [];
|
||||
}
|
||||
|
||||
override parseValue(param: any): ComfyBoxImageMetadata[] {
|
||||
if (param == null)
|
||||
return []
|
||||
|
||||
@@ -355,6 +355,6 @@ export default abstract class ComfyWidgetNode<T = any> 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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user