Image output fixes
This commit is contained in:
@@ -41,13 +41,14 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if container && children}
|
{#if container && children}
|
||||||
|
{@const edit = $uiState.uiEditMode === "widgets" && zIndex > 1}
|
||||||
{#key $attrsChanged}
|
{#key $attrsChanged}
|
||||||
<div class="container {container.attrs.direction} {container.attrs.classes} {classes.join(' ')} z-index{zIndex}"
|
<div class="container {container.attrs.direction} {container.attrs.classes} {classes.join(' ')} z-index{zIndex}"
|
||||||
class:hide-block={container.attrs.blockVariant === "hidden"}
|
class:hide-block={container.attrs.blockVariant === "hidden"}
|
||||||
class:selected={$uiState.uiEditMode !== "disabled" && $layoutState.currentSelection.includes(container.id)}
|
class:selected={$uiState.uiEditMode !== "disabled" && $layoutState.currentSelection.includes(container.id)}
|
||||||
class:root-container={zIndex === 0}
|
class:root-container={zIndex === 0}
|
||||||
class:is-executing={container.isNodeExecuting}
|
class:is-executing={container.isNodeExecuting}
|
||||||
class:edit={$uiState.uiEditMode === "widgets" && zIndex > 1}>
|
class:edit={edit}>
|
||||||
<Block>
|
<Block>
|
||||||
{#if container.attrs.title !== ""}
|
{#if container.attrs.title !== ""}
|
||||||
<label for={String(container.id)} class={$uiState.uiEditMode === "widgets" ? "edit-title-label" : ""}>
|
<label for={String(container.id)} class={$uiState.uiEditMode === "widgets" ? "edit-title-label" : ""}>
|
||||||
@@ -56,7 +57,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
<div class="v-pane"
|
<div class="v-pane"
|
||||||
class:empty={children.length === 0}
|
class:empty={children.length === 0}
|
||||||
class:edit={$uiState.uiEditMode === "widgets" && zIndex > 1}
|
class:edit={edit}
|
||||||
use:dndzone="{{
|
use:dndzone="{{
|
||||||
items: children,
|
items: children,
|
||||||
flipDurationMs,
|
flipDurationMs,
|
||||||
@@ -82,6 +83,9 @@
|
|||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
{#if container.attrs.hidden && edit}
|
||||||
|
<div class="handle handle-hidden" class:hidden={!edit} style="z-index: {zIndex+100}"/>
|
||||||
|
{/if}
|
||||||
{#if showHandles}
|
{#if showHandles}
|
||||||
<div class="handle handle-container" style="z-index: {zIndex+100}" data-drag-item-id={container.id} on:mousedown={startDrag} on:touchstart={startDrag} on:mouseup={stopDrag} on:touchend={stopDrag}/>
|
<div class="handle handle-container" style="z-index: {zIndex+100}" data-drag-item-id={container.id} on:mousedown={startDrag} on:touchstart={startDrag} on:mouseup={stopDrag} on:touchend={stopDrag}/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -318,12 +318,12 @@ export default class ComfyApp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Distinguish frontend/backend connections
|
// Distinguish frontend/backend connections
|
||||||
const BACKEND_TYPES = ["CLIP", "CLIP_VISION", "CLIP_VISION_OUTPUT", "CONDITIONING", "CONTROL_NET", "IMAGE", "LATENT", "MASK", "MODEL", "STYLE_MODEL", "VAE"]
|
const BACKEND_TYPES = ["CLIP", "CLIP_VISION", "CLIP_VISION_OUTPUT", "CONDITIONING", "CONTROL_NET", "LATENT", "MASK", "MODEL", "STYLE_MODEL", "VAE"]
|
||||||
for (const type of BACKEND_TYPES) {
|
for (const type of BACKEND_TYPES) {
|
||||||
setColor(type, "orange")
|
setColor(type, "orange")
|
||||||
}
|
}
|
||||||
|
|
||||||
setColor("OUTPUT", "rebeccapurple")
|
setColor("IMAGE", "rebeccapurple")
|
||||||
setColor(BuiltInSlotType.EVENT, "lightseagreen")
|
setColor(BuiltInSlotType.EVENT, "lightseagreen")
|
||||||
setColor(BuiltInSlotType.ACTION, "lightseagreen")
|
setColor(BuiltInSlotType.ACTION, "lightseagreen")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { LiteGraph, type ContextMenuItem, type LGraphNode, type Vector2, LConnec
|
|||||||
import ComfyGraphNode from "./ComfyGraphNode";
|
import ComfyGraphNode from "./ComfyGraphNode";
|
||||||
import { Watch } from "@litegraph-ts/nodes-basic";
|
import { Watch } from "@litegraph-ts/nodes-basic";
|
||||||
import type { SerializedPrompt } from "$lib/components/ComfyApp";
|
import type { SerializedPrompt } from "$lib/components/ComfyApp";
|
||||||
|
import { toast } from '@zerodevx/svelte-toast'
|
||||||
|
|
||||||
export interface ComfyAfterQueuedEventProperties extends Record<any, any> {
|
export interface ComfyAfterQueuedEventProperties extends Record<any, any> {
|
||||||
prompt: SerializedPrompt
|
prompt: SerializedPrompt
|
||||||
@@ -47,6 +48,40 @@ LiteGraph.registerNodeType({
|
|||||||
type: "actions/after_queued"
|
type: "actions/after_queued"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
export interface ComfyOnExecutedEventProperties extends Record<any, any> {
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ComfyOnExecutedEvent extends ComfyGraphNode {
|
||||||
|
override properties: ComfyOnExecutedEventProperties = {
|
||||||
|
}
|
||||||
|
|
||||||
|
static slotLayout: SlotLayout = {
|
||||||
|
inputs: [
|
||||||
|
{ name: "images", type: "IMAGE" }
|
||||||
|
],
|
||||||
|
outputs: [
|
||||||
|
{ name: "onExecuted", type: BuiltInSlotType.EVENT },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
private _output: any = null;
|
||||||
|
|
||||||
|
override receiveOutput(output: any) {
|
||||||
|
if (this._output !== output) {
|
||||||
|
console.error(output)
|
||||||
|
this.triggerSlot(0, "bang")
|
||||||
|
this._output = output
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LiteGraph.registerNodeType({
|
||||||
|
class: ComfyOnExecutedEvent,
|
||||||
|
title: "Comfy.OnExecutedEvent",
|
||||||
|
desc: "Triggers a 'bang' event when a prompt output is received.",
|
||||||
|
type: "actions/on_executed"
|
||||||
|
})
|
||||||
|
|
||||||
export interface ComfyCopyActionProperties extends Record<any, any> {
|
export interface ComfyCopyActionProperties extends Record<any, any> {
|
||||||
value: any
|
value: any
|
||||||
}
|
}
|
||||||
@@ -130,3 +165,34 @@ LiteGraph.registerNodeType({
|
|||||||
desc: "Swaps two inputs when triggered",
|
desc: "Swaps two inputs when triggered",
|
||||||
type: "actions/swap"
|
type: "actions/swap"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
export interface ComfyNotifyActionProperties extends Record<any, any> {
|
||||||
|
message: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ComfyNotifyAction extends ComfyGraphNode {
|
||||||
|
override properties: ComfyNotifyActionProperties = {
|
||||||
|
message: "Nya."
|
||||||
|
}
|
||||||
|
|
||||||
|
static slotLayout: SlotLayout = {
|
||||||
|
inputs: [
|
||||||
|
{ name: "message", type: "string" },
|
||||||
|
{ name: "trigger", type: BuiltInSlotType.ACTION }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
override onAction(action: any, param: any) {
|
||||||
|
const message = this.getInputData(0);
|
||||||
|
if (message) {
|
||||||
|
toast.push(message);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
LiteGraph.registerNodeType({
|
||||||
|
class: ComfyNotifyAction,
|
||||||
|
title: "Comfy.NotifyAction",
|
||||||
|
desc: "Displays a message.",
|
||||||
|
type: "actions/notify"
|
||||||
|
})
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export class ComfyBackendNode extends ComfyGraphNode {
|
|||||||
// It just returns a hash like { "ui": { "images": results } } internally.
|
// It just returns a hash like { "ui": { "images": results } } internally.
|
||||||
// So this will need to be hardcoded for now.
|
// So this will need to be hardcoded for now.
|
||||||
if (["PreviewImage", "SaveImage"].indexOf(comfyClass) !== -1) {
|
if (["PreviewImage", "SaveImage"].indexOf(comfyClass) !== -1) {
|
||||||
this.addOutput("output", "OUTPUT");
|
this.addOutput("output", "IMAGE");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,12 +78,13 @@ export class ComfyBackendNode extends ComfyGraphNode {
|
|||||||
console.warn("onExecuted outputs", outputData)
|
console.warn("onExecuted outputs", outputData)
|
||||||
for (let index = 0; index < this.outputs.length; index++) {
|
for (let index = 0; index < this.outputs.length; index++) {
|
||||||
const output = this.outputs[index]
|
const output = this.outputs[index]
|
||||||
if (output.type === "OUTPUT") {
|
if (output.type === "IMAGE") {
|
||||||
this.setOutputData(index, outputData)
|
this.setOutputData(index, outputData)
|
||||||
for (const node of this.getOutputNodes(index)) {
|
for (const node of this.getOutputNodes(index)) {
|
||||||
|
console.warn(node)
|
||||||
if ("receiveOutput" in node) {
|
if ("receiveOutput" in node) {
|
||||||
const widgetNode = node as ComfyWidgetNode;
|
const widgetNode = node as ComfyGraphNode;
|
||||||
widgetNode.receiveOutput();
|
widgetNode.receiveOutput(outputData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ export default class ComfyGraphNode extends LGraphNode {
|
|||||||
|
|
||||||
defaultWidgets?: DefaultWidgetLayout
|
defaultWidgets?: DefaultWidgetLayout
|
||||||
|
|
||||||
|
/** Called when a backend node sends a ComfyUI output over a link */
|
||||||
|
receiveOutput(output: any) {
|
||||||
|
}
|
||||||
|
|
||||||
override onSerialize(o: SerializedLGraphNode) {
|
override onSerialize(o: SerializedLGraphNode) {
|
||||||
for (let index = 0; index < this.inputs.length; index++) {
|
for (let index = 0; index < this.inputs.length; index++) {
|
||||||
const input = this.inputs[index]
|
const input = this.inputs[index]
|
||||||
|
|||||||
@@ -135,10 +135,6 @@ export abstract class ComfyWidgetNode<T = any> extends ComfyGraphNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Called when a backend node sends a ComfyUI output over a link */
|
|
||||||
receiveOutput() {
|
|
||||||
}
|
|
||||||
|
|
||||||
onConnectOutput(
|
onConnectOutput(
|
||||||
outputIndex: number,
|
outputIndex: number,
|
||||||
inputType: INodeInputSlot["type"],
|
inputType: INodeInputSlot["type"],
|
||||||
@@ -411,7 +407,7 @@ export class ComfyGalleryNode extends ComfyWidgetNode<GradioFileData[]> {
|
|||||||
|
|
||||||
static slotLayout: SlotLayout = {
|
static slotLayout: SlotLayout = {
|
||||||
inputs: [
|
inputs: [
|
||||||
{ name: "images", type: "OUTPUT" }
|
{ name: "images", type: "IMAGE" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export { default as ComfyReroute } from "./ComfyReroute"
|
export { default as ComfyReroute } from "./ComfyReroute"
|
||||||
export { ComfyWidgetNode, ComfySliderNode, ComfyComboNode, ComfyTextNode } from "./ComfyWidgetNodes"
|
export { ComfyWidgetNode, ComfySliderNode, ComfyComboNode, ComfyTextNode } from "./ComfyWidgetNodes"
|
||||||
export { ComfyCopyAction, ComfySwapAction } from "./ComfyActionNodes"
|
export { ComfyAfterQueuedEvent, ComfyCopyAction, ComfySwapAction, ComfyNotifyAction, ComfyOnExecutedEvent } from "./ComfyActionNodes"
|
||||||
export { default as ComfyValueControl } from "./ComfyValueControl"
|
export { default as ComfyValueControl } from "./ComfyValueControl"
|
||||||
export { default as ComfySelector } from "./ComfySelector"
|
export { default as ComfySelector } from "./ComfySelector"
|
||||||
|
|||||||
@@ -113,6 +113,12 @@ body {
|
|||||||
|
|
||||||
.v-pane {
|
.v-pane {
|
||||||
gap: var(--ae-outside-gap-size) !important;
|
gap: var(--ae-outside-gap-size) !important;
|
||||||
|
|
||||||
|
&.empty {
|
||||||
|
border-color: var(--ae-subpanel-border-color) !important;
|
||||||
|
border-radius: 0 !important;
|
||||||
|
background: var(--ae-subpanel-bg-color) !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
@@ -133,13 +139,18 @@ body {
|
|||||||
}
|
}
|
||||||
&.z-index1, &.z-index2 {
|
&.z-index1, &.z-index2 {
|
||||||
// padding: var(--ae-outside-gap-size);
|
// padding: var(--ae-outside-gap-size);
|
||||||
border: 1px solid var(--ae-panel-border-color);
|
// border: 1px solid var(--ae-panel-border-color);
|
||||||
> .block {
|
> .block {
|
||||||
background: var(--ae-frame-bg-color) !important;
|
background: var(--ae-frame-bg-color) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not(.edit) {
|
&:not(.edit) {
|
||||||
|
&.z-index1 > .block {
|
||||||
|
padding: calc(var(--ae-outside-gap-size) / 2) !important;
|
||||||
|
border-width: 0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
> .block {
|
> .block {
|
||||||
border: solid var(--ae-panel-border-width) var(--ae-panel-border-color) !important;
|
border: solid var(--ae-panel-border-width) var(--ae-panel-border-color) !important;
|
||||||
}
|
}
|
||||||
@@ -236,11 +247,11 @@ div.float {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.target-name {
|
.target-name {
|
||||||
background: var(--ae-subpanel-bg-color);
|
background: var(--ae-subpanel-bg-color) !important;
|
||||||
border-color: var(--ae-subpanel-border-color);
|
border-color: var(--ae-subpanel-border-color) !important;
|
||||||
|
|
||||||
.title, .type {
|
.title, .type {
|
||||||
color: var(--ae-label-color)
|
color: var(--ae-label-color) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user