feat: add ComfyUI integration for image generation and management
- Implemented ComfyGenerateRequest type and associated functions for generating images using various architectures and modes. - Added functions for listing generation options and handling image uploads. - Created workflows for different generation modes including SDXL, Z-Image, Z-Image Turbo, and Anima. - Introduced GenerationJobStatus component to display the status of ongoing generation jobs. - Developed MaskControls for managing mask operations and displaying mask analysis. - Created palette items for tool selection, layer management, and generation settings.
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
import { commandIds } from "@commands/ids";
|
||||
import type { Dispatch } from "@commands/dispatcher";
|
||||
import type { ImageDocument } from "@core/document";
|
||||
import type { Layer } from "@core/layer";
|
||||
import { getLayerMask } from "@core/layer-mask-utils";
|
||||
import type { InputDocument, InputLayer } from "./read-model";
|
||||
import { resolveTransformTargetBounds, viewportPointToDocumentPoint, type InputViewportState } from "./document-geometry";
|
||||
import type { PointerInputEvent } from "./pointer";
|
||||
|
||||
export function handleArtboardSelection(options: {
|
||||
event: PointerInputEvent;
|
||||
document: ImageDocument;
|
||||
document: InputDocument;
|
||||
viewport: InputViewportState;
|
||||
dispatch: Dispatch;
|
||||
}): boolean {
|
||||
@@ -36,7 +34,7 @@ export function handleArtboardSelection(options: {
|
||||
return true;
|
||||
}
|
||||
|
||||
function findTopmostLayerAtPoint(document: ImageDocument, point: { x: number; y: number }) {
|
||||
function findTopmostLayerAtPoint(document: InputDocument, point: { x: number; y: number }) {
|
||||
const maskLayerIds = collectMaskLayerIds(document.artboards.flatMap((artboard) => artboard.layers));
|
||||
for (const artboard of [...document.artboards].reverse()) {
|
||||
if (!artboard.visible || artboard.locked) continue;
|
||||
@@ -47,7 +45,7 @@ function findTopmostLayerAtPoint(document: ImageDocument, point: { x: number; y:
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function findTopmostLayerInTreeAtPoint(document: ImageDocument, layers: Layer[], point: { x: number; y: number }, maskLayerIds: ReadonlySet<string>): string | undefined {
|
||||
function findTopmostLayerInTreeAtPoint(document: InputDocument, layers: InputLayer[], point: { x: number; y: number }, maskLayerIds: ReadonlySet<string>): string | undefined {
|
||||
for (const layer of layers) {
|
||||
if (!layer.visible || layer.locked || maskLayerIds.has(layer.id)) continue;
|
||||
if (layer.type === "group") {
|
||||
@@ -64,9 +62,9 @@ function findTopmostLayerInTreeAtPoint(document: ImageDocument, layers: Layer[],
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function collectMaskLayerIds(layers: readonly Layer[], ids = new Set<string>()): Set<string> {
|
||||
function collectMaskLayerIds(layers: readonly InputLayer[], ids = new Set<string>()): Set<string> {
|
||||
for (const layer of layers) {
|
||||
const layerMask = getLayerMask(layer);
|
||||
const layerMask = layer.layerMask ?? layer.clippingMask;
|
||||
if (layerMask) ids.add(layerMask.maskLayerId);
|
||||
if (layer.type === "group") collectMaskLayerIds(layer.children, ids);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user