Things for ControlNet
This commit is contained in:
Submodule litegraph updated: ed3ae7c477...5a13f7adab
@@ -90,7 +90,8 @@ export default class ComfyGraph extends LGraph {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (get(uiState).autoAddUI) {
|
if (get(uiState).autoAddUI) {
|
||||||
if (!("svelteComponentType" in node) && !options.addedByDeserialize) {
|
console.warn("ADD", node.type, options)
|
||||||
|
if (!("svelteComponentType" in node) && options.addedByDeserialize == null) {
|
||||||
console.debug("[ComfyGraph] AutoAdd UI")
|
console.debug("[ComfyGraph] AutoAdd UI")
|
||||||
const comfyNode = node as ComfyGraphNode;
|
const comfyNode = node as ComfyGraphNode;
|
||||||
const widgetNodesAdded = []
|
const widgetNodesAdded = []
|
||||||
|
|||||||
@@ -32,6 +32,9 @@
|
|||||||
$: if (container) {
|
$: if (container) {
|
||||||
children = $layoutState.allItems[container.id].children;
|
children = $layoutState.allItems[container.id].children;
|
||||||
attrsChanged = container.attrsChanged
|
attrsChanged = container.attrsChanged
|
||||||
|
if (container.isOpen == null) {
|
||||||
|
container.isOpen = container.attrs.openOnStartup
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
children = null;
|
children = null;
|
||||||
@@ -97,7 +100,7 @@
|
|||||||
</Block>
|
</Block>
|
||||||
{:else}
|
{:else}
|
||||||
<Block elem_classes={["gradio-accordion"]}>
|
<Block elem_classes={["gradio-accordion"]}>
|
||||||
<Accordion label={container.attrs.title} open={container.attrs.openOnStartup}>
|
<Accordion label={container.attrs.title} bind:open={container.isOpen}>
|
||||||
{#each children.filter(item => item.id !== SHADOW_PLACEHOLDER_ITEM_ID) as item(item.id)}
|
{#each children.filter(item => item.id !== SHADOW_PLACEHOLDER_ITEM_ID) as item(item.id)}
|
||||||
<WidgetContainer dragItem={item} zIndex={zIndex+1} {isMobile} />
|
<WidgetContainer dragItem={item} zIndex={zIndex+1} {isMobile} />
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
@@ -213,7 +213,8 @@ export class ComfyNotifyAction extends ComfyGraphNode {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const options: NotifyOptions = {
|
const options: NotifyOptions = {
|
||||||
type: this.properties.type
|
type: this.properties.type,
|
||||||
|
showOn: "all"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if this event was triggered from a backend node and has the
|
// Check if this event was triggered from a backend node and has the
|
||||||
@@ -546,3 +547,35 @@ LiteGraph.registerNodeType({
|
|||||||
desc: "Turns multiple groups of nodes on/off at once based on an array of rules [{ tag: string, enable: boolean }, ...]",
|
desc: "Turns multiple groups of nodes on/off at once based on an array of rules [{ tag: string, enable: boolean }, ...]",
|
||||||
type: "actions/set_node_mode_advanced"
|
type: "actions/set_node_mode_advanced"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
export class ComfyNoChangeEvent extends ComfyGraphNode {
|
||||||
|
static slotLayout: SlotLayout = {
|
||||||
|
inputs: [
|
||||||
|
{ name: "in", type: BuiltInSlotType.ACTION },
|
||||||
|
],
|
||||||
|
outputs: [
|
||||||
|
{ name: "out", type: BuiltInSlotType.EVENT },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
override onAction(action: any, param: any, options: { action_call?: string }) {
|
||||||
|
if (param && typeof param === "object" && "noChangedEvent" in param) {
|
||||||
|
param.noChangedEvent = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
param = {
|
||||||
|
value: param,
|
||||||
|
noChangedEvent: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.triggerSlot(0, param, null, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LiteGraph.registerNodeType({
|
||||||
|
class: ComfyNoChangeEvent,
|
||||||
|
title: "Comfy.NoChangeEvent",
|
||||||
|
desc: "Wraps an event's parameter such that passing it into a ComfyWidgetNode's 'store' action will not trigger its 'changed' event",
|
||||||
|
type: "events/no_change"
|
||||||
|
})
|
||||||
|
|||||||
@@ -827,6 +827,7 @@ export class ComfyImageUploadNode extends ComfyWidgetNode<Array<GradioFileData>>
|
|||||||
{ name: "filename", type: "string" }, // TODO support batches
|
{ name: "filename", type: "string" }, // TODO support batches
|
||||||
{ name: "width", type: "number" },
|
{ name: "width", type: "number" },
|
||||||
{ name: "height", type: "number" },
|
{ name: "height", type: "number" },
|
||||||
|
{ name: "image_count", type: "number" },
|
||||||
{ name: "changed", type: BuiltInSlotType.EVENT },
|
{ name: "changed", type: BuiltInSlotType.EVENT },
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -851,11 +852,13 @@ export class ComfyImageUploadNode extends ComfyWidgetNode<Array<GradioFileData>>
|
|||||||
this.setOutputData(0, value[0].name) // TODO when ComfyUI LoadImage supports loading an image batch
|
this.setOutputData(0, value[0].name) // TODO when ComfyUI LoadImage supports loading an image batch
|
||||||
this.setOutputData(1, this.imageSize[0])
|
this.setOutputData(1, this.imageSize[0])
|
||||||
this.setOutputData(2, this.imageSize[1])
|
this.setOutputData(2, this.imageSize[1])
|
||||||
|
this.setOutputData(3, value.length)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.setOutputData(0, "")
|
this.setOutputData(0, "")
|
||||||
this.setOutputData(1, 1)
|
this.setOutputData(1, 1)
|
||||||
this.setOutputData(2, 1)
|
this.setOutputData(2, 1)
|
||||||
|
this.setOutputData(3, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ export type NotifyOptions = {
|
|||||||
title?: string,
|
title?: string,
|
||||||
type?: "neutral" | "info" | "warning" | "error" | "success",
|
type?: "neutral" | "info" | "warning" | "error" | "success",
|
||||||
imageUrl?: string,
|
imageUrl?: string,
|
||||||
timeout?: number | null
|
timeout?: number | null,
|
||||||
|
showOn?: "web" | "native" | "all" | "none"
|
||||||
}
|
}
|
||||||
|
|
||||||
function notifyf7(text: string, options: NotifyOptions) {
|
function notifyf7(text: string, options: NotifyOptions) {
|
||||||
@@ -76,7 +77,17 @@ function notifyNative(text: string, options: NotifyOptions) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function notify(text: string, options: NotifyOptions = {}) {
|
export default function notify(text: string, options: NotifyOptions = {}) {
|
||||||
|
const showOn = options.showOn || "web";
|
||||||
|
|
||||||
|
if (showOn === "none")
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (showOn === "all" || showOn === "web") {
|
||||||
notifyf7(text, options);
|
notifyf7(text, options);
|
||||||
notifyToast(text, options);
|
notifyToast(text, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showOn === "all" || showOn === "native") {
|
||||||
notifyNative(text, options)
|
notifyNative(text, options)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -591,6 +591,12 @@ export interface IDragItem {
|
|||||||
*/
|
*/
|
||||||
export interface ContainerLayout extends IDragItem {
|
export interface ContainerLayout extends IDragItem {
|
||||||
type: "container",
|
type: "container",
|
||||||
|
|
||||||
|
// Ephemeral state to preserve when the component gets recreated by Svelte
|
||||||
|
// (not serialized)
|
||||||
|
|
||||||
|
// Accordion
|
||||||
|
isOpen?: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user