Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f43412e96 | ||
|
|
b1e665b46b |
@@ -2,6 +2,95 @@
|
||||
|
||||
---
|
||||
|
||||
## v0.3.71
|
||||
|
||||
### Inpaint機能の追加(GenerateUI Imageタブ + Image Edit「Inpaint」タブ)
|
||||
|
||||
ユーザー要望「インペイント機能を追加したい」。参考ワークフロー(SDXL + VAEEncodeForInpaint構成)の解析から着手し、複数セッションにわたり段階的に実装。
|
||||
|
||||
**対象ファイル:** `static/js/comfyui-workflow.js`, `static/js/comfyui-editor.js`, `static/js/image-edit-tab.js`, `static/js/generate-tab.js`, `static/js/i18n.js`, `static/css/main.css`, `templates/index.html`, `static/js/app.js`
|
||||
|
||||
**ワークフロー解析(`analyzeWorkflow`):**
|
||||
- `load_image_nodes` に `mask_used` フラグを追加。`LoadImage` ノードのMASK出力(output slot 1)が他ノードの入力(`["<id>", 1]` 参照)として使われているかを走査して判定。`MaskEditorNode` 等の中継ノードを経由していても、参照元のLoadImageまで正しく特定できる
|
||||
- `inpaint_encode_nodes`(`VAEEncodeForInpaint` の `grow_mask_by`)、`mask_editor_one_nodes`(`MaskEditorOne` ノード)を新規検出
|
||||
|
||||
**生成UI Input/Imageタブ — マスクスロット:**
|
||||
- `mask_used` なLoadImageスロットにのみ「Mask」ドロップゾーンを追加表示
|
||||
- Apply時、マスク指定があれば画像+マスクをRGBA合成(マスク白領域→アルファ0)して1枚のPNGとしてアップロード。ComfyUIネイティブの `mask = 1 - alpha` 抽出にそのまま準拠するため追加ノード不要
|
||||
- Mask Editor One ノード用の専用スロットも追加(画像・マスクの両方が揃って初めてApply可能)
|
||||
|
||||
**Image Editタブ — Inpaintツール(🩹):**
|
||||
- プロパティパネルにポジ/ネガプロンプト、Grow Mask By、Denoise、Runボタン、結果画像プレビューを追加
|
||||
- Run押下で: 非マスクレイヤー合成画像 + アクティブなマスクレイヤーを書き出し → 生成UIのインペイント対応スロットへRGBA合成アップロード → プロンプト/grow_mask_by/denoiseを反映 → GenerateUIの生成を呼び出し(画面はImage Editタブに留まる)→ 完了後の結果画像をプロパティパネルに表示
|
||||
- **バグ修正:** ツールバーの `<button data-tool="inpaint">` を `templates/index.html` に追加し忘れており、`TOOL_DEFS` にエントリを追加しただけではボタンが表示されない不具合があった(ツールバーは静的HTML、`TOOL_DEFS` は `ready` 判定とラベル参照専用)
|
||||
|
||||
**Mask Editor One(`comfyui-mask-editor-one`)対応:**
|
||||
- 実装(`nodes.py`/`server.py`)を調査した結果、この custom node は `LoadImage` を介さず、画像はサーバー側インメモリキャッシュ(`node_id` キー、`bg_image_b64`、`/mask_editor/store_image` でPOST)から、マスクは `layer_data`(JSON文字列ウィジェット)の各レイヤーの**アルファチャンネル**から合成されると判明(`LoadImage` の `1 - alpha` とは逆で、alpha値がそのままmask値になる規約)
|
||||
- `comfyEditor.applyImageAndMaskToMaskEditorOneNode()` を新規実装し、この2つの経路(画像キャッシュPOST + layer_data書き込み)を実装
|
||||
- Inpaint Runは `mask_used` なLoadImageスロットを優先し、無ければMask Editor Oneノードへ自動フォールバック
|
||||
|
||||
**インペイント専用ワークフロー:**
|
||||
- Inpaintプロパティ上部に「Use dedicated workflow」チェックボックス + 保存済みワークフロー選択ドロップダウンを追加。OFF時は従来通りGenerateUIの読み込み中ワークフローを使用、ON時は選択したワークフローをその場でロード・解析し、**GenerateUIタブの表示状態には一切触れずに**画像/マスク/プロンプト/パラメータを適用して生成
|
||||
- `generate-tab.js`: `_coreGenerate`/`handleGenerate` に `workflowOverride` 引数を追加(省略時は従来通り `comfyUI.currentWorkflow` を使用)。オーバーライド時はバッチモードの影響を受けない単発生成に固定し、GenerateUI側のプロンプト同期(`syncToWorkflow`)もスキップ
|
||||
- `comfyui-editor.js`: `applyImageAndMaskToSlot` / `applyImageAndMaskToMaskEditorOneNode` / `setPromptText` / `setInpaintParams` に `{workflow, analysis}` オプションを追加し、指定時はそちらへ直接書き込む方式に統一
|
||||
|
||||
**サンプルワークフロー追加:** `workflows/ws_inpaint_basic.json`(LoadImage直結)、`workflows/ws_inpaint_mask_editor_one.json`(Mask Editor One使用)とプレビュー画像
|
||||
|
||||
**ヘルプ更新(3点セット):** `templates/index.html`、`static/js/i18n.js`(EN/JA/ZH `helpImageEdit7e` 新規)、`static/js/app.js`(`helpIdMap` に `wfm-help-imageedit-7e` 追加)
|
||||
|
||||
**既知の簡略化点:** Grow Mask By / Denoiseのプロパティパネル初期表示値は、専用ワークフロー使用時も常にGenerateUI側の読み込み中ワークフローから算出される(Run実行時に書き込まれる値自体は専用ワークフロー側に正しく反映される)
|
||||
|
||||
## v0.3.70
|
||||
|
||||
### Workflow AI要約: Ollama 404エラー修正
|
||||
|
||||
ユーザー報告「ワークフロー詳細モーダルの要約機能でエラー `[ERROR] Ollama chat error: HTTP Error 404: Not Found`」の調査から発生。
|
||||
|
||||
**原因:** `static/js/workflow-tab.js` の要約ボタンはモデル名を指定せずサーバー側 `/api/wfm/ollama/chat` を呼んでおり、サーバー側デフォルト(`py/routes/ollama_routes.py` の `OLLAMA_DEFAULTS.model = "llava"`、タグ無し)が使われていた。実環境には `llava:7b` のようにタグ付きの名前でしか入っておらず、Ollamaは完全一致でしかモデルを解決しないため404になっていた。加えて、設定タブの「AI Assistant Settings (Prompt Tab)」(`localStorage` の `wfm_prompt_ai_settings`)にOllamaのURL・モデル選択UIがすでに存在していたが、Workflowタブの要約機能はこれを一切参照していなかった。
|
||||
|
||||
**対象ファイル:** `static/js/workflow-tab.js`, `py/routes/ollama_routes.py`, `static/js/i18n.js`
|
||||
|
||||
**変更内容:**
|
||||
- `workflow-tab.js`: 要約ボタンが `readJsonStorage("wfm_prompt_ai_settings", {})` で設定タブ保存済みのbackend/backendUrl/modelを読み込み、`/api/wfm/ollama/chat` へ `url` / `model` を渡すように変更。backendが `ollama` 以外(LM Studio)の場合は明示的にエラートースト
|
||||
- `ollama_routes.py`: `handle_chat` がリクエストbodyの `url` も受け付けるように対応(従来は `model` のみ)
|
||||
- i18n: `summarizeOllamaOnly` をEN/JA/ZHに追加
|
||||
|
||||
### Image Edit: New button で Layer 1 自動追加
|
||||
|
||||
ユーザー要望「New button 画像作成時に自動でレイヤー1を追加してほしい」。既存の画像ロード時(`hasLayers` が偽の新規キャンバス経路)は既に「Layer 1」を自動生成していたが、`_newCanvas()`(Newボタン)だけは空の `LayerManager` のままだった。
|
||||
|
||||
**対象ファイル:** `static/js/image-edit-tab.js`
|
||||
|
||||
**変更内容:** `_newCanvas()` で `this._layerMgr.addLayer("draw", "Layer 1")` を追加し、アクティブレイヤー・SelectToolに設定。
|
||||
|
||||
### Image Edit: マスクレイヤーのオーバーレイをアクティブなマスクのみに表示
|
||||
|
||||
ユーザー要望「マスクレイヤーのオーバーレイ表示をマスクレイヤー以外は非表示にしたい」。従来は `layer.visible` のみを条件にオーバーレイ(半透明の色付き表示)を描画しており、非アクティブなマスクレイヤーも常に表示され続けていた。
|
||||
|
||||
**対象ファイル:** `static/js/image-edit-tab.js`
|
||||
|
||||
**変更内容:**
|
||||
- `_renderMaskLayerOverlay(ctx, maskLayer)` の先頭に `if (this._layerMgr?.activeLayer !== maskLayer) return;` を追加。全ての呼び出し経路(単独マスク/マスクグループ)を1箇所でカバー
|
||||
- **副次修正:** レイヤーパネルでSelectツール使用中に通常レイヤーへ切り替えた際に `_updateCompositeView()` が呼ばれていない分岐があり、上記の変更後は「マスク選択→通常レイヤー選択」でオーバーレイが画面に残ったままになる不具合が顕在化するため、当該分岐にも再描画呼び出しを追加
|
||||
|
||||
### GenerateUI Input: プロンプトの「戻す」ボタン + 強調weight編集(Ctrl+↑/↓)
|
||||
|
||||
ユーザー要望2件を同じセッションでまとめて実装。
|
||||
|
||||
**対象ファイル:** `static/js/comfyui-editor.js`, `static/js/i18n.js`
|
||||
|
||||
**変更内容:**
|
||||
- **戻すボタン(↺)** — Positive/Negative各Applyボタンの左隣に追加。クリックで、選択中ノードIDに対応する**ワークフロー上の現在値**(=直前にApply/ロードされた値)をテキストエリアへ再読み込みする、Applyの逆操作。ノード選択セレクトに `min-width:0` を追加し、ボタン増加によるレイアウト圧迫に対応
|
||||
- **強調weight編集(Ctrl+↑/↓)** — A1111 / ComfyUIネイティブのCLIP Text Encodeと同様の操作感。選択テキスト(無ければカーソル位置の括弧ブロック、次点で単語)を `(text:weight)` 構文に変換し、0.05刻みで増減。weightがちょうど1.0に戻ったら括弧を自動除去。汎用ヘルパー `_attachPromptWeightControl` / `_selectSurroundingParenBlock` / `_selectSurroundingWord` を新規追加し、Positive/Negative両テキストエリアにアタッチ
|
||||
- **バグ修正(同セッション内)** — weightがマイナスに達した状態(例: `(watermark:-0.05)`)でさらにCtrl+↓を押すと `((watermark:-0.05):0.95)` のような二重括弧になる不具合を確認。原因は数値抽出の正規表現 `([\d.]+)` が負符号にマッチせず、マッチ全体が失敗して選択テキスト全体を新しい単語として扱っていたため。`(-?[\d.]+)` に修正。下限は設けない仕様(ComfyUIネイティブのCLIP Text Encodeも同様に無制限のため)
|
||||
- i18n: `revertPromptTitle` をEN/JA/ZHに追加
|
||||
|
||||
**ヘルプ更新(3点セット):**
|
||||
- `templates/index.html`: `wfm-help-imageedit-3`(New button説明にLayer 1自動追加を追記)、`wfm-help-imageedit-mask-3`(アクティブなマスクのみオーバーレイ表示である旨を追記)、`wfm-help-gen-4`(戻すボタン・Ctrl+↑/↓ weight編集の説明を追記)
|
||||
- `static/js/i18n.js`: `helpImageEdit3` / `helpImageEditMask3` / `helpGen4` をEN/JA/ZHで更新(新規キー追加ではなく既存キーへの追記のため `app.js` の `helpIdMap` は変更不要)
|
||||
|
||||
**教訓(デプロイ同期、再掲):** 開発リポジトリと `custom_nodes/comfyui-workflow-studio`(StabilityMatrix配下の実行時ディレクトリ)は別実体のコピーであり自動同期しない。今回変更した全ファイル(`workflow-tab.js`, `ollama_routes.py`, `image-edit-tab.js`, `comfyui-editor.js`, `i18n.js`, `templates/index.html`)を都度両方へ適用して対応した。
|
||||
|
||||
## v0.3.69
|
||||
|
||||
### Gallery → ComfyUI Comic Creator 連携(Send CC ボタン)
|
||||
@@ -21,6 +110,25 @@ ComfyUI Comic Creator(別カスタムノード、連携先名称は「Comic Cr
|
||||
|
||||
**ハマりどころ(デプロイ同期忘れ):** 本リポジトリは開発用ディレクトリと実行時の `custom_nodes/comfyui-workflow-studio`(StabilityMatrix配下)が別実体のコピーであり、symlinkではない。上記3ファイルを開発リポジトリのみ編集した状態でComfyUIを起動していたため、「Send CCボタンが表示されない」という報告を受けた。実行時ディレクトリへ3ファイルを手動コピーして解決(差分は今回の追加分のみで他の乖離なし)。今後この種の変更をした際は、都度 `custom_nodes/` 側への同期を忘れないこと(本体のコミット前チェックリスト「全ファイルを custom_nodes/ に同期」を参照)。
|
||||
|
||||
### I2I連携(Comic Creater送信画像の受信・デフォルトワークフロー自動読込)
|
||||
|
||||
ComfyUI Comic Creater の「I2Iへ送る」ボタンから、iframe越しに画像をGenerate UIのImage入力スロットへ直接セットする受信用グローバル関数`window._wfmReceiveImageForI2I(blob, name, workflowData?, workflowFilename?)`を新規追加。上記のSend CCと対になる、逆方向(Comic Creater→Workflow Studio)の連携。既存の「Send GenUI Image」(Galleryの選択画像を送る版)とロジックを共有。
|
||||
|
||||
**対象ファイル:** `static/js/gallery-tab.js`
|
||||
|
||||
**変更内容:**
|
||||
- `window._wfmReceiveImageForI2I`をモジュールトップレベルに追加。`comfyEditor.applyImageToSlot(file, 0)`を呼び、Generate UI → Input → Imageタブへ自動切替した上で画像をLoadImageスロットにセットする
|
||||
- `workflowData`(ワークフローJSON)が渡された場合、画像をセットする前に`loadWorkflowIntoEditor(workflowData, workflowFilename)`(generate-tab.js既存export)でワークフローを差し替える。Comic Creater側の設定タブで「デフォルトI2Iワークフロー」が有効な場合のみ渡される(`user/default/workflows/`配下のファイルをComic Creater側が`GET /api/wfm/workflows/raw?filename=X`で取得して渡す設計、本リポジトリのAPI自体は無改修)
|
||||
- 既存の「Send CC」ボタンのクリックハンドラを拡張し、`window.parent._ccI2ITargetMode`(Comic Creater側が送信元をレイアウトタブ/Imageタブのどちらか記録するフラグ)を参照して、`window.parent.insertImageFromUrl(url)`(レイアウトタブ挿入、従来通り)と`window.parent._ccImageTab.loadFromUrl(url, name)`(Imageタブ読込、新規)を分岐
|
||||
|
||||
**ハマりどころ1(プレビューのURLキャッシュ):** Comic Creater側が同一ファイル名で連続送信すると、`applyImageToSlot`が`previewImg.src`に設定するURL文字列(`/view?filename=...`)が変わらないため、サーバー側は正しく上書きされているのにブラウザがキャッシュ画像を表示し続けた(「編集内容が反映されていないように見えるが、実際に生成すると反映されている」という診断が難しい症状として報告された)。対策はComic Creater側でファイル名をタイムスタンプ付きでユニーク化する方式とし、本リポジトリ側は無改修で解決。
|
||||
|
||||
**ハマりどころ2(モデルリスト未取得):** iframe埋め込み直後など`comfyEditor.models`(Checkpoint等一覧、`init()`時に1回だけ非同期取得)が空のタイミングで`loadWorkflowIntoEditor`を呼ぶと、Model/生成UIタブのCheckpoint等ドロップダウンが空のままレンダリングされ、選択もできなくなる不具合が発生した(Comic Creater再起動でも再現するとの報告)。`_wfmReceiveImageForI2I`内でワークフローロード前に`comfyUI.checkConnection()`→(`comfyEditor.models.checkpoints`が空なら)`comfyEditor.loadModelLists()`を保証するよう修正して解決。
|
||||
|
||||
**ComfyUI Comic Creator 側の実装:** レイアウトタブ・Imageタブの「I2Iへ送る」ボタン、送信共通関数`sendImageToWorkflowStudioI2I`、設定タブの「I2I設定」ブロック(デフォルトワークフローのON/OFF・ファイル名指定)はすべてComic Creater側に実装(本リポジトリからは見えない)。
|
||||
|
||||
**教訓(デプロイ同期忘れ、再掲):** 前回のSend CC実装時と同じ理由で、開発リポジトリと`custom_nodes/comfyui-workflow-studio`(StabilityMatrix配下の実行時ディレクトリ)は別実体のコピーであり自動同期しない。今回は`gallery-tab.js`の変更を都度両方へ適用して対応した。
|
||||
|
||||
### Loraバッチ生成のバリデーションエラー修正 + プロンプト自動反映
|
||||
|
||||
ユーザー報告「生成UIタブのBatchタブでLoraのバッチ機能を使用してIllustriousグループ(128モデル)でバッチ生成を開始したがエラー(`Prompt outputs failed validation`)となった」の調査から一連の修正を実施。
|
||||
|
||||
@@ -21,7 +21,7 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
|
||||
- Built-in AI tools (translation and more)
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
## Screenshots
|
||||
|
||||
@@ -83,6 +83,9 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
|
||||
- **5-tab layout** — Input / Model / Settings / Feeder / Batch tabs; Input, Model, and Settings each include a Raw JSON column on the right for instant preview and direct editing
|
||||
- **Save button** — located at the right end of the subtab row; opens a filename dialog (default: current workflow name) and saves the current workflow as a `.json` file to the Workflow tab via the import API
|
||||
- **Input tab** — Prompt and Image inner tabs (drag-and-drop upload); Prompt tab shows Positive Prompt and Negative Prompt textareas, plus an **Embeddings selector** at the bottom (Filter + Select + Weight input + Paste button); Paste inserts `(embedding:Name:weight)` at the cursor position of the last focused textarea (defaults to Positive when neither is focused); Raw JSON (540px) in the right column
|
||||
- **Revert button** (v0.3.70) — a ↺ button next to each Apply button reverts the textarea to the node's currently applied value (the reverse of Apply)
|
||||
- **Emphasis weight editing** (v0.3.70) — select text (or just place the cursor on a word/parenthesis block) and press Ctrl+↑/↓ to adjust `(text:weight)` by ±0.05, A1111/native-ComfyUI style; parentheses are removed automatically when the weight returns to 1.0
|
||||
- **Mask slot for inpainting** (v0.3.71) — LoadImage slots whose MASK output feeds an inpaint node (e.g. `VAEEncodeForInpaint`) show an additional Mask drop zone; when a mask is set, image + mask are composited into a single RGBA upload (mask baked into the alpha channel) matching ComfyUI's native alpha→MASK extraction — no extra nodes required
|
||||
- **Model tab** — Checkpoint, VAE, LoRA, ControlNet, Diffusion Model (UNETLoader / UnetLoaderGGUF / LoaderGGUF), Text Encoder (CLIPLoader / DualCLIPLoader / ClipLoaderGGUF / DualClipLoaderGGUF — single clip: type + device; dual clip: two clip selectors + type + device), **Hypernetwork** (with Strength field) selectors with filter; Raw JSON on the right
|
||||
- **Settings tab** — KSampler and Latent Image side by side at 50% width each; Raw JSON on the right
|
||||
- **Always-visible Raw JSON** — edit the API-format JSON directly from any tab with syntax highlighting; Apply button reloads the workflow; built-in **search bar** (always shown) finds all matches as you type with count display (`3/12`); navigate with ↑/↓ buttons or Enter / Shift+Enter; Escape or ✕ clears; current match highlighted in orange, other matches in yellow
|
||||
@@ -247,16 +250,17 @@ Two independent modes selectable via **[Image Loop] / [Gallery]** toggle buttons
|
||||
|
||||
- **Layer-based image editor** — compose images with multiple layers (Image, Text, Draw, Mask types) and export the composite as PNG
|
||||
- **Loading images** — drag & drop onto the canvas, Upload button, or send from the Gallery tab via the **Image Edit** toolbar button; first image becomes Layer 1 (auto-locked), subsequent images are added as new layers scaled to fit the canvas
|
||||
- **New button** — create a blank canvas with custom dimensions (WxH prompt); clears all existing layers
|
||||
- **Tools** — Select (V), Draw (B), Text (T), Shape (S), Mask (🎭), Blur (≈), BG Remove (⬚), Filter (★); tool options bar updates per active tool
|
||||
- **New button** — create a blank canvas with custom dimensions (WxH prompt); clears all existing layers and automatically adds an empty Layer 1 (v0.3.70)
|
||||
- **Tools** — Select (V), Draw (B), Text (T), Shape (S), Mask (🎭), Blur (≈), BG Remove (⬚), Filter (★), Inpaint (🩹); tool options bar updates per active tool
|
||||
- **Select** — click to select; drag to move; drag corner handles to resize; drag circle handle to rotate; Flip H / Flip V / Rotate angle in the options bar; double-click a text layer to re-edit its content
|
||||
- **Draw** — freehand brush; options: color, brush size, blend mode; paints directly onto the active draw layer while all other layers remain visible; brush cursor shown as a size-accurate circle; strokes can start from outside the canvas margin and continue past the edge
|
||||
- **Text** — click to place; configure font, size, bold/italic, align, and color; placed as an exact-size text layer sized to the measured bounding box; double-click to re-edit
|
||||
- **Shape** — drag to draw geometric shapes (Rect / Ellipse / Line / FreeLine); options: shape type, Rounded toggle (Rect/Ellipse), Fill color, Stroke color + width, Opacity; each committed shape becomes an independent draw layer; Stroke None hidden for Line/FreeLine (stroke always active)
|
||||
- **Mask** — 7 sub-tools for painting masks onto a dedicated mask layer; click **M** in the Layers header to add a mask layer (Mask tool activates automatically); clicking a mask layer in the list also switches to the Mask tool; **Tool Options bar**: sub-tool buttons (Paint / Color / Alpha / Text / Vector / Shape / SAM3), Invert checkbox, Overlay color picker (default red), Blur slider (0–50 px); SAM3 requires Mask Editor One (disabled when not installed); Color / Alpha / Text / Vector / Shape work without Mask Editor One; **Properties pane — Paint**: Mode (Add / Erase), Size (1–200 px), Hardness (0–100%); **MASK EDITOR ONE section** (Paint sub-tool, visible when installed): Select opens the ABR stamp-brush library; ✕ clears back to Circle; when an image brush is active, Hardness is disabled and Spacing (5–100%), Angle (0–359°), Sz Jitter (0–100%), Rot. Jitter (on/off) appear; **Properties pane — Color**: click canvas to flood-select pixels by color similarity; Mode (Add / Subtract), Tolerance (0–255), Feather % (0–100); **Properties pane — Alpha**: extract the active layer's transparency as a mask; Threshold, Invert checkbox, Extract Alpha button; **Properties pane — Text**: click canvas to open a stamp overlay — enter text, set Font / Size / Bold / Italic / Align / Mode (Add / Erase), Stamp or Ctrl+Enter to apply; multi-line supported; **Properties pane — Vector**: click to add Catmull-Rom spline points; Enter (or click first point) closes and fills the polygon; Backspace removes the last point; Esc resets; Mode (Add / Erase); **Properties pane — Shape**: drag to draw Rect or Ellipse; hold Shift for square/circle; blue dashed outline preview while dragging; Mode (Add / Erase); **Properties pane — SAM3**: enter a text prompt, set Max candidates (3/6/9/12), click Segment; select candidate thumbnails (multi-select), Apply Selected (N) applies with current Mode; **Mask layer A/S operation**: A/S toggle — Add (green) composites normally, Subtract (red) cuts the mask from below; **✂ clipping mask button** clips the layer below to the painted area; brush cursor shown as size-accurate circle; strokes can start from outside the canvas margin and continue past the edge
|
||||
- **Mask** — 7 sub-tools for painting masks onto a dedicated mask layer; click **M** in the Layers header to add a mask layer (Mask tool activates automatically); clicking a mask layer in the list also switches to the Mask tool; **Tool Options bar**: sub-tool buttons (Paint / Color / Alpha / Text / Vector / Shape / SAM3), Invert checkbox, Overlay color picker (default red), Blur slider (0–50 px); the overlay is only shown for the currently active mask layer, other mask layers stay hidden until selected (v0.3.70); SAM3 requires Mask Editor One (disabled when not installed); Color / Alpha / Text / Vector / Shape work without Mask Editor One; **Properties pane — Paint**: Mode (Add / Erase), Size (1–200 px), Hardness (0–100%); **MASK EDITOR ONE section** (Paint sub-tool, visible when installed): Select opens the ABR stamp-brush library; ✕ clears back to Circle; when an image brush is active, Hardness is disabled and Spacing (5–100%), Angle (0–359°), Sz Jitter (0–100%), Rot. Jitter (on/off) appear; **Properties pane — Color**: click canvas to flood-select pixels by color similarity; Mode (Add / Subtract), Tolerance (0–255), Feather % (0–100); **Properties pane — Alpha**: extract the active layer's transparency as a mask; Threshold, Invert checkbox, Extract Alpha button; **Properties pane — Text**: click canvas to open a stamp overlay — enter text, set Font / Size / Bold / Italic / Align / Mode (Add / Erase), Stamp or Ctrl+Enter to apply; multi-line supported; **Properties pane — Vector**: click to add Catmull-Rom spline points; Enter (or click first point) closes and fills the polygon; Backspace removes the last point; Esc resets; Mode (Add / Erase); **Properties pane — Shape**: drag to draw Rect or Ellipse; hold Shift for square/circle; blue dashed outline preview while dragging; Mode (Add / Erase); **Properties pane — SAM3**: enter a text prompt, set Max candidates (3/6/9/12), click Segment; select candidate thumbnails (multi-select), Apply Selected (N) applies with current Mode; **Mask layer A/S operation**: A/S toggle — Add (green) composites normally, Subtract (red) cuts the mask from below; **✂ clipping mask button** clips the layer below to the painted area; brush cursor shown as size-accurate circle; strokes can start from outside the canvas margin and continue past the edge
|
||||
- **Blur** — **Whole Blur**: Gaussian blur to the entire active layer with intensity slider (1–50 px); **Whole Mosaic**: pixelation mosaic with block-size slider (5–100 px); **Rect Blur / Rect Mosaic**: enable the toggle then drag a rectangle on the canvas to apply blur or mosaic to that region only (blue preview for blur, orange for mosaic); Rect Blur and Rect Mosaic are mutually exclusive; all operations support Undo
|
||||
- **BG Remove** — remove the background from the active layer; **Lightweight (@imgly)**: runs entirely in the browser via CDN (no server required; ~40 MB model downloaded on first use); **BiRefNet**: high-quality removal via Mask Editor One's Python backend (requires Mask Editor One installed and `birefnet.safetensors` in `ComfyUI/models/background_removal/`); **New Layer** option (default on) adds the result as a new layer above the original; when off, replaces the active layer in-place
|
||||
- **Filter (G'MIC)** — apply G'MIC-Qt filter effects to the active image layer; click **Edit with G'MIC** to launch G'MIC-Qt GUI; select a filter and click OK — a "G'MIC-Qt filter output" window appears; close it to save the result back as the active layer; requires G'MIC-Qt Standalone installed and path configured in Settings → G'MIC-Qt Executable Path
|
||||
- **Inpaint** (v0.3.71) — composites the visible layers plus a Mask layer into one RGBA image (mask baked into the alpha channel) and applies it to the first inpaint-capable LoadImage node in the workflow currently loaded in GenerateUI (a node whose MASK output feeds something like `VAEEncodeForInpaint`); also supports workflows built around the **Mask Editor One** custom node (`comfyui-mask-editor-one`) instead of LoadImage — image/mask are pushed via its node_id-keyed server cache and `layer_data` widget; **Properties pane**: Positive/Negative prompts, Grow Mask By (applied to the VAE Encode (for Inpainting) node), Denoise (applied to KSampler), Run button; **Use dedicated workflow** checkbox — when off, generates against the workflow currently loaded in GenerateUI; when on, pick a saved workflow from the dropdown to load, edit, and generate entirely in the background without disturbing what's shown in GenerateUI; the result image is shown back in the Properties pane when generation completes; requires a Mask layer painted first (Mask tool)
|
||||
- **Layer panel** — layer list with visibility (👁/🚫), lock (🔒/🔓), and clipping-mask (✂) toggles; opacity slider; type icons (🖼 image / T text / ✏ draw / ⬚ mask); Layer 1 is automatically locked on first image load
|
||||
- **Layer lock** — locked layers show an orange bounding box and 🔒 icon on the canvas; move/resize/rotate are disabled while locked; click the 🔓 button in the layer row to unlock
|
||||
- **Text quality** — text layers are rendered at their measured bounding-box size; resizing with the Select tool regenerates the canvas at the new display resolution so text stays sharp
|
||||
@@ -394,6 +398,22 @@ Click the **camera icon** (next to the W button) in ComfyUI's top bar to capture
|
||||
|
||||
## Changelog
|
||||
|
||||
### v0.3.71
|
||||
|
||||
- **Image Edit — Inpaint tool (🩹)** — new tool composites the canvas (all non-mask layers) plus the active mask layer, uploads to an inpaint-capable LoadImage node (or a Mask Editor One node) in the GenerateUI workflow, applies Positive/Negative prompts, Grow Mask By, and Denoise, then triggers generation — all without leaving the Image Edit tab; the result is shown in the Properties pane
|
||||
- **Image Edit — Inpaint: dedicated workflow** — "Use dedicated workflow" checkbox lets you pick a saved workflow to run the inpaint against instead of the one currently loaded in GenerateUI, without disturbing what's shown there
|
||||
- **Image Edit — Inpaint: Mask Editor One support** — workflows built around the `comfyui-mask-editor-one` custom node (no LoadImage) are also supported; image/mask are pushed via its node_id-keyed server cache and `layer_data` widget
|
||||
- **GenerateUI — Input/Image tab mask slots** — LoadImage nodes whose MASK output feeds an inpaint node (e.g. `VAEEncodeForInpaint`) now show an additional Mask drop zone; image + mask are composited into a single RGBA upload matching ComfyUI's native alpha→MASK extraction
|
||||
- New example workflows: `ws_inpaint_basic.json`, `ws_inpaint_mask_editor_one.json`
|
||||
|
||||
### v0.3.70
|
||||
|
||||
- **Workflow AI summary — Ollama 404 fix** — the summarize button in the workflow detail modal now uses the Ollama URL/model saved in Settings → AI Assistant Settings (previously it silently fell back to a hardcoded default model tag that didn't match locally installed models, causing a 404)
|
||||
- **Image Edit — New button auto-adds Layer 1** — creating a blank canvas via the New button now automatically adds an empty "Layer 1", matching the existing image-load behavior
|
||||
- **Image Edit — mask overlay shown only for the active mask layer** — previously every visible mask layer's overlay was rendered regardless of selection; now only the currently active mask layer shows its overlay, other mask layers stay hidden until selected
|
||||
- **GenerateUI — Revert button for Positive/Negative Prompt** — a ↺ button next to each Apply button reverts the textarea to the node's currently applied value
|
||||
- **GenerateUI — Ctrl+↑/↓ prompt emphasis weight editing** — A1111 / native ComfyUI CLIP Text Encode style: select text (or just place the cursor on a word/parenthesis block) and press Ctrl+↑/↓ to adjust `(text:weight)` by ±0.05; parentheses are removed automatically when the weight returns to 1.0
|
||||
|
||||
### v0.3.69
|
||||
|
||||
- **Gallery — Send CC button** — new toolbar button, shown only when the Gallery tab is embedded as an iframe inside ComfyUI Comic Creator (a separate custom node); sends the selected image directly into Comic Creator's currently selected panel/overlay via its existing `insertImageFromUrl(url)` helper (no changes required on the Comic Creator side)
|
||||
|
||||
@@ -82,7 +82,8 @@ async def handle_chat(request: web.Request) -> web.Response:
|
||||
try:
|
||||
body = await request.json()
|
||||
cfg = _get_ollama_config()
|
||||
model = body.get("model", cfg["model"])
|
||||
model = body.get("model") or cfg["model"]
|
||||
base_url = (body.get("url") or cfg["url"]).rstrip("/")
|
||||
messages = body.get("messages", [])
|
||||
|
||||
def _chat():
|
||||
@@ -92,7 +93,7 @@ async def handle_chat(request: web.Request) -> web.Response:
|
||||
"stream": False,
|
||||
}).encode("utf-8")
|
||||
|
||||
url = f"{cfg['url']}/api/chat"
|
||||
url = f"{base_url}/api/chat"
|
||||
req = urllib.request.Request(
|
||||
url,
|
||||
data=payload,
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "comfyui-workflow-studio"
|
||||
description = "A comprehensive workflow, asset management, and generation UI plugin for ComfyUI. Manage workflows, models, images, and prompts; batch generation and Image Feeder in the GenerateUI tab; library side panel with canvas drag & drop and AI tools."
|
||||
version = "0.3.69"
|
||||
version = "0.3.71"
|
||||
license = "MIT"
|
||||
requires-python = ">= 3.10"
|
||||
dependencies = ["jinja2"]
|
||||
|
||||
@@ -2938,6 +2938,41 @@ body {
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.wfm-i2i-mask-section {
|
||||
margin-top: 8px;
|
||||
padding-top: 8px;
|
||||
border-top: 1px dashed var(--wfm-border);
|
||||
}
|
||||
|
||||
.wfm-i2i-mask-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 6px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: var(--wfm-text-secondary);
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.wfm-i2i-mask-filename {
|
||||
font-size: 10px;
|
||||
font-weight: 400;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
max-width: 120px;
|
||||
}
|
||||
|
||||
.wfm-i2i-mask-preview-wrap .wfm-i2i-preview-img {
|
||||
max-height: 70px;
|
||||
background: #000;
|
||||
}
|
||||
|
||||
.wfm-i2i-mask-drop-zone {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
/* ============================================
|
||||
Side Panel - Thumbnail Tab
|
||||
============================================ */
|
||||
|
||||
+1
-1
@@ -445,7 +445,7 @@ function applyI18nToHtml() {
|
||||
"wfm-help-imageedit-28": "helpImageEdit28", "wfm-help-imageedit-29": "helpImageEdit29",
|
||||
"wfm-help-imageedit-30": "helpImageEdit30",
|
||||
"wfm-help-imageedit-7b": "helpImageEdit7b", "wfm-help-imageedit-7c": "helpImageEdit7c",
|
||||
"wfm-help-imageedit-7d": "helpImageEdit7d",
|
||||
"wfm-help-imageedit-7d": "helpImageEdit7d", "wfm-help-imageedit-7e": "helpImageEdit7e",
|
||||
"wfm-help-imageedit-8b": "helpImageEdit8b",
|
||||
"wfm-help-imageedit-blur-title": "helpImageEditBlurTitle",
|
||||
"wfm-help-imageedit-blur-1": "helpImageEditBlur1", "wfm-help-imageedit-blur-2": "helpImageEditBlur2",
|
||||
|
||||
+447
-6
@@ -4,6 +4,7 @@
|
||||
|
||||
import { comfyUI } from "./comfyui-client.js";
|
||||
import { syncJsonHighlight } from "./json-highlight.js";
|
||||
import { t } from "./i18n.js";
|
||||
|
||||
// ── Latent Image preset state ─────────────────────────────
|
||||
const _LATENT_PRESET_KEY = "wfm_latent_presets";
|
||||
@@ -153,6 +154,139 @@ function _syncRawJson() {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Inpaint: 画像+マスクのRGBA合成 ──────────────────────
|
||||
// mask は白=インペイント対象領域/黒=維持領域のグレースケール画像を想定(Image Editの
|
||||
// マスクレイヤーも、手動でドロップする白黒マスクファイルも同じ規約)。
|
||||
// ComfyUIネイティブのLoadImageはアルファチャンネルから mask = 1 - alpha を抽出するため、
|
||||
// 合成後の alpha は 255 - maskGray とする。
|
||||
async function _loadImageElement(src) {
|
||||
const isBlobLike = src instanceof Blob;
|
||||
const url = isBlobLike ? URL.createObjectURL(src) : src;
|
||||
try {
|
||||
const img = new Image();
|
||||
img.src = url;
|
||||
await new Promise((resolve, reject) => {
|
||||
img.onload = resolve;
|
||||
img.onerror = () => reject(new Error("Failed to load image"));
|
||||
});
|
||||
return img;
|
||||
} finally {
|
||||
if (isBlobLike) URL.revokeObjectURL(url);
|
||||
}
|
||||
}
|
||||
|
||||
async function _compositeImageWithMask(imageInput, maskInput) {
|
||||
const img = await _loadImageElement(imageInput);
|
||||
const mask = await _loadImageElement(maskInput);
|
||||
|
||||
const w = img.naturalWidth, h = img.naturalHeight;
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = w; canvas.height = h;
|
||||
const ctx = canvas.getContext("2d");
|
||||
ctx.drawImage(img, 0, 0, w, h);
|
||||
const imgData = ctx.getImageData(0, 0, w, h);
|
||||
|
||||
const maskCanvas = document.createElement("canvas");
|
||||
maskCanvas.width = w; maskCanvas.height = h;
|
||||
const mctx = maskCanvas.getContext("2d");
|
||||
mctx.drawImage(mask, 0, 0, w, h);
|
||||
const maskData = mctx.getImageData(0, 0, w, h).data;
|
||||
|
||||
const data = imgData.data;
|
||||
for (let i = 0; i < data.length; i += 4) {
|
||||
data[i + 3] = 255 - maskData[i];
|
||||
}
|
||||
ctx.putImageData(imgData, 0, 0);
|
||||
|
||||
return new Promise((resolve) => canvas.toBlob(resolve, "image/png"));
|
||||
}
|
||||
|
||||
// ── Inpaint: Mask Editor One (comfyui-mask-editor-one) ノード向けヘルパー ──────
|
||||
// この custom node は LoadImage を介さず、画像は /mask_editor/store_image でサーバー側
|
||||
// キャッシュ(bg_image_b64, node_idキー)へ、マスクは layer_data(JSON文字列)ウィジェットの
|
||||
// 各レイヤーの「アルファチャンネル」から合成される(LoadImageの 1-alpha とは逆で、
|
||||
// alpha値がそのままmask値になる規約)。
|
||||
async function _imageInputToDataURL(imageInput) {
|
||||
const img = await _loadImageElement(imageInput);
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = img.naturalWidth;
|
||||
canvas.height = img.naturalHeight;
|
||||
canvas.getContext("2d").drawImage(img, 0, 0);
|
||||
return canvas.toDataURL("image/png");
|
||||
}
|
||||
|
||||
async function _maskInputToAlphaDataURL(maskInput) {
|
||||
const img = await _loadImageElement(maskInput);
|
||||
const w = img.naturalWidth, h = img.naturalHeight;
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = w; canvas.height = h;
|
||||
const ctx = canvas.getContext("2d");
|
||||
ctx.drawImage(img, 0, 0, w, h);
|
||||
const imgData = ctx.getImageData(0, 0, w, h);
|
||||
|
||||
const data = imgData.data;
|
||||
for (let i = 0; i < data.length; i += 4) {
|
||||
const gray = data[i];
|
||||
data[i] = data[i + 1] = data[i + 2] = 255;
|
||||
data[i + 3] = gray;
|
||||
}
|
||||
ctx.putImageData(imgData, 0, 0);
|
||||
|
||||
return canvas.toDataURL("image/png");
|
||||
}
|
||||
|
||||
// ── プロンプト強調weight編集 (Ctrl+↑/↓) ──────────────────────
|
||||
// A1111 / ComfyUIネイティブのCLIP Text Encodeと同様の操作感:
|
||||
// 選択(無ければカーソル位置の括弧ブロックまたは単語)を (text:weight) 形式に変換し、
|
||||
// weightを0.05刻みで増減する。weightが1.0に戻ったら括弧を除去する。
|
||||
const _PROMPT_WEIGHT_DELIMITERS = new Set([",", "\n", "\r", "\t", " ", "(", ")", ":"]);
|
||||
|
||||
function _selectSurroundingParenBlock(text, pos) {
|
||||
const openIdx = text.lastIndexOf("(", pos - 1);
|
||||
if (openIdx === -1) return null;
|
||||
const closeBefore = text.lastIndexOf(")", pos - 1);
|
||||
if (closeBefore > openIdx) return null; // カーソルは既に閉じたブロックの外
|
||||
const closeIdx = text.indexOf(")", pos);
|
||||
if (closeIdx === -1) return null;
|
||||
return { start: openIdx, end: closeIdx + 1 };
|
||||
}
|
||||
|
||||
function _selectSurroundingWord(text, pos) {
|
||||
let start = pos, end = pos;
|
||||
while (start > 0 && !_PROMPT_WEIGHT_DELIMITERS.has(text[start - 1])) start--;
|
||||
while (end < text.length && !_PROMPT_WEIGHT_DELIMITERS.has(text[end])) end++;
|
||||
return { start, end };
|
||||
}
|
||||
|
||||
function _attachPromptWeightControl(textarea) {
|
||||
textarea.addEventListener("keydown", (e) => {
|
||||
if (!e.ctrlKey || (e.key !== "ArrowUp" && e.key !== "ArrowDown")) return;
|
||||
e.preventDefault();
|
||||
|
||||
const delta = e.key === "ArrowUp" ? 0.05 : -0.05;
|
||||
const text = textarea.value;
|
||||
let start = textarea.selectionStart;
|
||||
let end = textarea.selectionEnd;
|
||||
|
||||
if (start === end) {
|
||||
const range = _selectSurroundingParenBlock(text, start) || _selectSurroundingWord(text, start);
|
||||
start = range.start;
|
||||
end = range.end;
|
||||
}
|
||||
if (start === end) return;
|
||||
|
||||
const selected = text.substring(start, end);
|
||||
const m = selected.match(/^\((.*):(-?[\d.]+)\)$/s);
|
||||
const inner = m ? m[1] : selected;
|
||||
let weight = (m ? parseFloat(m[2]) : 1.0) + delta;
|
||||
weight = Math.round(weight * 100) / 100;
|
||||
|
||||
const replacement = weight === 1.0 ? inner : `(${inner}:${weight.toFixed(2)})`;
|
||||
textarea.value = text.substring(0, start) + replacement + text.substring(end);
|
||||
textarea.setSelectionRange(start, start + replacement.length);
|
||||
});
|
||||
}
|
||||
|
||||
export const comfyEditor = {
|
||||
models: {
|
||||
checkpoints: [],
|
||||
@@ -228,10 +362,11 @@ export const comfyEditor = {
|
||||
<div class="wfm-form-group">
|
||||
<label>Positive Prompt</label>
|
||||
<div style="display:flex;gap:8px;margin-bottom:6px;">
|
||||
<select id="wfm-prompt-pos-target" class="wfm-select" style="width:auto;flex:1">
|
||||
<select id="wfm-prompt-pos-target" class="wfm-select" style="width:auto;flex:1;min-width:0;">
|
||||
${positiveNodes.map((n) => `<option value="${n.id}" data-text-key="${n.textKey || "text"}" selected>ID:${n.id} (${n.title})</option>`).join("")}
|
||||
${nodeOpts}
|
||||
</select>
|
||||
<button class="wfm-btn wfm-btn-sm" id="wfm-prompt-pos-revert" title="${t("revertPromptTitle")}">↺</button>
|
||||
<button class="wfm-btn wfm-btn-sm" id="wfm-prompt-pos-apply" title="Apply (Alt+Click: Apply & Generate)">Apply</button>
|
||||
</div>
|
||||
<textarea class="wfm-textarea" id="wfm-prompt-pos-text" rows="6">${positiveNodes[0]?.text || ""}</textarea>
|
||||
@@ -239,10 +374,11 @@ export const comfyEditor = {
|
||||
<div class="wfm-form-group">
|
||||
<label>Negative Prompt</label>
|
||||
<div style="display:flex;gap:8px;margin-bottom:6px;">
|
||||
<select id="wfm-prompt-neg-target" class="wfm-select" style="width:auto;flex:1">
|
||||
<select id="wfm-prompt-neg-target" class="wfm-select" style="width:auto;flex:1;min-width:0;">
|
||||
${negativeNodes.map((n) => `<option value="${n.id}" data-text-key="${n.textKey || "text"}" selected>ID:${n.id} (${n.title})</option>`).join("")}
|
||||
${nodeOpts}
|
||||
</select>
|
||||
<button class="wfm-btn wfm-btn-sm" id="wfm-prompt-neg-revert" title="${t("revertPromptTitle")}">↺</button>
|
||||
<button class="wfm-btn wfm-btn-sm" id="wfm-prompt-neg-apply">Apply</button>
|
||||
</div>
|
||||
<textarea class="wfm-textarea" id="wfm-prompt-neg-text" rows="6">${negativeNodes[0]?.text || ""}</textarea>
|
||||
@@ -284,6 +420,27 @@ export const comfyEditor = {
|
||||
}
|
||||
});
|
||||
|
||||
// Revert: テキストエリアを直前にApplyされたノードの現在値へ戻す
|
||||
document.getElementById("wfm-prompt-pos-revert")?.addEventListener("click", () => {
|
||||
const nodeId = document.getElementById("wfm-prompt-pos-target")?.value;
|
||||
const wfNode = comfyUI.currentWorkflow?.[nodeId];
|
||||
const ta = document.getElementById("wfm-prompt-pos-text");
|
||||
if (!nodeId || !wfNode || !ta) return;
|
||||
const promptNode = (analysis.prompt_nodes || []).find(n => n.id === nodeId);
|
||||
const textKey = promptNode?.textKey || "text";
|
||||
ta.value = wfNode.inputs[textKey] ?? "";
|
||||
});
|
||||
|
||||
document.getElementById("wfm-prompt-neg-revert")?.addEventListener("click", () => {
|
||||
const nodeId = document.getElementById("wfm-prompt-neg-target")?.value;
|
||||
const wfNode = comfyUI.currentWorkflow?.[nodeId];
|
||||
const ta = document.getElementById("wfm-prompt-neg-text");
|
||||
if (!nodeId || !wfNode || !ta) return;
|
||||
const promptNode = (analysis.prompt_nodes || []).find(n => n.id === nodeId);
|
||||
const textKey = promptNode?.textKey || "text";
|
||||
ta.value = wfNode.inputs[textKey] ?? "";
|
||||
});
|
||||
|
||||
// Track last focused prompt textarea for Paste button
|
||||
["wfm-prompt-pos-text", "wfm-prompt-neg-text"].forEach((taId) => {
|
||||
const ta = document.getElementById(taId);
|
||||
@@ -293,6 +450,7 @@ export const comfyEditor = {
|
||||
_lastPromptFocus = { id: taId, selStart: ta.selectionStart, selEnd: ta.selectionEnd };
|
||||
});
|
||||
});
|
||||
_attachPromptWeightControl(ta);
|
||||
});
|
||||
|
||||
// Embedding filter
|
||||
@@ -1037,14 +1195,18 @@ export const comfyEditor = {
|
||||
if (!el) return;
|
||||
|
||||
const loadNodes = analysis.load_image_nodes || [];
|
||||
if (loadNodes.length === 0) {
|
||||
el.innerHTML = `<p class="wfm-placeholder">No LoadImage nodes found in workflow</p>`;
|
||||
const meoNodes = analysis.mask_editor_one_nodes || [];
|
||||
if (loadNodes.length === 0 && meoNodes.length === 0) {
|
||||
el.innerHTML = `<p class="wfm-placeholder">No LoadImage / Mask Editor One nodes found in workflow</p>`;
|
||||
return;
|
||||
}
|
||||
|
||||
// Render up to 4 image input slots
|
||||
const slots = loadNodes.slice(0, 4);
|
||||
// Mask Editor One ノード(画像+マスクを内包、常に両方必須)— 別枠で最大2件表示
|
||||
const meoSlots = meoNodes.slice(0, 2);
|
||||
el.innerHTML = `
|
||||
${slots.length === 0 ? "" : `
|
||||
<div class="wfm-i2i-grid">
|
||||
${slots.map((node, i) => `
|
||||
<div class="wfm-i2i-slot" data-slot="${i}" data-node-id="${node.id}">
|
||||
@@ -1061,6 +1223,23 @@ export const comfyEditor = {
|
||||
<input type="file" accept="image/*" class="wfm-i2i-file" id="wfm-i2i-file-${i}" style="display:none;">
|
||||
</label>
|
||||
</div>
|
||||
${node.mask_used ? `
|
||||
<div class="wfm-i2i-mask-section">
|
||||
<div class="wfm-i2i-mask-header">
|
||||
<span>Mask</span>
|
||||
<span class="wfm-i2i-mask-filename" id="wfm-i2i-mask-filename-${i}"></span>
|
||||
</div>
|
||||
<div class="wfm-i2i-preview-wrap wfm-i2i-mask-preview-wrap" id="wfm-i2i-mask-preview-wrap-${i}" style="display:none;">
|
||||
<img class="wfm-i2i-preview-img" id="wfm-i2i-mask-preview-${i}">
|
||||
</div>
|
||||
<div class="wfm-i2i-drop-zone wfm-i2i-mask-drop-zone" id="wfm-i2i-mask-drop-${i}">
|
||||
<label class="wfm-i2i-drop-label">
|
||||
Drop mask (white=inpaint) or click to select
|
||||
<input type="file" accept="image/*" class="wfm-i2i-file" id="wfm-i2i-mask-file-${i}" style="display:none;">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
` : ""}
|
||||
<div style="display:flex;gap:6px;margin-top:6px;">
|
||||
<button class="wfm-btn wfm-btn-sm wfm-btn-primary wfm-i2i-apply" data-slot="${i}" disabled>Apply</button>
|
||||
<span class="wfm-i2i-status" id="wfm-i2i-status-${i}"></span>
|
||||
@@ -1068,6 +1247,46 @@ export const comfyEditor = {
|
||||
</div>
|
||||
`).join("")}
|
||||
</div>
|
||||
`}
|
||||
${meoSlots.length === 0 ? "" : `
|
||||
<div class="wfm-i2i-grid" style="margin-top:12px;">
|
||||
${meoSlots.map((node, i) => `
|
||||
<div class="wfm-i2i-slot" data-meo-slot="${i}" data-node-id="${node.id}">
|
||||
<div class="wfm-i2i-slot-header">
|
||||
<span style="font-weight:600;font-size:12px;">ID:${node.id} ${node.title} (Mask Editor One)</span>
|
||||
</div>
|
||||
<div class="wfm-i2i-preview-wrap" id="wfm-meo-preview-wrap-${i}" style="display:none;">
|
||||
<img class="wfm-i2i-preview-img" id="wfm-meo-preview-${i}">
|
||||
</div>
|
||||
<div class="wfm-i2i-drop-zone" id="wfm-meo-drop-${i}">
|
||||
<label class="wfm-i2i-drop-label">
|
||||
Drop image or click to select
|
||||
<input type="file" accept="image/*" class="wfm-i2i-file" id="wfm-meo-file-${i}" style="display:none;">
|
||||
</label>
|
||||
</div>
|
||||
<div class="wfm-i2i-mask-section">
|
||||
<div class="wfm-i2i-mask-header">
|
||||
<span>Mask</span>
|
||||
<span class="wfm-i2i-mask-filename" id="wfm-meo-mask-filename-${i}"></span>
|
||||
</div>
|
||||
<div class="wfm-i2i-preview-wrap wfm-i2i-mask-preview-wrap" id="wfm-meo-mask-preview-wrap-${i}" style="display:none;">
|
||||
<img class="wfm-i2i-preview-img" id="wfm-meo-mask-preview-${i}">
|
||||
</div>
|
||||
<div class="wfm-i2i-drop-zone wfm-i2i-mask-drop-zone" id="wfm-meo-mask-drop-${i}">
|
||||
<label class="wfm-i2i-drop-label">
|
||||
Drop mask (white=inpaint) or click to select
|
||||
<input type="file" accept="image/*" class="wfm-i2i-file" id="wfm-meo-mask-file-${i}" style="display:none;">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:flex;gap:6px;margin-top:6px;">
|
||||
<button class="wfm-btn wfm-btn-sm wfm-btn-primary wfm-meo-apply" data-slot="${i}" disabled>Apply</button>
|
||||
<span class="wfm-i2i-status" id="wfm-meo-status-${i}"></span>
|
||||
</div>
|
||||
</div>
|
||||
`).join("")}
|
||||
</div>
|
||||
`}
|
||||
`;
|
||||
|
||||
// Initialize each slot
|
||||
@@ -1079,7 +1298,13 @@ export const comfyEditor = {
|
||||
const filenameEl = document.getElementById(`wfm-i2i-filename-${i}`);
|
||||
const statusEl = document.getElementById(`wfm-i2i-status-${i}`);
|
||||
const dropZone = document.getElementById(`wfm-i2i-drop-${i}`);
|
||||
const maskFileInput = document.getElementById(`wfm-i2i-mask-file-${i}`);
|
||||
const maskDropZone = document.getElementById(`wfm-i2i-mask-drop-${i}`);
|
||||
const maskPreviewWrap = document.getElementById(`wfm-i2i-mask-preview-wrap-${i}`);
|
||||
const maskPreviewImg = document.getElementById(`wfm-i2i-mask-preview-${i}`);
|
||||
const maskFilenameEl = document.getElementById(`wfm-i2i-mask-filename-${i}`);
|
||||
let pendingFile = null;
|
||||
let pendingMaskFile = null;
|
||||
|
||||
const applyFile = (file) => {
|
||||
if (!file || !file.type.startsWith("image/")) return;
|
||||
@@ -1092,10 +1317,24 @@ export const comfyEditor = {
|
||||
statusEl.textContent = "";
|
||||
};
|
||||
|
||||
const applyMaskFile = (file) => {
|
||||
if (!file || !file.type.startsWith("image/")) return;
|
||||
pendingMaskFile = file;
|
||||
const url = URL.createObjectURL(file);
|
||||
maskPreviewImg.src = url;
|
||||
maskPreviewWrap.style.display = "";
|
||||
maskFilenameEl.textContent = file.name;
|
||||
applyBtn.disabled = false;
|
||||
statusEl.textContent = "";
|
||||
};
|
||||
|
||||
// File input change
|
||||
fileInput?.addEventListener("change", () => {
|
||||
if (fileInput.files.length > 0) applyFile(fileInput.files[0]);
|
||||
});
|
||||
maskFileInput?.addEventListener("change", () => {
|
||||
if (maskFileInput.files.length > 0) applyMaskFile(maskFileInput.files[0]);
|
||||
});
|
||||
|
||||
// Drag & drop
|
||||
if (dropZone) {
|
||||
@@ -1112,14 +1351,39 @@ export const comfyEditor = {
|
||||
if (e.dataTransfer.files.length > 0) applyFile(e.dataTransfer.files[0]);
|
||||
});
|
||||
}
|
||||
if (maskDropZone) {
|
||||
maskDropZone.addEventListener("dragover", (e) => {
|
||||
e.preventDefault();
|
||||
maskDropZone.classList.add("drag-over");
|
||||
});
|
||||
maskDropZone.addEventListener("dragleave", () => {
|
||||
maskDropZone.classList.remove("drag-over");
|
||||
});
|
||||
maskDropZone.addEventListener("drop", (e) => {
|
||||
e.preventDefault();
|
||||
maskDropZone.classList.remove("drag-over");
|
||||
if (e.dataTransfer.files.length > 0) applyMaskFile(e.dataTransfer.files[0]);
|
||||
});
|
||||
}
|
||||
|
||||
// Apply button: upload to ComfyUI and set on node
|
||||
// (マスクが指定されている場合は画像+マスクをRGBA合成して1枚のPNGとしてアップロードする)
|
||||
applyBtn?.addEventListener("click", async () => {
|
||||
if (!pendingFile) return;
|
||||
if (!pendingFile && !pendingMaskFile) return;
|
||||
applyBtn.disabled = true;
|
||||
statusEl.textContent = "Uploading...";
|
||||
try {
|
||||
const result = await comfyUI.uploadImage(pendingFile, pendingFile.name);
|
||||
let result;
|
||||
if (pendingMaskFile) {
|
||||
const baseImage = pendingFile || previewImg.src;
|
||||
if (!baseImage) throw new Error("No base image to apply mask to");
|
||||
const composedBlob = await _compositeImageWithMask(baseImage, pendingMaskFile);
|
||||
const fileName = (pendingFile?.name || node.image || "inpaint.png").replace(/\.[^.]+$/, "") + "_masked.png";
|
||||
const composedFile = new File([composedBlob], fileName, { type: "image/png" });
|
||||
result = await comfyUI.uploadImage(composedFile, fileName);
|
||||
} else {
|
||||
result = await comfyUI.uploadImage(pendingFile, pendingFile.name);
|
||||
}
|
||||
if (result.name) {
|
||||
// Update workflow node
|
||||
if (comfyUI.currentWorkflow?.[node.id]) {
|
||||
@@ -1139,6 +1403,76 @@ export const comfyEditor = {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Initialize each Mask Editor One slot(画像+マスク両方が揃って初めてApply可能)
|
||||
meoSlots.forEach((node, i) => {
|
||||
const fileInput = document.getElementById(`wfm-meo-file-${i}`);
|
||||
const maskFileInput = document.getElementById(`wfm-meo-mask-file-${i}`);
|
||||
const dropZone = document.getElementById(`wfm-meo-drop-${i}`);
|
||||
const maskDropZone = document.getElementById(`wfm-meo-mask-drop-${i}`);
|
||||
const previewWrap = document.getElementById(`wfm-meo-preview-wrap-${i}`);
|
||||
const previewImg = document.getElementById(`wfm-meo-preview-${i}`);
|
||||
const maskPreviewWrap = document.getElementById(`wfm-meo-mask-preview-wrap-${i}`);
|
||||
const maskPreviewImg = document.getElementById(`wfm-meo-mask-preview-${i}`);
|
||||
const maskFilenameEl = document.getElementById(`wfm-meo-mask-filename-${i}`);
|
||||
const applyBtn = el.querySelector(`.wfm-meo-apply[data-slot="${i}"]`);
|
||||
const statusEl = document.getElementById(`wfm-meo-status-${i}`);
|
||||
let pendingFile = null;
|
||||
let pendingMaskFile = null;
|
||||
|
||||
const updateApplyEnabled = () => { applyBtn.disabled = !(pendingFile && pendingMaskFile); };
|
||||
|
||||
const applyFile = (file) => {
|
||||
if (!file || !file.type.startsWith("image/")) return;
|
||||
pendingFile = file;
|
||||
previewImg.src = URL.createObjectURL(file);
|
||||
previewWrap.style.display = "";
|
||||
statusEl.textContent = "";
|
||||
updateApplyEnabled();
|
||||
};
|
||||
const applyMaskFile = (file) => {
|
||||
if (!file || !file.type.startsWith("image/")) return;
|
||||
pendingMaskFile = file;
|
||||
maskPreviewImg.src = URL.createObjectURL(file);
|
||||
maskPreviewWrap.style.display = "";
|
||||
maskFilenameEl.textContent = file.name;
|
||||
statusEl.textContent = "";
|
||||
updateApplyEnabled();
|
||||
};
|
||||
|
||||
fileInput?.addEventListener("change", () => {
|
||||
if (fileInput.files.length > 0) applyFile(fileInput.files[0]);
|
||||
});
|
||||
maskFileInput?.addEventListener("change", () => {
|
||||
if (maskFileInput.files.length > 0) applyMaskFile(maskFileInput.files[0]);
|
||||
});
|
||||
|
||||
[[dropZone, applyFile], [maskDropZone, applyMaskFile]].forEach(([zone, handler]) => {
|
||||
if (!zone) return;
|
||||
zone.addEventListener("dragover", (e) => { e.preventDefault(); zone.classList.add("drag-over"); });
|
||||
zone.addEventListener("dragleave", () => zone.classList.remove("drag-over"));
|
||||
zone.addEventListener("drop", (e) => {
|
||||
e.preventDefault();
|
||||
zone.classList.remove("drag-over");
|
||||
if (e.dataTransfer.files.length > 0) handler(e.dataTransfer.files[0]);
|
||||
});
|
||||
});
|
||||
|
||||
applyBtn?.addEventListener("click", async () => {
|
||||
if (!pendingFile || !pendingMaskFile) return;
|
||||
applyBtn.disabled = true;
|
||||
statusEl.textContent = "Uploading...";
|
||||
try {
|
||||
await this.applyImageAndMaskToMaskEditorOneNode(pendingFile, pendingMaskFile, node.id);
|
||||
statusEl.textContent = "✓ Applied";
|
||||
statusEl.style.color = "var(--wfm-success)";
|
||||
} catch (err) {
|
||||
statusEl.textContent = `✗ ${err.message}`;
|
||||
statusEl.style.color = "var(--wfm-danger)";
|
||||
applyBtn.disabled = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
async applyImageToSlot(file, slotIndex = 0) {
|
||||
@@ -1171,6 +1505,113 @@ export const comfyEditor = {
|
||||
return result.name;
|
||||
},
|
||||
|
||||
// imageInput/maskInput: File/Blob いずれも可。マスクは白=インペイント対象領域のグレースケール想定。
|
||||
// 画像とマスクをRGBA合成し、1枚のPNGとして対象LoadImageノードへアップロードする
|
||||
// (ComfyUIネイティブのアルファ→MASK抽出に準拠。Image Edit「Inpaint」タブのRunボタンから利用)。
|
||||
// opts.workflow/opts.analysis を渡すと、comfyUI.currentWorkflow/currentAnalysis の代わりに
|
||||
// そのワークフローへ書き込む(GenerateUIタブの表示・DOM更新は行わない。専用ワークフロー実行用)。
|
||||
async applyImageAndMaskToSlot(imageInput, maskInput, slotIndex = 0, opts = {}) {
|
||||
const workflow = opts.workflow || comfyUI.currentWorkflow;
|
||||
const analysis = opts.analysis || comfyUI.currentAnalysis;
|
||||
const loadNodes = analysis?.load_image_nodes || [];
|
||||
const node = loadNodes[slotIndex];
|
||||
if (!node) throw new Error("No LoadImage node at slot " + slotIndex);
|
||||
|
||||
const composedBlob = await _compositeImageWithMask(imageInput, maskInput);
|
||||
const fileName = `inpaint_${Math.random().toString(36).slice(2, 10)}.png`;
|
||||
const composedFile = new File([composedBlob], fileName, { type: "image/png" });
|
||||
|
||||
const result = await comfyUI.uploadImage(composedFile, fileName);
|
||||
if (!result.name) throw new Error("Upload returned no filename");
|
||||
|
||||
if (workflow?.[node.id]) {
|
||||
workflow[node.id].inputs.image = result.name;
|
||||
}
|
||||
|
||||
if (opts.workflow) return result.name;
|
||||
|
||||
const previewWrap = document.getElementById(`wfm-i2i-preview-wrap-${slotIndex}`);
|
||||
const previewImg = document.getElementById(`wfm-i2i-preview-${slotIndex}`);
|
||||
const filenameEl = document.getElementById(`wfm-i2i-filename-${slotIndex}`);
|
||||
const statusEl = document.getElementById(`wfm-i2i-status-${slotIndex}`);
|
||||
const applyBtn = document.querySelector(`.wfm-i2i-apply[data-slot="${slotIndex}"]`);
|
||||
|
||||
if (previewImg) {
|
||||
previewImg.src = `/view?filename=${encodeURIComponent(result.name)}&type=input`;
|
||||
if (previewWrap) previewWrap.style.display = "";
|
||||
}
|
||||
if (filenameEl) filenameEl.textContent = result.name;
|
||||
if (statusEl) { statusEl.textContent = `✓ ${result.name}`; statusEl.style.color = "var(--wfm-success)"; }
|
||||
if (applyBtn) applyBtn.disabled = true;
|
||||
|
||||
_syncRawJson();
|
||||
return result.name;
|
||||
},
|
||||
|
||||
// imageInput/maskInput: File/Blob いずれも可。マスクは白=インペイント対象領域のグレースケール想定。
|
||||
// Mask Editor One (comfyui-mask-editor-one) ノード向け。画像はサーバー側キャッシュへ
|
||||
// /mask_editor/store_image でPOSHし(node_idキー、bg_image_b64)、マスクは layer_data
|
||||
// ウィジェットへ「アルファチャンネル=mask値」のレイヤーとして書き込む。
|
||||
// opts.workflow を渡すと comfyUI.currentWorkflow の代わりにそのワークフローへ書き込む。
|
||||
async applyImageAndMaskToMaskEditorOneNode(imageInput, maskInput, nodeId, opts = {}) {
|
||||
const workflow = opts.workflow || comfyUI.currentWorkflow;
|
||||
const bgDataUrl = await _imageInputToDataURL(imageInput);
|
||||
const maskDataUrl = await _maskInputToAlphaDataURL(maskInput);
|
||||
|
||||
const resp = await fetch(`${comfyUI.baseUrl}/mask_editor/store_image`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ node_id: String(nodeId), bg_image_b64: bgDataUrl }),
|
||||
});
|
||||
if (!resp.ok) throw new Error(`Failed to store image for Mask Editor One (node ${nodeId})`);
|
||||
|
||||
if (workflow?.[nodeId]) {
|
||||
workflow[nodeId].inputs.layer_data = JSON.stringify({
|
||||
layers: [{ visible: true, opacity: 1, operation: "add", imageData: maskDataUrl }],
|
||||
});
|
||||
}
|
||||
|
||||
if (!opts.workflow) _syncRawJson();
|
||||
},
|
||||
|
||||
// Inpaint Run から呼ばれるポジ/ネガプロンプト設定。
|
||||
// opts.workflow/opts.analysis を渡すと、GenerateUIタブの選択中ターゲット(DOM)に依存せず、
|
||||
// そのワークフロー内の最初の該当role prompt_nodeへ直接反映する(専用ワークフロー実行用)。
|
||||
setPromptText(role, text, opts = {}) {
|
||||
if (opts.workflow && opts.analysis) {
|
||||
const node = (opts.analysis.prompt_nodes || []).find((n) => n.role === role);
|
||||
if (node && opts.workflow[node.id]) {
|
||||
opts.workflow[node.id].inputs[node.textKey || "text"] = text;
|
||||
}
|
||||
return;
|
||||
}
|
||||
const textareaId = role === "positive" ? "wfm-prompt-pos-text" : "wfm-prompt-neg-text";
|
||||
const textarea = document.getElementById(textareaId);
|
||||
if (textarea) textarea.value = text;
|
||||
this.syncToWorkflow();
|
||||
_syncRawJson();
|
||||
},
|
||||
|
||||
// Inpaint Run から呼ばれる grow_mask_by / denoise 設定。
|
||||
// ワークフロー内の最初の VAEEncodeForInpaint ノード / denoise を持つ最初の sampler ノードへ反映する
|
||||
// (複数のインペイントパイプラインが同一ワークフローに存在するケースは現状非対応)。
|
||||
// workflow/analysis を渡すと comfyUI.currentWorkflow/currentAnalysis の代わりにそちらへ書き込む。
|
||||
setInpaintParams({ growMaskBy, denoise, workflow, analysis } = {}) {
|
||||
const wf = workflow || comfyUI.currentWorkflow;
|
||||
const an = analysis || comfyUI.currentAnalysis;
|
||||
const encodeNode = an?.inpaint_encode_nodes?.[0];
|
||||
if (encodeNode && growMaskBy != null && wf?.[encodeNode.id]) {
|
||||
wf[encodeNode.id].inputs.grow_mask_by = growMaskBy;
|
||||
}
|
||||
|
||||
const samplerNode = (an?.sampler_nodes || []).find((n) => n.denoise !== undefined);
|
||||
if (samplerNode && denoise != null && wf?.[samplerNode.id]) {
|
||||
wf[samplerNode.id].inputs.denoise = denoise;
|
||||
}
|
||||
|
||||
if (!workflow) _syncRawJson();
|
||||
},
|
||||
|
||||
syncToWorkflow() {
|
||||
// Sync prompt texts before generation
|
||||
const posSelect = document.getElementById("wfm-prompt-pos-target");
|
||||
|
||||
@@ -487,6 +487,8 @@ export const comfyWorkflow = {
|
||||
vae_nodes: [],
|
||||
save_nodes: [],
|
||||
load_image_nodes: [],
|
||||
inpaint_encode_nodes: [],
|
||||
mask_editor_one_nodes: [],
|
||||
text_encoder_nodes: [],
|
||||
diffusion_model_nodes: [],
|
||||
controlnet_nodes: [],
|
||||
@@ -809,6 +811,22 @@ export const comfyWorkflow = {
|
||||
});
|
||||
}
|
||||
|
||||
// --- VAE Encode (for Inpainting) nodes ---
|
||||
if (ct === "VAEEncodeForInpaint") {
|
||||
result.inpaint_encode_nodes.push({
|
||||
id, type: ct, title,
|
||||
grow_mask_by: inputs.grow_mask_by,
|
||||
});
|
||||
}
|
||||
|
||||
// --- Mask Editor One nodes (comfyui-mask-editor-one) ---
|
||||
// 画像とマスクをノード自身が内包する(LoadImageを介さない)インペイント画像ソース。
|
||||
// image出力はサーバー側キャッシュ(bg_image_b64、node_idキー)から、mask出力は
|
||||
// layer_data(JSON文字列)ウィジェットの各レイヤーのアルファチャンネルから合成される。
|
||||
if (ct === "MaskEditorOne") {
|
||||
result.mask_editor_one_nodes.push({ id, type: ct, title });
|
||||
}
|
||||
|
||||
// --- Text encoder (CLIP) nodes ---
|
||||
if (ct === "DualCLIPLoader" || ct === "CLIPLoader" || ct === "ClipLoaderGGUF" || ct === "DualClipLoaderGGUF") {
|
||||
result.text_encoder_nodes.push({
|
||||
@@ -850,6 +868,24 @@ export const comfyWorkflow = {
|
||||
}
|
||||
}
|
||||
|
||||
// --- Post-pass: flag LoadImage nodes whose MASK output (slot 1) is wired to something
|
||||
// downstream (directly, or via a pass-through node like MaskEditorNode). These are the
|
||||
// "inpaint-capable" slots — image + mask both come from the same node's two outputs, so
|
||||
// painting a mask for them only requires re-uploading that one node's image with the mask
|
||||
// baked into the alpha channel (matches ComfyUI's native LoadImage alpha→MASK extraction). ---
|
||||
const loadImageIds = new Set(result.load_image_nodes.filter(n => n.type === "LoadImage").map(n => n.id));
|
||||
if (loadImageIds.size > 0) {
|
||||
for (const node of Object.values(workflow)) {
|
||||
if (!node?.inputs) continue;
|
||||
for (const v of Object.values(node.inputs)) {
|
||||
if (Array.isArray(v) && v.length === 2 && Number(v[1]) === 1 && loadImageIds.has(String(v[0]))) {
|
||||
const target = result.load_image_nodes.find(n => n.id === String(v[0]));
|
||||
if (target) target.mask_used = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result.all_nodes.sort((a, b) => Number(a.id) - Number(b.id));
|
||||
return result;
|
||||
},
|
||||
|
||||
@@ -43,6 +43,43 @@ const API = {
|
||||
|
||||
export const FEEDER_GROUP = "__Feeder__";
|
||||
|
||||
// ComfyUI Comic Creater からiframe越しに画像を受け取り、Generate UIのImage入力スロットへ直接セットする(I2I連携)。
|
||||
// Comic Creater側の「I2Iへ送る」ボタンから
|
||||
// iframe.contentWindow._wfmReceiveImageForI2I(blob, name, workflowData?, workflowFilename?) として呼ばれる。
|
||||
// 画像スロットへのセット自体は wfm-gallery-send-genui-image-btn のクリックハンドラ(Galleryの選択画像を送る版)と同一。
|
||||
// workflowData が渡された場合(Comic Creater側の設定タブでデフォルトワークフローが有効な時)は、
|
||||
// 画像をセットする前にそのワークフローを読み込む。
|
||||
window._wfmReceiveImageForI2I = async (blob, name, workflowData, workflowFilename) => {
|
||||
try {
|
||||
if (workflowData) {
|
||||
try {
|
||||
// iframeロード直後などモデルリスト未取得のままワークフローを読み込むと、
|
||||
// Model/生成UIタブのCheckpoint等ドロップダウンが空のままレンダリングされてしまう。
|
||||
// 接続確認・モデルリスト取得を保証してからワークフローを読み込む
|
||||
if (!comfyUI.connected) {
|
||||
await comfyUI.checkConnection();
|
||||
}
|
||||
if (comfyUI.connected && (!comfyEditor.models.checkpoints || comfyEditor.models.checkpoints.length === 0)) {
|
||||
await comfyEditor.loadModelLists();
|
||||
}
|
||||
await loadWorkflowIntoEditor(workflowData, workflowFilename || "workflow.json");
|
||||
} catch (e) {
|
||||
console.warn("[I2I] failed to load default workflow:", e);
|
||||
}
|
||||
}
|
||||
const file = new File([blob], name || "cc-image.png", { type: blob.type || "image/png" });
|
||||
document.querySelector('[data-tab="generate"]')?.click();
|
||||
document.querySelector('.wfm-gen-subtab-btn[data-subtab="input"]')?.click();
|
||||
document.querySelector('.wfm-input-inner-tab[data-input-tab="image"]')?.click();
|
||||
await comfyEditor.applyImageToSlot(file, 0);
|
||||
showToast(t("gallerySentGenUI"), "success");
|
||||
return true;
|
||||
} catch (e) {
|
||||
showToast(t("errorWithMsg", e.message), "error");
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// ── ページング ────────────────────────────────────────────────
|
||||
const PAGE_SIZE = 50;
|
||||
let _renderedCount = 0;
|
||||
@@ -1523,6 +1560,34 @@ function bindEvents() {
|
||||
showToast(t("gallerySelectImageFirst"), "info");
|
||||
return;
|
||||
}
|
||||
const url = API.serveImage(state.selectedImage.path);
|
||||
|
||||
// I2I送信元がImageタブだった場合はそちらへ画像を読み込ませる(_ccI2ITargetModeはComic Creater側が
|
||||
// 「I2Iへ送る」ボタン押下時にセットするフラグ。undefined/'layout'なら従来通りコマ/オーバーレイへ挿入)
|
||||
let targetMode = null;
|
||||
try {
|
||||
targetMode = window.parent?._ccI2ITargetMode || null;
|
||||
} catch (e) {
|
||||
targetMode = null;
|
||||
}
|
||||
if (targetMode === "image") {
|
||||
let imageTab = null;
|
||||
try {
|
||||
if (window.parent && window.parent !== window && typeof window.parent._ccImageTab?.loadFromUrl === "function") {
|
||||
imageTab = window.parent._ccImageTab;
|
||||
}
|
||||
} catch (e) {
|
||||
imageTab = null;
|
||||
}
|
||||
if (!imageTab) {
|
||||
showToast(t("galleryCCNotAvailable"), "info");
|
||||
return;
|
||||
}
|
||||
imageTab.loadFromUrl(url, (state.selectedImage.filename || "cc-image").replace(/\.[^.]+$/, ""));
|
||||
showToast(t("gallerySentCC"), "success");
|
||||
return;
|
||||
}
|
||||
|
||||
let insertFn = null;
|
||||
try {
|
||||
if (window.parent && window.parent !== window && typeof window.parent.insertImageFromUrl === "function") {
|
||||
@@ -1535,7 +1600,7 @@ function bindEvents() {
|
||||
showToast(t("galleryCCNotAvailable"), "info");
|
||||
return;
|
||||
}
|
||||
insertFn(API.serveImage(state.selectedImage.path));
|
||||
insertFn(url);
|
||||
showToast(t("gallerySentCC"), "success");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1397,7 +1397,7 @@ async function _expandWildcardsInWorkflow(workflow) {
|
||||
// Generation (core — throws on error)
|
||||
// ============================================
|
||||
|
||||
async function _coreGenerate(silent = false) {
|
||||
async function _coreGenerate(silent = false, workflowOverride = null) {
|
||||
const progressBar = document.getElementById("wfm-gen-progress-bar");
|
||||
const progressText = document.getElementById("wfm-gen-progress-text");
|
||||
const resultImg = document.getElementById("wfm-gen-result-img");
|
||||
@@ -1409,7 +1409,8 @@ async function _coreGenerate(silent = false) {
|
||||
if (progressBar) progressBar.style.width = "0%";
|
||||
if (progressText) progressText.textContent = "Starting...";
|
||||
|
||||
const workflowExpanded = await _expandWildcardsInWorkflow({ ...comfyUI.currentWorkflow });
|
||||
const baseWorkflow = workflowOverride || comfyUI.currentWorkflow;
|
||||
const workflowExpanded = await _expandWildcardsInWorkflow({ ...baseWorkflow });
|
||||
const workflowForGenerate = _applyStyleToWorkflow(workflowExpanded);
|
||||
const { images, seed } = await comfyUI.generate(
|
||||
workflowForGenerate,
|
||||
@@ -1463,7 +1464,7 @@ async function _coreGenerate(silent = false) {
|
||||
}
|
||||
|
||||
if (images.length > 0) {
|
||||
saveGeneratedImagesMeta(images, { ...comfyUI.currentWorkflow }).catch(() => {});
|
||||
saveGeneratedImagesMeta(images, { ...baseWorkflow }).catch(() => {});
|
||||
}
|
||||
|
||||
if (!silent) showToast(t("generationComplete"), "success");
|
||||
@@ -1729,14 +1730,20 @@ async function _runBatchGenerate() {
|
||||
// Generate entry point
|
||||
// ============================================
|
||||
|
||||
async function handleGenerate() {
|
||||
if (!comfyUI.currentWorkflow) {
|
||||
// workflowOverride: 明示的に渡された場合、comfyUI.currentWorkflow の代わりにこのワークフローで
|
||||
// 生成する(GenerateUIの表示状態には触れない。Image Edit「Inpaint」の専用ワークフロー実行から利用)。
|
||||
// ボタンのclickハンドラから呼ばれる場合は第一引数がMouseEventになるため、その場合は無視する。
|
||||
async function handleGenerate(workflowOverride = null) {
|
||||
if (workflowOverride instanceof Event) workflowOverride = null;
|
||||
|
||||
if (!workflowOverride && !comfyUI.currentWorkflow) {
|
||||
showToast(t("noWorkflowLoaded"), "error");
|
||||
return;
|
||||
}
|
||||
if (comfyUI.generating) return;
|
||||
|
||||
comfyEditor.syncToWorkflow();
|
||||
// オーバーライド実行時は GenerateUI 側の表示中プロンプトを別ワークフローへ誤って書き込まないよう同期をスキップする
|
||||
if (!workflowOverride) comfyEditor.syncToWorkflow();
|
||||
|
||||
const genBtn = document.getElementById("wfm-gen-generate-btn");
|
||||
const interruptBtn = document.getElementById("wfm-gen-interrupt-btn");
|
||||
@@ -1747,18 +1754,20 @@ async function handleGenerate() {
|
||||
_ckptBatch.paused = false;
|
||||
_ckptBatch._resumeResolve = null;
|
||||
|
||||
const batchEnabled = _activeBatchType !== null;
|
||||
// オーバーライド実行時はバッチモードの影響を受けない単発生成に固定する
|
||||
const batchEnabled = !workflowOverride && _activeBatchType !== null;
|
||||
|
||||
try {
|
||||
if (batchEnabled) {
|
||||
await _runBatchGenerate();
|
||||
} else {
|
||||
try {
|
||||
await _coreGenerate(false);
|
||||
await _coreGenerate(false, workflowOverride);
|
||||
} catch (err) {
|
||||
const progressText = document.getElementById("wfm-gen-progress-text");
|
||||
if (progressText) progressText.textContent = "Error";
|
||||
showToast(t("generationError", err.message), "error");
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
@@ -1819,7 +1828,12 @@ export async function initGenerateTab() {
|
||||
});
|
||||
|
||||
// Generate button
|
||||
document.getElementById("wfm-gen-generate-btn")?.addEventListener("click", handleGenerate);
|
||||
document.getElementById("wfm-gen-generate-btn")?.addEventListener("click", () => {
|
||||
handleGenerate().catch(() => {});
|
||||
});
|
||||
|
||||
// Cross-tab entry point (Image Edit「Inpaint」タブの Run ボタンなど外部から生成を呼び出す用)
|
||||
window._wfmGenerateTab = { generate: handleGenerate };
|
||||
|
||||
// Alt+Apply from Input/Model/Settings tabs → Apply & Generate
|
||||
document.addEventListener("wfm:apply-and-generate", () => handleGenerate());
|
||||
|
||||
+18
-9
@@ -116,6 +116,7 @@ const LANGUAGES = {
|
||||
deleteConfirm: (name) => `Delete "${name}"?`,
|
||||
summaryGenerated: "Summary generated",
|
||||
summarizeError: "Summarize error",
|
||||
summarizeOllamaOnly: "Summarize only supports the Ollama backend. Switch backend in Settings.",
|
||||
copied: "Copied",
|
||||
|
||||
// -- GenerateUI --
|
||||
@@ -356,6 +357,7 @@ const LANGUAGES = {
|
||||
modelsGenUIUnsupported: "This model type cannot be set in GenerateUI",
|
||||
modelsGenUINoWorkflow: "No workflow loaded in GenerateUI",
|
||||
modelsGenUINoNode: (type) => `No ${type} node found in current workflow`,
|
||||
revertPromptTitle: "Revert to last applied prompt",
|
||||
modelsCopyName: "Click to copy model name",
|
||||
modelsCopiedName: "Model name copied",
|
||||
modelsFilePath: "File Path",
|
||||
@@ -618,7 +620,7 @@ const LANGUAGES = {
|
||||
helpGen1: "Connect/disconnect ComfyUI and check connection status",
|
||||
helpGen2: "Load workflows from Workflow tab (App format .app.json not supported); Reset Workflow button re-reads the current workflow file from disk and reloads the editor; Save button (right end of the tab bar) saves the current workflow — including any edits made in the editor — as a new .json file to the Workflow tab; a filename dialog appears with the current workflow name as the default",
|
||||
helpGen3: "5-tab layout — Input (Prompt + Image), Model, Settings, Feeder, Batch — Input/Model/Settings each include a Raw JSON column for instant preview and direct editing",
|
||||
helpGen4: "Input tab: inner tabs — Prompt and Image (drag-and-drop upload); Prompt tab has Positive Prompt, Negative Prompt, and an Embeddings selector at the bottom — select a model, set Weight (default 1.0), then click Paste to insert (embedding:Name:weight) at the cursor position of the last focused textarea (defaults to Positive if neither is focused)",
|
||||
helpGen4: "Input tab: inner tabs — Prompt and Image (drag-and-drop upload); Prompt tab has Positive Prompt, Negative Prompt, and an Embeddings selector at the bottom — select a model, set Weight (default 1.0), then click Paste to insert (embedding:Name:weight) at the cursor position of the last focused textarea (defaults to Positive if neither is focused); a ↺ button next to each Apply button reverts the textarea to the node's currently applied value; select text (or just place the cursor on a word/parenthesis block) and press Ctrl+↑/↓ to adjust its emphasis weight in (text:weight) syntax by ±0.05 — the parentheses are removed automatically when the weight returns to 1.0",
|
||||
helpGen5: "Model tab: Checkpoint, VAE, LoRA (Single/Stack tabs), ControlNet, Diffusion Model (UNETLoader / UnetLoaderGGUF / LoaderGGUF), Text Encoder (CLIPLoader / DualCLIPLoader / ClipLoaderGGUF / DualClipLoaderGGUF — type and device selectors; DualCLIP shows two clip selectors), Hypernetwork (with Strength field) selectors with filter",
|
||||
helpGen6: "Settings tab: KSampler and Latent Image side by side, each at 50% width",
|
||||
helpGen7: "Raw JSON always visible in the right column of each tab — edit directly and Apply to reload the workflow",
|
||||
@@ -756,7 +758,7 @@ const LANGUAGES = {
|
||||
helpImageEditTitle: "Image Edit Tab",
|
||||
helpImageEdit1: "Layer-based image editor — compose images with multiple layers (Image, Text, Draw, Mask types) and export the composite",
|
||||
helpImageEdit2: "Loading images: drag & drop onto the canvas, Upload button, or send from the Gallery tab via the Image Edit button in the Gallery toolbar; the first image becomes Layer 1 (auto-locked); subsequent images are added as new layers scaled to fit the canvas",
|
||||
helpImageEdit3: "New button: create a blank canvas — prompts for WxH size (e.g. 512x768); clears all existing layers",
|
||||
helpImageEdit3: "New button: create a blank canvas — prompts for WxH size (e.g. 512x768); clears all existing layers and automatically adds an empty Layer 1",
|
||||
helpImageEditToolsTitle: "Tools",
|
||||
helpImageEdit4: "Select (V): click to select a layer; drag to move; drag corner handles to resize; drag the circle above the top edge to rotate; double-click a text layer to re-edit its content; Tool Options bar shows Flip H / Flip V / Rotate field",
|
||||
helpImageEdit5: "Draw (B): freehand brush drawing onto the active draw layer; Tool Options: color, brush size, blend mode; Properties pane includes a MASK EDITOR ONE (COLOR) section for ABR image brushes — always visible, header text is green when brushes are available, gray when none are imported yet; Select is disabled until at least one brush exists",
|
||||
@@ -792,12 +794,13 @@ const LANGUAGES = {
|
||||
helpImageEdit7b: "Blur (≈): apply Gaussian blur or mosaic to the active layer — whole-layer or region-based (drag a rectangle); see the Blur Tool card below for details",
|
||||
helpImageEdit7c: "BG Remove (⬚): remove the background from the active layer using Lightweight (@imgly, runs in browser) or BiRefNet (requires Mask Editor One + birefnet.safetensors in ComfyUI/models/background_removal/); see the BG Remove Tool card below for details",
|
||||
helpImageEdit7d: "Mask (🎭): paint masks on a mask layer using 6 sub-tools — Paint (freehand), Color (flood-select by similar color), Alpha (extract from image transparency), Text (stamp text), Vector (Catmull-Rom spline polygon), Shape (rect / ellipse); SAM3 text-prompt segmentation is also available when Mask Editor One is installed; click \"M\" in the Layers header to add a mask layer; see the Mask Tool card below for details",
|
||||
helpImageEdit7e: "Inpaint (🩹): composites the visible layers plus a Mask layer into one RGBA image (mask baked into the alpha channel) and applies it to the first inpaint-capable LoadImage node in the workflow currently loaded in GenerateUI (a node whose MASK output feeds something like VAEEncodeForInpaint); enter Positive/Negative prompts, Grow Mask By (applied to the VAE Encode (for Inpainting) node), and Denoise (applied to KSampler) in the properties panel, then click Run to upload and generate without leaving the Image Edit tab — the result is shown back in the properties panel when done; requires a Mask layer to be painted first and an inpaint-capable workflow loaded in GenerateUI; also works with workflows built around the Mask Editor One custom node (comfyui-mask-editor-one) instead of LoadImage — image/mask are pushed to it via its node_id-keyed server cache and layer_data widget; \"Use dedicated workflow\" checkbox: when off, the workflow currently loaded in GenerateUI is used (unchanged); when on, pick a saved workflow from the dropdown — it is loaded, edited, and generated entirely in the background without disturbing the workflow shown in GenerateUI",
|
||||
helpImageEdit8b: "\"M\" button in the Layers header: adds a new mask layer above the current layer and automatically switches to the Mask tool",
|
||||
helpImageEdit12: "Type icons: 🖼 = image layer, T = text layer, ✏ = draw layer, ⬚ = mask layer",
|
||||
helpImageEditMaskTitle: "Mask Tool (🎭)",
|
||||
helpImageEditMask1: "Add a mask layer: click the \"M\" button in the Layers panel header; the new mask layer is inserted above the active layer and the Mask tool activates automatically",
|
||||
helpImageEditMask2: "Clicking a mask layer in the layer list automatically switches to the Mask tool",
|
||||
helpImageEditMask3: "Tool Options bar — sub-tools: Paint / Color / Alpha / Text / Vector / Shape (all work without Mask Editor One) / SAM3 (requires Mask Editor One, disabled if not installed); Invert checkbox inverts the overlay preview; Overlay color picker changes the preview color (default red); Blur slider (0–50 px) softens the overlay edge",
|
||||
helpImageEditMask3: "Tool Options bar — sub-tools: Paint / Color / Alpha / Text / Vector / Shape (all work without Mask Editor One) / SAM3 (requires Mask Editor One, disabled if not installed); Invert checkbox inverts the overlay preview; Overlay color picker changes the preview color (default red); Blur slider (0–50 px) softens the overlay edge; the overlay is only shown for the currently active mask layer — inactive mask layers stay hidden until selected",
|
||||
helpImageEditMask4: "Properties pane — Paint mode: Mode (Add / Erase), Size (1–200 px), Hardness (0–100%); MASK EDITOR ONE section (always visible — header text is green when ABR brushes are available, gray when none are imported yet): Select button opens the ABR brush library (disabled until at least one brush exists) — choosing a brush replaces the default circle brush; ✕ clears the brush back to Circle; when an image brush is active, Hardness is disabled and additional controls appear: Spacing (stamp interval 5–100%), Angle (rotation 0–359°), Sz Jitter (random size reduction per stamp 0–100%), Rot. Jitter (random rotation per stamp on/off)",
|
||||
helpImageEditMask5: "✂ button on a mask layer row: toggles the layer as a clipping mask — when enabled (blue), the mask clips the layer directly below it so only the painted area is visible; clipping is applied when saving PNG / Gallery / ComfyUI",
|
||||
helpImageEditMask6: "SAM3 (Mask Editor One required): text-prompt segmentation powered by the SAM3 model; enter a description of the object to segment (e.g. \"cat\", \"person\"), set Max (maximum mask candidates: 3/6/9/12), then click Segment",
|
||||
@@ -1097,6 +1100,7 @@ const LANGUAGES = {
|
||||
deleteConfirm: (name) => `"${name}" を削除しますか?`,
|
||||
summaryGenerated: "要約を生成しました",
|
||||
summarizeError: "要約エラー",
|
||||
summarizeOllamaOnly: "要約機能はOllamaバックエンドのみ対応しています。設定でバックエンドを切り替えてください。",
|
||||
copied: "コピーしました",
|
||||
|
||||
// -- GenerateUI --
|
||||
@@ -1337,6 +1341,7 @@ const LANGUAGES = {
|
||||
modelsGenUIUnsupported: "このモデルタイプはGenerateUIに設定できません",
|
||||
modelsGenUINoWorkflow: "GenerateUIにワークフローが読み込まれていません",
|
||||
modelsGenUINoNode: (type) => `現在のワークフローに${type}ノードが見つかりません`,
|
||||
revertPromptTitle: "直前にApplyしたプロンプトに戻す",
|
||||
modelsCopyName: "クリックでモデル名をコピー",
|
||||
modelsCopiedName: "モデル名をコピーしました",
|
||||
modelsFilePath: "ファイルパス",
|
||||
@@ -1599,7 +1604,7 @@ const LANGUAGES = {
|
||||
helpGen1: "ComfyUIの接続・切断、接続状態の確認",
|
||||
helpGen2: "Workflowタブからワークフローを読み込み(App形式 .app.json は非対応)。Reset Workflowボタンは現在のワークフローファイルをディスクから再読込してエディタをリロード。Saveボタン(タブバー右端)はエディタでの編集を含む現在のワークフローを新しい.jsonファイルとしてWorkflowタブに保存(現在のワークフロー名を初期値としたファイル名ダイアログを表示)",
|
||||
helpGen3: "5タブ構成 — Input(プロンプト+画像)、Model、Settings、Feeder、Batch — Input/Model/SettingsタブにはRaw JSON列を常時表示",
|
||||
helpGen4: "Inputタブ:Prompt・Imageの内部タブ切り替え;PromptタブにはPositive Prompt・Negative Promptに加え最下部にEmbeddingsセレクタを表示(Filter+セレクト+Weight入力+Pasteボタン)— Pasteは最後にフォーカスしたテキストエリアのカーソル位置に(embedding:Name:weight)を挿入(未フォーカス時はPositiveに追加)",
|
||||
helpGen4: "Inputタブ:Prompt・Imageの内部タブ切り替え;PromptタブにはPositive Prompt・Negative Promptに加え最下部にEmbeddingsセレクタを表示(Filter+セレクト+Weight入力+Pasteボタン)— Pasteは最後にフォーカスしたテキストエリアのカーソル位置に(embedding:Name:weight)を挿入(未フォーカス時はPositiveに追加);各Applyボタンの左隣の↺ボタンはテキストエリアをノードの現在の適用値に戻す;テキストを選択(または単語・括弧内にカーソルを置くだけでも可)してCtrl+↑/↓を押すと(text:weight)形式で強調weightを±0.05単位で調整(weightが1.0に戻ると括弧を自動解除)",
|
||||
helpGen5: "Modelタブ:Checkpoint/VAE/LoRA(Single/Stackタブ)/ControlNet/Diffusion Model(UNETLoader / UnetLoaderGGUF / LoaderGGUF対応)/Text Encoder(CLIPLoader / DualCLIPLoader / ClipLoaderGGUF / DualClipLoaderGGUF対応 — typeおよびdevice選択付き、DualCLIPは2段モデル選択)/Hypernetwork(Strength入力付き)のセレクタ(フィルタ検索付き)",
|
||||
helpGen6: "Settingsタブ:KSamplerとLatent Imageを横並び(各50%幅)",
|
||||
helpGen7: "Raw JSONを各タブの右列に常時表示 — 直接編集してApplyでワークフロー即時反映",
|
||||
@@ -1737,7 +1742,7 @@ const LANGUAGES = {
|
||||
helpImageEditTitle: "Image Edit タブ",
|
||||
helpImageEdit1: "レイヤーベースの画像エディタ — 複数のレイヤー(画像・テキスト・描画・マスク)を重ね合わせて画像を合成・エクスポート",
|
||||
helpImageEdit2: "画像の読み込み:キャンバスへのドラッグ&ドロップ、Uploadボタン、またはGalleryタブのImage Editボタンから送信;最初の画像はLayer 1として自動ロック;以降の画像はキャンバスサイズに合わせてスケールされ新規レイヤーとして追加",
|
||||
helpImageEdit3: "Newボタン:空白キャンバスを作成 — W×Hサイズを入力(例: 512x768);既存レイヤーは全て削除",
|
||||
helpImageEdit3: "Newボタン:空白キャンバスを作成 — W×Hサイズを入力(例: 512x768);既存レイヤーは全て削除し、空のLayer 1を自動追加",
|
||||
helpImageEditToolsTitle: "ツール",
|
||||
helpImageEdit4: "Select (V):クリックでレイヤーを選択、ドラッグで移動、コーナーハンドルでリサイズ、上辺の円ハンドルで回転;テキストレイヤーをダブルクリックすると再編集可能;ツールオプションバーにFlip H / Flip V / 回転角度入力を表示",
|
||||
helpImageEdit5: "Draw (B):アクティブな描画レイヤーにフリーハンドで描画;ツールオプション:カラー、ブラシサイズ、ブレンドモード;プロパティペインにABR画像ブラシ用のMASK EDITOR ONE (COLOR)セクションを常時表示 — ブラシが利用可能な場合は見出しが緑、未インポートの場合はグレー;ブラシが1つも無い間はSelectボタンが無効",
|
||||
@@ -1773,11 +1778,12 @@ const LANGUAGES = {
|
||||
helpImageEdit7b: "Blur (≈):アクティブレイヤーにガウスぼかしまたはモザイクを適用 — 全体またはドラッグで矩形範囲指定;詳細は下の「Blur Tool」カードを参照",
|
||||
helpImageEdit7c: "BG Remove (⬚):Lightweight(@imgly、ブラウザ内処理)またはBiRefNet(Mask Editor One + ComfyUI/models/background_removal/にbirefnet.safetensors必須)でアクティブレイヤーの背景を除去;詳細は下の「BG Remove Tool」カードを参照",
|
||||
helpImageEdit7d: "Mask (🎭):6つのサブツールでマスクレイヤーにマスクを描画 — Paint(フリーハンド)・Color(色類似度フラッドセレクト)・Alpha(画像の透過チャンネル抽出)・Text(テキストスタンプ)・Vector(Catmull-Romスプライン多角形)・Shape(矩形/楕円);Mask Editor OneインストールでSAM3テキストプロンプトセグメンテーションも利用可能;レイヤーヘッダーの「M」でマスクレイヤーを追加;詳細は下の「Mask Tool」カードを参照",
|
||||
helpImageEdit7e: "Inpaint (🩹):表示中のレイヤーとマスクレイヤーを1枚のRGBA画像に合成(マスクをアルファチャンネルに焼き込み)し、GenerateUIで読み込み中のワークフロー内でインペイント対応の最初のLoadImageノード(MASK出力がVAEEncodeForInpaint等に接続されているノード)へ適用;プロパティパネルでポジ/ネガプロンプト、Grow Mask By(VAE Encode (for Inpainting)ノードへ反映)、Denoise(KSamplerへ反映)を入力してRunを押すと、Image Editタブに留まったままアップロード・生成を実行;完了後は結果画像がプロパティパネルに表示される;事前にマスクレイヤーの描画とインペイント対応ワークフローの読み込みが必要;LoadImageの代わりにMask Editor Oneカスタムノード(comfyui-mask-editor-one)を使ったワークフローにも対応(node_idキーのサーバーキャッシュとlayer_dataウィジェット経由で画像/マスクを反映);「Use dedicated workflow」チェックボックス:OFF時はGenerateUIで読み込み中のワークフローを使用(従来通り)、ON時はドロップダウンから保存済みワークフローを選択すると、GenerateUIの表示状態には触れずバックグラウンドで読み込み・編集・生成を実行",
|
||||
helpImageEdit8b: "レイヤーヘッダーの「M」ボタン:アクティブレイヤーの上に新しいマスクレイヤーを追加し、自動的にMaskツールに切り替える",
|
||||
helpImageEditMaskTitle: "Mask ツール (🎭)",
|
||||
helpImageEditMask1: "マスクレイヤーの追加:レイヤーパネルヘッダーの「M」ボタンをクリック;新しいマスクレイヤーはアクティブレイヤーの上に挿入され、Maskツールが自動的に有効化される",
|
||||
helpImageEditMask2: "レイヤーリストでマスクレイヤーをクリックすると自動的にMaskツールに切り替わる",
|
||||
helpImageEditMask3: "ツールオプションバー — サブツール:Paint / Color / Alpha / Text / Vector / Shape(全てMask Editor One不要)/ SAM3(Mask Editor One必須・未インストール時は無効);Invertチェックボックスでオーバーレイプレビューを反転;Overlayカラーピッカーでプレビューカラーを変更(デフォルト赤);Blurスライダー(0〜50 px)でオーバーレイ輪郭をぼかす",
|
||||
helpImageEditMask3: "ツールオプションバー — サブツール:Paint / Color / Alpha / Text / Vector / Shape(全てMask Editor One不要)/ SAM3(Mask Editor One必須・未インストール時は無効);Invertチェックボックスでオーバーレイプレビューを反転;Overlayカラーピッカーでプレビューカラーを変更(デフォルト赤);Blurスライダー(0〜50 px)でオーバーレイ輪郭をぼかす;オーバーレイは選択中(アクティブ)のマスクレイヤーのみ表示され、非アクティブなマスクは選択するまで非表示",
|
||||
helpImageEditMask4: "プロパティペイン — Paintモード:Mode(Add / Erase)・Size(1〜200 px)・Hardness(0〜100%);MASK EDITOR ONEセクション(常時表示 — ABRブラシが利用可能な場合は見出しが緑、未インポートの場合はグレー):Selectボタンでブラシピッカーを開く(ブラシが1つも無い間は無効)(選択したブラシがデフォルト円形に代わる);✕でCircle(デフォルト)に戻す;画像ブラシ選択中はHardnessが無効になり追加コントロールが表示:Spacing(スタンプ間隔 5〜100%)・Angle(回転角 0〜359°)・Sz Jitter(スタンプごとのサイズランダム変動 0〜100%)・Rot. Jitter(スタンプごとの角度ランダム変動 on/off)",
|
||||
helpImageEditMask5: "マスクレイヤー行の ✂ ボタン:クリッピングマスクとして機能させるon/off切り替え — 有効(青)のとき、直下のレイヤーをマスクの描画範囲でクリッピングして表示;クリッピングはPNG保存 / Gallery / ComfyUI送信にも反映される",
|
||||
helpImageEditMask6: "SAM3(Mask Editor One必須):SAM3モデルによるテキストプロンプトセグメンテーション;対象オブジェクトの説明(例:\"cat\"・\"person\")を入力し、Max(マスク候補の最大数:3/6/9/12)を設定してSegmentをクリック",
|
||||
@@ -2077,6 +2083,7 @@ const LANGUAGES = {
|
||||
deleteConfirm: (name) => `确定删除 "${name}" 吗?`,
|
||||
summaryGenerated: "摘要已生成",
|
||||
summarizeError: "摘要错误",
|
||||
summarizeOllamaOnly: "摘要功能仅支持 Ollama 后端,请在设置中切换后端。",
|
||||
copied: "已复制",
|
||||
|
||||
// -- GenerateUI --
|
||||
@@ -2317,6 +2324,7 @@ const LANGUAGES = {
|
||||
modelsGenUIUnsupported: "此模型类型无法在GenerateUI中设置",
|
||||
modelsGenUINoWorkflow: "GenerateUI中未加载工作流",
|
||||
modelsGenUINoNode: (type) => `当前工作流中未找到${type}节点`,
|
||||
revertPromptTitle: "恢复到上次应用的提示词",
|
||||
modelsCopyName: "点击复制模型名称",
|
||||
modelsCopiedName: "模型名称已复制",
|
||||
modelsFilePath: "文件路径",
|
||||
@@ -2579,7 +2587,7 @@ const LANGUAGES = {
|
||||
helpGen1: "连接/断开ComfyUI,检查连接状态",
|
||||
helpGen2: "从工作流标签页加载工作流(不支持App格式.app.json)。Reset Workflow按钮从磁盘重新读取当前工作流文件并重新加载编辑器。Save按钮(标签栏右端)将当前工作流(包括在编辑器中所做的编辑)保存为新的.json文件到工作流标签页;会显示以当前工作流名称为默认值的文件名对话框",
|
||||
helpGen3: "5标签布局 — Input(提示词+图像)、Model、Settings、Feeder、Batch — Input/Model/Settings各含实时预览和直接编辑的Raw JSON列",
|
||||
helpGen4: "Input标签:含Prompt和Image子标签(拖放上传);Prompt标签显示Positive Prompt、Negative Prompt,以及底部的Embeddings选择器(过滤+下拉+权重+Paste按钮)— Paste将(embedding:Name:weight)插入最后聚焦文本框的光标位置(未聚焦时默认追加到Positive)",
|
||||
helpGen4: "Input标签:含Prompt和Image子标签(拖放上传);Prompt标签显示Positive Prompt、Negative Prompt,以及底部的Embeddings选择器(过滤+下拉+权重+Paste按钮)— Paste将(embedding:Name:weight)插入最后聚焦文本框的光标位置(未聚焦时默认追加到Positive);每个Apply按钮左侧的↺按钮可将文本框恢复为节点当前已应用的值;选中文字(或将光标置于单词/括号内也可)后按Ctrl+↑/↓,即可以(text:weight)语法以±0.05为单位调整强调权重(权重恢复为1.0时自动去除括号)",
|
||||
helpGen5: "Model标签:Checkpoint/VAE/LoRA(Single/Stack标签)/ControlNet/Diffusion Model(支持UNETLoader / UnetLoaderGGUF / LoaderGGUF)/Text Encoder(支持CLIPLoader / DualCLIPLoader / ClipLoaderGGUF / DualClipLoaderGGUF — 含type和device选择器,DualCLIP显示两段模型选择)/Hypernetwork(带Strength输入)选择器(含筛选)",
|
||||
helpGen6: "Settings标签:KSampler与Latent Image并排显示(各占50%宽度)",
|
||||
helpGen7: "Raw JSON在每个标签右列常驻显示 — 直接编辑并Apply即时重载工作流",
|
||||
@@ -2717,7 +2725,7 @@ const LANGUAGES = {
|
||||
helpImageEditTitle: "图像编辑选项卡",
|
||||
helpImageEdit1: "基于图层的图像编辑器 — 通过多个图层(图像、文字、绘制、遮罩类型)合成图像并导出",
|
||||
helpImageEdit2: "加载图像:拖放到画布、点击Upload按钮、或通过Gallery标签工具栏的Image Edit按钮发送;第一张图像成为图层1(自动锁定);后续图像缩放至画布大小作为新图层添加",
|
||||
helpImageEdit3: "New按钮:创建空白画布 — 输入宽高(如512x768);清除所有现有图层",
|
||||
helpImageEdit3: "New按钮:创建空白画布 — 输入宽高(如512x768);清除所有现有图层并自动添加空白Layer 1",
|
||||
helpImageEditToolsTitle: "工具",
|
||||
helpImageEdit4: "Select (V):点击选择图层;拖动移动;拖动角点手柄调整大小;拖动顶边圆形手柄旋转;双击文字图层可重新编辑;工具选项栏显示翻转H / 翻转V / 旋转角度",
|
||||
helpImageEdit5: "Draw (B):在当前绘制图层上自由绘画;工具选项:颜色、笔刷大小、混合模式;属性面板包含用于ABR图像笔刷的MASK EDITOR ONE (COLOR)区域 — 始终显示,笔刷可用时标题为绿色,未导入笔刷时为灰色;没有任何笔刷时Select按钮为禁用状态",
|
||||
@@ -2753,11 +2761,12 @@ const LANGUAGES = {
|
||||
helpImageEdit7b: "Blur (≈):对活动图层应用高斯模糊或马赛克 — 整层或拖动矩形区域;详细内容参见下方「Blur Tool」卡片",
|
||||
helpImageEdit7c: "BG Remove (⬚):使用Lightweight(@imgly,在浏览器中运行)或BiRefNet(需要Mask Editor One + ComfyUI/models/background_removal/中的birefnet.safetensors)去除活动图层背景;详细内容参见下方「BG Remove Tool」卡片",
|
||||
helpImageEdit7d: "Mask (🎭):使用6种子工具在遮罩图层上绘制遮罩 — Paint(徒手绘制)、Color(按颜色相似度泛选)、Alpha(从图像透明度提取)、Text(文字图章)、Vector(Catmull-Rom样条多边形)、Shape(矩形/椭圆);安装Mask Editor One后还可使用SAM3文本提示分割;点击图层标题栏的「M」添加遮罩图层;详细内容参见下方「Mask Tool」卡片",
|
||||
helpImageEdit7e: "Inpaint (🩹):将可见图层与遮罩图层合成为一张RGBA图像(遮罩烘焙进alpha通道),并应用到GenerateUI当前加载的工作流中第一个支持内绘的LoadImage节点(其MASK输出连接到VAEEncodeForInpaint等节点);在属性面板中输入正/负向提示词、Grow Mask By(应用到VAE Encode (for Inpainting)节点)、Denoise(应用到KSampler)后点击Run,即可在不离开Image Edit标签的情况下完成上传与生成;完成后结果图像会显示在属性面板中;需先绘制遮罩图层并在GenerateUI中加载支持内绘的工作流;同样支持基于Mask Editor One自定义节点(comfyui-mask-editor-one)而非LoadImage构建的工作流(通过其按node_id缓存的服务端图像与layer_data组件写入图像/遮罩);「Use dedicated workflow」复选框:关闭时使用GenerateUI当前加载的工作流(与之前相同);开启时可从下拉列表选择已保存的工作流,将在后台加载、编辑并生成,不影响GenerateUI中显示的工作流",
|
||||
helpImageEdit8b: "图层标题栏的「M」按钮:在当前活动图层上方添加新的遮罩图层,并自动切换至Mask工具",
|
||||
helpImageEditMaskTitle: "Mask 工具 (🎭)",
|
||||
helpImageEditMask1: "添加遮罩图层:点击图层面板标题栏的「M」按钮;新遮罩图层插入到活动图层上方,Mask工具自动激活",
|
||||
helpImageEditMask2: "在图层列表中点击遮罩图层会自动切换至Mask工具",
|
||||
helpImageEditMask3: "顶部工具栏 — 子工具:Paint / Color / Alpha / Text / Vector / Shape(均无需Mask Editor One)/ SAM3(需要Mask Editor One,未安装时不可用);Invert复选框反转叠加预览;Overlay拾色器更改预览颜色(默认红色);Blur滑块(0–50 px)柔化叠加边缘",
|
||||
helpImageEditMask3: "顶部工具栏 — 子工具:Paint / Color / Alpha / Text / Vector / Shape(均无需Mask Editor One)/ SAM3(需要Mask Editor One,未安装时不可用);Invert复选框反转叠加预览;Overlay拾色器更改预览颜色(默认红色);Blur滑块(0–50 px)柔化叠加边缘;叠加显示仅在当前激活的蒙版图层上显示,未激活的蒙版图层在被选中前保持隐藏",
|
||||
helpImageEditMask4: "属性面板 — Paint模式:Mode(Add / Erase)、Size(1–200 px)、Hardness(0–100%);MASK EDITOR ONE区域(始终显示 — 有可用的ABR笔刷时标题为绿色,尚未导入笔刷时为灰色):Select按钮打开ABR笔刷库(没有任何笔刷时禁用) — 选择笔刷将替换默认圆形笔刷;✕恢复Circle(默认);选择图像笔刷后Hardness禁用,并显示额外控件:Spacing(印章间距 5–100%)、Angle(旋转角度 0–359°)、Sz Jitter(每个印章的随机大小变化 0–100%)、Rot. Jitter(每个印章的随机旋转 on/off)",
|
||||
helpImageEditMask5: "遮罩图层行的 ✂ 按钮:切换是否作为剪贴蒙版使用 — 启用(蓝色)时,遮罩将裁剪其正下方图层,仅显示已绘制区域;剪贴效果在保存PNG / Gallery / 发送至ComfyUI时均会生效",
|
||||
helpImageEditMask6: "SAM3(需要Mask Editor One):由SAM3模型驱动的文本提示分割;输入目标对象描述(如\"cat\"、\"person\"),设置Max(最大蒙版候选数:3/6/9/12),然后点击Segment",
|
||||
|
||||
+230
-2
@@ -12,6 +12,9 @@ import { ShapeTool } from "./image-edit/ShapeTool.js";
|
||||
import { MaskTool } from "./image-edit/MaskTool.js";
|
||||
import { MaskColorTool, MaskAlphaTool, MaskTextTool, MaskVectorTool, MaskShapeTool, MASK_TEXT_FONTS } from "./image-edit/MaskEditorOneTools.js";
|
||||
import { showToast } from "./app.js";
|
||||
import { comfyUI } from "./comfyui-client.js";
|
||||
import { comfyEditor } from "./comfyui-editor.js";
|
||||
import { comfyWorkflow } from "./comfyui-workflow.js";
|
||||
|
||||
const TOOL_DEFS = [
|
||||
{ id: "select", icon: "▲", label: "Select", ready: true },
|
||||
@@ -22,6 +25,7 @@ const TOOL_DEFS = [
|
||||
{ id: "blur", icon: "≈", label: "Blur", ready: true },
|
||||
{ id: "filter", icon: "★", label: "Filter", ready: true },
|
||||
{ id: "bgremove", icon: "⬚", label: "BG Remove", ready: true },
|
||||
{ id: "inpaint", icon: "🩹", label: "Inpaint", ready: true },
|
||||
];
|
||||
|
||||
const UNDO_LIMIT = 20;
|
||||
@@ -107,6 +111,17 @@ class ImageEditTab {
|
||||
// ABR brush (Mask Editor One) — optional feature
|
||||
this._abrAvailable = false;
|
||||
this._abrBrushTree = [];
|
||||
// Inpaint ツール
|
||||
this._inpaintPositive = "";
|
||||
this._inpaintNegative = "";
|
||||
this._inpaintGrowMaskBy = null; // null = 未初期化(ワークフローの現在値から初期化)
|
||||
this._inpaintDenoise = null; // null = 未初期化(ワークフローの現在値から初期化)
|
||||
this._inpaintRunning = false;
|
||||
this._inpaintResultUrl = null;
|
||||
// Inpaint 専用ワークフロー(OFF時は GenerateUI で読み込み中のワークフローを使用)
|
||||
this._inpaintUseDedicated = false;
|
||||
this._inpaintDedicatedFilename = null;
|
||||
this._inpaintWorkflowList = [];
|
||||
}
|
||||
|
||||
// ── 初期化 ────────────────────────────────────
|
||||
@@ -124,6 +139,20 @@ class ImageEditTab {
|
||||
this._checkBiRefNetAvailability();
|
||||
this._checkSam3Availability();
|
||||
this._checkAbrAvailability();
|
||||
// Inpaint「専用ワークフロー」選択肢のため、保存済みワークフロー一覧を取得
|
||||
this._fetchInpaintWorkflowList();
|
||||
}
|
||||
|
||||
async _fetchInpaintWorkflowList() {
|
||||
try {
|
||||
const resp = await fetch(`${comfyUI.baseUrl}/api/wfm/workflows`);
|
||||
if (!resp.ok) return;
|
||||
const list = await resp.json();
|
||||
this._inpaintWorkflowList = (list || []).map((w) => w.filename).filter(Boolean);
|
||||
if (this._activeTool === "inpaint") this._renderInpaintProps();
|
||||
} catch {
|
||||
this._inpaintWorkflowList = [];
|
||||
}
|
||||
}
|
||||
|
||||
async _checkBiRefNetAvailability() {
|
||||
@@ -243,8 +272,8 @@ class ImageEditTab {
|
||||
overlay.getContext("2d").clearRect(0, 0, overlay.width, overlay.height);
|
||||
}
|
||||
}
|
||||
// Draw/Mask以外に切り替えたらプロパティペインを非表示
|
||||
if (toolId !== "mask" && toolId !== "draw") {
|
||||
// Draw/Mask/Inpaint以外に切り替えたらプロパティペインを非表示
|
||||
if (toolId !== "mask" && toolId !== "draw" && toolId !== "inpaint") {
|
||||
const pane = document.getElementById("ie-props-pane");
|
||||
if (pane) pane.style.display = "none";
|
||||
}
|
||||
@@ -689,6 +718,10 @@ class ImageEditTab {
|
||||
document.getElementById("ie-gmic-open-btn")?.addEventListener("click", () => this._gmicOpenGui());
|
||||
document.getElementById("ie-gmic-apply-btn")?.addEventListener("click", () => this._gmicApplyResult());
|
||||
document.getElementById("ie-gmic-abort-btn")?.addEventListener("click", () => this._gmicAbort());
|
||||
|
||||
} else if (toolId === "inpaint") {
|
||||
el.innerHTML = "";
|
||||
this._renderInpaintProps();
|
||||
} else {
|
||||
const def = TOOL_DEFS.find(d => d.id === toolId);
|
||||
el.innerHTML = `<span style="font-size:12px;color:var(--wfm-text-secondary);">${def?.label ?? toolId}: coming soon</span>`;
|
||||
@@ -1230,7 +1263,198 @@ class ImageEditTab {
|
||||
return canvas;
|
||||
}
|
||||
|
||||
// ── Inpaint ツール ─────────────────────────────
|
||||
// マスクレイヤー(透過背景+白ペイント)を黒背景に合成し、白=インペイント対象/黒=維持の
|
||||
// 不透明なグレースケールPNGとして書き出す(LayerのgetThumbnailDataURLと同じ規約)。
|
||||
_exportMaskCanvas(maskLayer) {
|
||||
const w = maskLayer.canvas.width, h = maskLayer.canvas.height;
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = w; canvas.height = h;
|
||||
const ctx = canvas.getContext("2d");
|
||||
ctx.fillStyle = "#000";
|
||||
ctx.fillRect(0, 0, w, h);
|
||||
ctx.drawImage(maskLayer.canvas, 0, 0);
|
||||
return canvas;
|
||||
}
|
||||
|
||||
_renderInpaintProps() {
|
||||
const pane = document.getElementById("ie-props-pane");
|
||||
const body = document.getElementById("ie-props-body");
|
||||
const title = document.getElementById("ie-props-title");
|
||||
if (!pane || !body) return;
|
||||
pane.style.display = "flex";
|
||||
if (title) title.textContent = "Inpaint";
|
||||
|
||||
// 未初期化ならワークフローの現在値から初期化(VAEEncodeForInpaint.grow_mask_by / KSampler.denoise)
|
||||
if (this._inpaintGrowMaskBy == null) {
|
||||
this._inpaintGrowMaskBy = comfyUI.currentAnalysis?.inpaint_encode_nodes?.[0]?.grow_mask_by ?? 6;
|
||||
}
|
||||
if (this._inpaintDenoise == null) {
|
||||
const samplerNode = (comfyUI.currentAnalysis?.sampler_nodes || []).find((n) => n.denoise !== undefined);
|
||||
this._inpaintDenoise = samplerNode?.denoise ?? 1.0;
|
||||
}
|
||||
|
||||
body.innerHTML = `
|
||||
<div class="ie-props-row">
|
||||
<label style="display:flex;align-items:center;gap:6px;cursor:pointer;">
|
||||
<input type="checkbox" id="ie-inpaint-use-dedicated" ${this._inpaintUseDedicated ? "checked" : ""}>
|
||||
Use dedicated workflow
|
||||
</label>
|
||||
</div>
|
||||
<div class="ie-props-row" id="ie-inpaint-dedicated-row" style="${this._inpaintUseDedicated ? "" : "display:none;"}">
|
||||
<select id="ie-inpaint-dedicated-select" style="flex:1;">
|
||||
<option value="">-- select workflow --</option>
|
||||
${this._inpaintWorkflowList.map((f) => `<option value="${f}" ${f === this._inpaintDedicatedFilename ? "selected" : ""}>${f}</option>`).join("")}
|
||||
</select>
|
||||
</div>
|
||||
<div class="ie-props-row" style="flex-direction:column;align-items:stretch;">
|
||||
<label>Positive Prompt</label>
|
||||
<textarea id="ie-inpaint-positive" rows="3" style="width:100%;resize:vertical;font-size:12px;">${this._inpaintPositive}</textarea>
|
||||
</div>
|
||||
<div class="ie-props-row" style="flex-direction:column;align-items:stretch;">
|
||||
<label>Negative Prompt</label>
|
||||
<textarea id="ie-inpaint-negative" rows="3" style="width:100%;resize:vertical;font-size:12px;">${this._inpaintNegative}</textarea>
|
||||
</div>
|
||||
<div class="ie-props-row">
|
||||
<label>Grow Mask By</label>
|
||||
<input type="number" id="ie-inpaint-grow-mask" min="0" max="200" step="1" value="${this._inpaintGrowMaskBy}" style="width:60px;">
|
||||
</div>
|
||||
<div class="ie-props-row">
|
||||
<label>Denoise</label>
|
||||
<input type="number" id="ie-inpaint-denoise" min="0" max="1" step="0.01" value="${this._inpaintDenoise}" style="width:60px;">
|
||||
</div>
|
||||
<div class="ie-props-row">
|
||||
<button class="wfm-btn wfm-btn-sm wfm-btn-primary" id="ie-inpaint-run-btn" style="flex:1;" ${this._inpaintRunning ? "disabled" : ""}>
|
||||
${this._inpaintRunning ? "Running..." : "Run"}
|
||||
</button>
|
||||
</div>
|
||||
<span id="ie-inpaint-status" style="font-size:11px;color:var(--wfm-text-secondary);"></span>
|
||||
${this._inpaintResultUrl ? `
|
||||
<div class="ie-props-row" style="flex-direction:column;align-items:stretch;">
|
||||
<label>Result</label>
|
||||
<img src="${this._inpaintResultUrl}" style="max-width:100%;border-radius:var(--wfm-radius-sm);border:1px solid var(--wfm-border);">
|
||||
</div>
|
||||
` : ""}
|
||||
`;
|
||||
|
||||
document.getElementById("ie-inpaint-use-dedicated")?.addEventListener("change", e => {
|
||||
this._inpaintUseDedicated = e.target.checked;
|
||||
this._renderInpaintProps();
|
||||
});
|
||||
document.getElementById("ie-inpaint-dedicated-select")?.addEventListener("change", e => {
|
||||
this._inpaintDedicatedFilename = e.target.value || null;
|
||||
});
|
||||
document.getElementById("ie-inpaint-positive")?.addEventListener("input", e => { this._inpaintPositive = e.target.value; });
|
||||
document.getElementById("ie-inpaint-negative")?.addEventListener("input", e => { this._inpaintNegative = e.target.value; });
|
||||
document.getElementById("ie-inpaint-grow-mask")?.addEventListener("input", e => {
|
||||
this._inpaintGrowMaskBy = parseInt(e.target.value) || 0;
|
||||
});
|
||||
document.getElementById("ie-inpaint-denoise")?.addEventListener("input", e => {
|
||||
this._inpaintDenoise = Math.max(0, Math.min(1, parseFloat(e.target.value)));
|
||||
if (Number.isNaN(this._inpaintDenoise)) this._inpaintDenoise = 1.0;
|
||||
});
|
||||
document.getElementById("ie-inpaint-run-btn")?.addEventListener("click", () => this._runInpaint());
|
||||
}
|
||||
|
||||
async _runInpaint() {
|
||||
if (this._inpaintRunning) return;
|
||||
if (!this._layerMgr) { showToast("No image loaded", "error"); return; }
|
||||
|
||||
const maskLayer = (this._layerMgr.activeLayer?.type === "mask")
|
||||
? this._layerMgr.activeLayer
|
||||
: this._layerMgr.layers.find(l => l.type === "mask");
|
||||
if (!maskLayer) { showToast("Create a mask layer first (Mask tool)", "info"); return; }
|
||||
|
||||
if (this._inpaintUseDedicated) {
|
||||
if (!this._inpaintDedicatedFilename) { showToast("Select a dedicated workflow first", "info"); return; }
|
||||
} else if (!comfyUI.currentAnalysis) {
|
||||
showToast("Load a workflow in GenerateUI first", "info");
|
||||
return;
|
||||
}
|
||||
|
||||
const runBtn = document.getElementById("ie-inpaint-run-btn");
|
||||
const statusEl = document.getElementById("ie-inpaint-status");
|
||||
const setStatus = (msg) => { if (statusEl) statusEl.textContent = msg; };
|
||||
|
||||
this._inpaintRunning = true;
|
||||
if (runBtn) { runBtn.disabled = true; runBtn.textContent = "Running..."; }
|
||||
setStatus(this._inpaintUseDedicated ? "Loading dedicated workflow..." : "Compositing...");
|
||||
|
||||
try {
|
||||
// 専用ワークフロー使用時は GenerateUI の comfyUI.currentWorkflow/currentAnalysis には
|
||||
// 一切触れず、ここでロード・解析したローカルなワークフロー/解析結果だけを使う。
|
||||
let targetWorkflow = null;
|
||||
let targetAnalysis = null;
|
||||
|
||||
if (this._inpaintUseDedicated) {
|
||||
const resp = await fetch(`${comfyUI.baseUrl}/api/wfm/workflows/raw?filename=${encodeURIComponent(this._inpaintDedicatedFilename)}`);
|
||||
if (!resp.ok) throw new Error(`Failed to load workflow (HTTP ${resp.status})`);
|
||||
let dedicatedWorkflow = await resp.json();
|
||||
const format = comfyWorkflow.detectFormat(dedicatedWorkflow, this._inpaintDedicatedFilename);
|
||||
if (format === "ui") {
|
||||
dedicatedWorkflow = await comfyWorkflow.convertUiToApi(dedicatedWorkflow);
|
||||
} else if (format !== "api") {
|
||||
throw new Error("Unsupported or unrecognized workflow format");
|
||||
}
|
||||
targetWorkflow = dedicatedWorkflow;
|
||||
targetAnalysis = comfyWorkflow.analyzeWorkflow(dedicatedWorkflow);
|
||||
}
|
||||
|
||||
// LoadImage(の MASK 出力が使われている)スロットを優先し、無ければ Mask Editor One
|
||||
// ノード(LoadImage を介さず画像/マスクを内包する custom node)にフォールバックする
|
||||
const analysisForLookup = targetAnalysis || comfyUI.currentAnalysis;
|
||||
const slotIndex = (analysisForLookup.load_image_nodes || []).findIndex(n => n.mask_used);
|
||||
const meoNode = (analysisForLookup.mask_editor_one_nodes || [])[0];
|
||||
if (slotIndex === -1 && !meoNode) {
|
||||
throw new Error("No inpaint-capable LoadImage or Mask Editor One node found in the workflow");
|
||||
}
|
||||
|
||||
setStatus("Compositing...");
|
||||
const bgCanvas = this._buildBgCanvas();
|
||||
const imageBlob = await new Promise((resolve) => bgCanvas.toBlob(resolve, "image/png"));
|
||||
const maskCanvas = this._exportMaskCanvas(maskLayer);
|
||||
const maskBlob = await new Promise((resolve) => maskCanvas.toBlob(resolve, "image/png"));
|
||||
|
||||
const overrideOpts = targetWorkflow ? { workflow: targetWorkflow, analysis: targetAnalysis } : {};
|
||||
|
||||
setStatus("Uploading...");
|
||||
if (slotIndex !== -1) {
|
||||
await comfyEditor.applyImageAndMaskToSlot(imageBlob, maskBlob, slotIndex, overrideOpts);
|
||||
} else {
|
||||
await comfyEditor.applyImageAndMaskToMaskEditorOneNode(imageBlob, maskBlob, meoNode.id, overrideOpts);
|
||||
}
|
||||
|
||||
comfyEditor.setPromptText("positive", this._inpaintPositive, overrideOpts);
|
||||
comfyEditor.setPromptText("negative", this._inpaintNegative, overrideOpts);
|
||||
comfyEditor.setInpaintParams({
|
||||
growMaskBy: this._inpaintGrowMaskBy,
|
||||
denoise: this._inpaintDenoise,
|
||||
...overrideOpts,
|
||||
});
|
||||
|
||||
if (!window._wfmGenerateTab?.generate) throw new Error("GenerateUI is not ready yet");
|
||||
|
||||
setStatus("Generating...");
|
||||
await window._wfmGenerateTab.generate(targetWorkflow || undefined);
|
||||
|
||||
const resultImg = document.getElementById("wfm-gen-result-img");
|
||||
if (resultImg?.src) this._inpaintResultUrl = resultImg.src;
|
||||
|
||||
setStatus("Done");
|
||||
showToast("Inpaint generation complete", "success");
|
||||
} catch (err) {
|
||||
setStatus("Error");
|
||||
showToast(`Inpaint failed: ${err.message}`, "error");
|
||||
} finally {
|
||||
this._inpaintRunning = false;
|
||||
this._renderInpaintProps();
|
||||
}
|
||||
}
|
||||
|
||||
_renderMaskLayerOverlay(ctx, maskLayer) {
|
||||
// アクティブなマスクレイヤーのみオーバーレイ表示(非アクティブなマスクは隠す)
|
||||
if (this._layerMgr?.activeLayer !== maskLayer) return;
|
||||
|
||||
const overlayColor = this._maskOverlayColor;
|
||||
const blurPx = this._maskBlur;
|
||||
const inverted = this._maskInverted;
|
||||
@@ -1588,9 +1812,12 @@ class ImageEditTab {
|
||||
this._canvasH = h;
|
||||
this._baseName = "new-canvas";
|
||||
this._initCanvases();
|
||||
const layer1 = this._layerMgr.addLayer("draw", "Layer 1");
|
||||
this._layerMgr.setActive(layer1.id);
|
||||
this._undoStack = [];
|
||||
this._redoStack = [];
|
||||
this._setActiveTool("select");
|
||||
this._selectTool?.setLayer(layer1);
|
||||
this._refreshLayerList();
|
||||
this._updateCompositeView();
|
||||
this._fitToView();
|
||||
@@ -2066,6 +2293,7 @@ class ImageEditTab {
|
||||
this._updateCompositeView();
|
||||
} else if (this._activeTool === "select" && layer) {
|
||||
this._selectTool?.setLayer(layer);
|
||||
this._updateCompositeView();
|
||||
} else {
|
||||
this._updateCompositeView();
|
||||
}
|
||||
|
||||
@@ -1129,10 +1129,18 @@ function openDetailModal(wf) {
|
||||
try {
|
||||
const wfJson = await getRawWorkflow(wf.filename);
|
||||
const promptText = getSummaryPrompt() + JSON.stringify(wfJson).substring(0, 4000);
|
||||
const aiCfg = readJsonStorage("wfm_prompt_ai_settings", {});
|
||||
if (aiCfg.backend && aiCfg.backend !== "ollama") {
|
||||
throw new Error(t("summarizeOllamaOnly"));
|
||||
}
|
||||
const chatRes = await fetch("/api/wfm/ollama/chat", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ messages: [{ role: "user", content: promptText }] }),
|
||||
body: JSON.stringify({
|
||||
url: aiCfg.backendUrl || undefined,
|
||||
model: aiCfg.model || undefined,
|
||||
messages: [{ role: "user", content: promptText }],
|
||||
}),
|
||||
});
|
||||
const chatData = await chatRes.json();
|
||||
if (chatData.error) throw new Error(chatData.error);
|
||||
|
||||
@@ -1088,7 +1088,7 @@
|
||||
<li id="wfm-help-gen-1">Connect/disconnect ComfyUI and check connection status</li>
|
||||
<li id="wfm-help-gen-2">Load workflows from Workflow tab (App format .app.json not supported); Reset Workflow button re-reads the current workflow file from disk and reloads the editor; <b>Save</b> button (right end of the tab bar) saves the current workflow — including any edits made in the editor — as a new .json file to the Workflow tab; a filename dialog appears with the current workflow name as the default; <b>Style</b> checkbox and dropdown (next to Reset Workflow): enable to apply a Fooocus-style JSON style to the positive and negative prompts at generation time — style files are loaded from <code>user/default/Workflow-Studio/style/*.json</code>; the style's <code>{prompt}</code> placeholder is replaced with the original prompt, or the style text is appended if no placeholder exists</li>
|
||||
<li id="wfm-help-gen-3">5-tab layout — Input (Prompt + Image), Model, Settings, Feeder, Batch — Input/Model/Settings each include a Raw JSON column for instant preview and direct editing</li>
|
||||
<li id="wfm-help-gen-4">Input tab: inner tabs — <b>Prompt</b> and <b>Image</b> (drag-and-drop upload); Prompt tab has Positive Prompt, Negative Prompt, and an <b>Embeddings</b> selector at the bottom — select a model, set Weight (default 1.0), then click <b>Paste</b> to insert <code>(embedding:Name:weight)</code> at the cursor position of the last focused textarea (defaults to Positive if neither is focused)</li>
|
||||
<li id="wfm-help-gen-4">Input tab: inner tabs — <b>Prompt</b> and <b>Image</b> (drag-and-drop upload); Prompt tab has Positive Prompt, Negative Prompt, and an <b>Embeddings</b> selector at the bottom — select a model, set Weight (default 1.0), then click <b>Paste</b> to insert <code>(embedding:Name:weight)</code> at the cursor position of the last focused textarea (defaults to Positive if neither is focused); a <b>↺</b> button next to each Apply button reverts the textarea to the node's currently applied value; select text (or just place the cursor on a word/parenthesis block) and press <b>Ctrl+↑/↓</b> to adjust its emphasis weight in <code>(text:weight)</code> syntax by ±0.05 — the parentheses are removed automatically when the weight returns to 1.0</li>
|
||||
<li id="wfm-help-gen-5">Model tab: Checkpoint, VAE, LoRA (Single/Stack tabs), ControlNet, Diffusion Model (UNETLoader / UnetLoaderGGUF / LoaderGGUF), Text Encoder (CLIPLoader / DualCLIPLoader / ClipLoaderGGUF / DualClipLoaderGGUF — type and device selectors; DualCLIP shows two clip selectors), Hypernetwork (with Strength field) selectors with filter; LoRA Stack — Apply writes all active LoRAs to the target node and simultaneously inserts LoRA syntax and CivitAI trigger words into the Positive prompt; re-applying updates the prompt by removing inactive LoRAs and re-adding active ones</li>
|
||||
<li id="wfm-help-gen-6">Settings tab: KSampler and Latent Image side by side, each at 50% width</li>
|
||||
<li id="wfm-help-gen-7">Raw JSON always visible in the right column of each tab — edit directly and Apply to reload the workflow</li>
|
||||
@@ -1314,7 +1314,7 @@
|
||||
<ul>
|
||||
<li id="wfm-help-imageedit-1">Layer-based image editor — compose images with multiple layers (Image, Text, Draw, Mask types) and export the composite</li>
|
||||
<li id="wfm-help-imageedit-2">Loading images: drag & drop onto the canvas, Upload button, or send from the Gallery tab via the Image Edit button in the Gallery toolbar; the first image becomes Layer 1 (auto-locked); subsequent images are added as new layers scaled to fit the canvas</li>
|
||||
<li id="wfm-help-imageedit-3">New button: create a blank canvas — prompts for WxH size (e.g. 512x768); clears all existing layers</li>
|
||||
<li id="wfm-help-imageedit-3">New button: create a blank canvas — prompts for WxH size (e.g. 512x768); clears all existing layers and automatically adds an empty Layer 1</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="wfm-help-card">
|
||||
@@ -1327,6 +1327,7 @@
|
||||
<li id="wfm-help-imageedit-7b">Blur (≈): apply Gaussian blur or mosaic to the active layer — whole-layer or region-based (drag a rectangle); see the Blur Tool card below for details</li>
|
||||
<li id="wfm-help-imageedit-7c">BG Remove (⬚): remove the background from the active layer using Lightweight (@imgly, runs in browser) or BiRefNet (requires Mask Editor One + birefnet.safetensors in ComfyUI/models/background_removal/); see the BG Remove Tool card below for details</li>
|
||||
<li id="wfm-help-imageedit-7d">Mask (🎭): paint masks on a mask layer using 6 sub-tools — Paint (freehand), Color (flood-select by similar color), Alpha (extract from image transparency), Text (stamp text), Vector (Catmull-Rom spline polygon), Shape (rect / ellipse); SAM3 text-prompt segmentation is also available when Mask Editor One is installed; click "M" in the Layers header to add a mask layer; see the Mask Tool card below for details</li>
|
||||
<li id="wfm-help-imageedit-7e">Inpaint (🩹): composites the visible layers plus a Mask layer into one RGBA image (mask baked into the alpha channel) and applies it to the first inpaint-capable LoadImage node in the workflow currently loaded in GenerateUI (a node whose MASK output feeds something like VAEEncodeForInpaint); enter Positive/Negative prompts, Grow Mask By (applied to the VAE Encode (for Inpainting) node), and Denoise (applied to KSampler) in the properties panel, then click Run to upload and generate without leaving the Image Edit tab — the result is shown back in the properties panel when done; requires a Mask layer to be painted first and an inpaint-capable workflow loaded in GenerateUI; also works with workflows built around the Mask Editor One custom node (comfyui-mask-editor-one) instead of LoadImage — image/mask are pushed to it via its node_id-keyed server cache and layer_data widget; "Use dedicated workflow" checkbox: when off, the workflow currently loaded in GenerateUI is used (unchanged); when on, pick a saved workflow from the dropdown — it is loaded, edited, and generated entirely in the background without disturbing the workflow shown in GenerateUI</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="wfm-help-card">
|
||||
@@ -1367,7 +1368,7 @@
|
||||
<ul>
|
||||
<li id="wfm-help-imageedit-mask-1">Add a mask layer: click the "M" button in the Layers panel header; the new mask layer is inserted above the active layer and the Mask tool activates automatically</li>
|
||||
<li id="wfm-help-imageedit-mask-2">Clicking a mask layer in the layer list automatically switches to the Mask tool</li>
|
||||
<li id="wfm-help-imageedit-mask-3">Tool Options bar — sub-tools: Paint / Color / Alpha / Text / Vector / Shape (all work without Mask Editor One) / SAM3 (requires Mask Editor One, disabled if not installed); Invert checkbox inverts the overlay preview; Overlay color picker changes the preview color (default red); Blur slider (0–50 px) softens the overlay edge</li>
|
||||
<li id="wfm-help-imageedit-mask-3">Tool Options bar — sub-tools: Paint / Color / Alpha / Text / Vector / Shape (all work without Mask Editor One) / SAM3 (requires Mask Editor One, disabled if not installed); Invert checkbox inverts the overlay preview; Overlay color picker changes the preview color (default red); Blur slider (0–50 px) softens the overlay edge; the overlay is only shown for the currently active mask layer — inactive mask layers stay hidden until selected</li>
|
||||
<li id="wfm-help-imageedit-mask-4">Properties pane — Paint mode: Mode (Add / Erase), Size (1–200 px), Hardness (0–100%); MASK EDITOR ONE section (always visible — header text is green when ABR brushes are available, gray when none are imported yet): Select button opens the ABR brush library (disabled until at least one brush exists) — choosing a brush replaces the default circle brush; ✕ clears the brush back to Circle; when an image brush is active, Hardness is disabled and additional controls appear: Spacing (stamp interval 5–100%), Angle (rotation 0–359°), Sz Jitter (random size reduction per stamp 0–100%), Rot. Jitter (random rotation per stamp on/off)</li>
|
||||
<li id="wfm-help-imageedit-mask-5">✂ button on a mask layer row: toggles the layer as a clipping mask — when enabled (blue), the mask clips the layer directly below it so only the painted area is visible; clipping is applied when saving PNG / Gallery / ComfyUI</li>
|
||||
<li id="wfm-help-imageedit-mask-6">SAM3 (Mask Editor One required): text-prompt segmentation powered by the SAM3 model; enter a description of the object to segment (e.g. "cat", "person"), set Max (maximum mask candidates: 3/6/9/12), then click Segment</li>
|
||||
@@ -1670,6 +1671,7 @@
|
||||
<button class="ie-tool-btn" data-tool="blur" title="Blur">≈</button>
|
||||
<button class="ie-tool-btn" data-tool="filter" title="Filter">★</button>
|
||||
<button class="ie-tool-btn" data-tool="bgremove" title="BG Remove">⬚</button>
|
||||
<button class="ie-tool-btn" data-tool="inpaint" title="Inpaint">🩹</button>
|
||||
</div>
|
||||
|
||||
<!-- Center -->
|
||||
|
||||
@@ -0,0 +1,665 @@
|
||||
{
|
||||
"id": "6d392e45-b20b-4dee-a422-0b4a18e645cd",
|
||||
"revision": 0,
|
||||
"last_node_id": 35,
|
||||
"last_link_id": 102,
|
||||
"nodes": [
|
||||
{
|
||||
"id": 8,
|
||||
"type": "VAEDecode",
|
||||
"pos": [
|
||||
1351.4570000000006,
|
||||
197.9979999999999
|
||||
],
|
||||
"size": [
|
||||
210,
|
||||
46
|
||||
],
|
||||
"flags": {},
|
||||
"order": 6,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"localized_name": "samples",
|
||||
"name": "samples",
|
||||
"type": "LATENT",
|
||||
"link": 42
|
||||
},
|
||||
{
|
||||
"localized_name": "vae",
|
||||
"name": "vae",
|
||||
"type": "VAE",
|
||||
"link": 84
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"localized_name": "IMAGE",
|
||||
"name": "IMAGE",
|
||||
"type": "IMAGE",
|
||||
"slot_index": 0,
|
||||
"links": [
|
||||
22
|
||||
]
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "VAEDecode",
|
||||
"cnr_id": "comfy-core",
|
||||
"ver": "0.3.18",
|
||||
"ue_properties": {
|
||||
"widget_ue_connectable": {},
|
||||
"version": "7.8",
|
||||
"input_ue_unconnectable": {}
|
||||
}
|
||||
},
|
||||
"widgets_values": []
|
||||
},
|
||||
{
|
||||
"id": 29,
|
||||
"type": "CheckpointLoaderSimple",
|
||||
"pos": [
|
||||
-35,
|
||||
161
|
||||
],
|
||||
"size": [
|
||||
315,
|
||||
98
|
||||
],
|
||||
"flags": {},
|
||||
"order": 0,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"localized_name": "ckpt_name",
|
||||
"name": "ckpt_name",
|
||||
"type": "COMBO",
|
||||
"widget": {
|
||||
"name": "ckpt_name"
|
||||
},
|
||||
"link": null
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"localized_name": "MODEL",
|
||||
"name": "MODEL",
|
||||
"type": "MODEL",
|
||||
"slot_index": 0,
|
||||
"links": [
|
||||
80
|
||||
]
|
||||
},
|
||||
{
|
||||
"localized_name": "CLIP",
|
||||
"name": "CLIP",
|
||||
"type": "CLIP",
|
||||
"slot_index": 1,
|
||||
"links": [
|
||||
81,
|
||||
82
|
||||
]
|
||||
},
|
||||
{
|
||||
"localized_name": "VAE",
|
||||
"name": "VAE",
|
||||
"type": "VAE",
|
||||
"slot_index": 2,
|
||||
"links": [
|
||||
84,
|
||||
90
|
||||
]
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "CheckpointLoaderSimple",
|
||||
"cnr_id": "comfy-core",
|
||||
"ver": "0.3.18",
|
||||
"ue_properties": {
|
||||
"widget_ue_connectable": {},
|
||||
"version": "7.8",
|
||||
"input_ue_unconnectable": {}
|
||||
}
|
||||
},
|
||||
"widgets_values": [
|
||||
"anime\\merge\\hayochamixIDXL_v11+_blueberryPlus_v10-amanatsuIllustrious_v11_x0.1_trainDifference.safetensors"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"type": "CLIPTextEncode",
|
||||
"pos": [
|
||||
330,
|
||||
369
|
||||
],
|
||||
"size": [
|
||||
412.2799987792969,
|
||||
88
|
||||
],
|
||||
"flags": {},
|
||||
"order": 3,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"localized_name": "clip",
|
||||
"name": "clip",
|
||||
"type": "CLIP",
|
||||
"link": 82
|
||||
},
|
||||
{
|
||||
"localized_name": "text",
|
||||
"name": "text",
|
||||
"type": "STRING",
|
||||
"widget": {
|
||||
"name": "text"
|
||||
},
|
||||
"link": null
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"localized_name": "CONDITIONING",
|
||||
"name": "CONDITIONING",
|
||||
"type": "CONDITIONING",
|
||||
"slot_index": 0,
|
||||
"links": [
|
||||
6
|
||||
]
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "CLIPTextEncode",
|
||||
"cnr_id": "comfy-core",
|
||||
"ver": "0.3.18",
|
||||
"ue_properties": {
|
||||
"widget_ue_connectable": {},
|
||||
"version": "7.8",
|
||||
"input_ue_unconnectable": {}
|
||||
}
|
||||
},
|
||||
"widgets_values": [
|
||||
"w\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 32,
|
||||
"type": "LoadImage",
|
||||
"pos": [
|
||||
-20.402179424849777,
|
||||
348.01722821269084
|
||||
],
|
||||
"size": [
|
||||
282.798828125,
|
||||
314
|
||||
],
|
||||
"flags": {},
|
||||
"order": 1,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"localized_name": "image",
|
||||
"name": "image",
|
||||
"type": "COMBO",
|
||||
"widget": {
|
||||
"name": "image"
|
||||
},
|
||||
"link": null
|
||||
},
|
||||
{
|
||||
"localized_name": "choose file to upload",
|
||||
"name": "upload",
|
||||
"type": "IMAGEUPLOAD",
|
||||
"widget": {
|
||||
"name": "upload"
|
||||
},
|
||||
"link": null
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"localized_name": "IMAGE",
|
||||
"name": "IMAGE",
|
||||
"type": "IMAGE",
|
||||
"links": [
|
||||
101
|
||||
]
|
||||
},
|
||||
{
|
||||
"localized_name": "MASK",
|
||||
"name": "MASK",
|
||||
"type": "MASK",
|
||||
"links": [
|
||||
102
|
||||
]
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "LoadImage",
|
||||
"ue_properties": {
|
||||
"widget_ue_connectable": {},
|
||||
"input_ue_unconnectable": {},
|
||||
"version": "7.8"
|
||||
},
|
||||
"image": "clipspace/clipspace-painted-masked-1784801792090.png [input]"
|
||||
},
|
||||
"widgets_values": [
|
||||
"clipspace/clipspace-painted-masked-1784801792090.png [input]",
|
||||
"image"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"type": "KSampler",
|
||||
"pos": [
|
||||
997,
|
||||
174
|
||||
],
|
||||
"size": [
|
||||
315,
|
||||
474
|
||||
],
|
||||
"flags": {},
|
||||
"order": 5,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"localized_name": "model",
|
||||
"name": "model",
|
||||
"type": "MODEL",
|
||||
"link": 80
|
||||
},
|
||||
{
|
||||
"localized_name": "positive",
|
||||
"name": "positive",
|
||||
"type": "CONDITIONING",
|
||||
"link": 4
|
||||
},
|
||||
{
|
||||
"localized_name": "negative",
|
||||
"name": "negative",
|
||||
"type": "CONDITIONING",
|
||||
"link": 6
|
||||
},
|
||||
{
|
||||
"localized_name": "latent_image",
|
||||
"name": "latent_image",
|
||||
"type": "LATENT",
|
||||
"link": 72
|
||||
},
|
||||
{
|
||||
"localized_name": "seed",
|
||||
"name": "seed",
|
||||
"type": "INT",
|
||||
"widget": {
|
||||
"name": "seed"
|
||||
},
|
||||
"link": null
|
||||
},
|
||||
{
|
||||
"localized_name": "steps",
|
||||
"name": "steps",
|
||||
"type": "INT",
|
||||
"widget": {
|
||||
"name": "steps"
|
||||
},
|
||||
"link": null
|
||||
},
|
||||
{
|
||||
"localized_name": "cfg",
|
||||
"name": "cfg",
|
||||
"type": "FLOAT",
|
||||
"widget": {
|
||||
"name": "cfg"
|
||||
},
|
||||
"link": null
|
||||
},
|
||||
{
|
||||
"localized_name": "sampler_name",
|
||||
"name": "sampler_name",
|
||||
"type": "COMBO",
|
||||
"widget": {
|
||||
"name": "sampler_name"
|
||||
},
|
||||
"link": null
|
||||
},
|
||||
{
|
||||
"localized_name": "scheduler",
|
||||
"name": "scheduler",
|
||||
"type": "COMBO",
|
||||
"widget": {
|
||||
"name": "scheduler"
|
||||
},
|
||||
"link": null
|
||||
},
|
||||
{
|
||||
"localized_name": "denoise",
|
||||
"name": "denoise",
|
||||
"type": "FLOAT",
|
||||
"widget": {
|
||||
"name": "denoise"
|
||||
},
|
||||
"link": null
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"localized_name": "LATENT",
|
||||
"name": "LATENT",
|
||||
"type": "LATENT",
|
||||
"slot_index": 0,
|
||||
"links": [
|
||||
42
|
||||
]
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "KSampler",
|
||||
"cnr_id": "comfy-core",
|
||||
"ver": "0.3.18",
|
||||
"ue_properties": {
|
||||
"widget_ue_connectable": {},
|
||||
"version": "7.8",
|
||||
"input_ue_unconnectable": {}
|
||||
}
|
||||
},
|
||||
"widgets_values": [
|
||||
1008854893628621,
|
||||
"randomize",
|
||||
30,
|
||||
4,
|
||||
"ddim",
|
||||
"simple",
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 26,
|
||||
"type": "VAEEncodeForInpaint",
|
||||
"pos": [
|
||||
759,
|
||||
169
|
||||
],
|
||||
"size": [
|
||||
226.8000030517578,
|
||||
98
|
||||
],
|
||||
"flags": {},
|
||||
"order": 4,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"localized_name": "pixels",
|
||||
"name": "pixels",
|
||||
"type": "IMAGE",
|
||||
"link": 101
|
||||
},
|
||||
{
|
||||
"localized_name": "vae",
|
||||
"name": "vae",
|
||||
"type": "VAE",
|
||||
"link": 90
|
||||
},
|
||||
{
|
||||
"localized_name": "mask",
|
||||
"name": "mask",
|
||||
"type": "MASK",
|
||||
"link": 102
|
||||
},
|
||||
{
|
||||
"localized_name": "grow_mask_by",
|
||||
"name": "grow_mask_by",
|
||||
"type": "INT",
|
||||
"widget": {
|
||||
"name": "grow_mask_by"
|
||||
},
|
||||
"link": null
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"localized_name": "LATENT",
|
||||
"name": "LATENT",
|
||||
"type": "LATENT",
|
||||
"slot_index": 0,
|
||||
"links": [
|
||||
72
|
||||
]
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "VAEEncodeForInpaint",
|
||||
"cnr_id": "comfy-core",
|
||||
"ver": "0.3.18",
|
||||
"ue_properties": {
|
||||
"widget_ue_connectable": {},
|
||||
"version": "7.8",
|
||||
"input_ue_unconnectable": {}
|
||||
}
|
||||
},
|
||||
"widgets_values": [
|
||||
6
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"type": "SaveImage",
|
||||
"pos": [
|
||||
1362.0710000000008,
|
||||
369.32099999999986
|
||||
],
|
||||
"size": [
|
||||
210,
|
||||
270
|
||||
],
|
||||
"flags": {},
|
||||
"order": 7,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"localized_name": "images",
|
||||
"name": "images",
|
||||
"type": "IMAGE",
|
||||
"link": 22
|
||||
},
|
||||
{
|
||||
"localized_name": "filename_prefix",
|
||||
"name": "filename_prefix",
|
||||
"type": "STRING",
|
||||
"widget": {
|
||||
"name": "filename_prefix"
|
||||
},
|
||||
"link": null
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"localized_name": "images",
|
||||
"name": "images",
|
||||
"type": "IMAGE",
|
||||
"links": null
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "SaveImage",
|
||||
"cnr_id": "comfy-core",
|
||||
"ver": "0.3.18",
|
||||
"ue_properties": {
|
||||
"widget_ue_connectable": {},
|
||||
"version": "7.8",
|
||||
"input_ue_unconnectable": {}
|
||||
}
|
||||
},
|
||||
"widgets_values": [
|
||||
"ComfyUI"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"type": "CLIPTextEncode",
|
||||
"pos": [
|
||||
326.97,
|
||||
160
|
||||
],
|
||||
"size": [
|
||||
422.8500061035156,
|
||||
164.30999755859375
|
||||
],
|
||||
"flags": {},
|
||||
"order": 2,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"localized_name": "clip",
|
||||
"name": "clip",
|
||||
"type": "CLIP",
|
||||
"link": 81
|
||||
},
|
||||
{
|
||||
"localized_name": "text",
|
||||
"name": "text",
|
||||
"type": "STRING",
|
||||
"widget": {
|
||||
"name": "text"
|
||||
},
|
||||
"link": null
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"localized_name": "CONDITIONING",
|
||||
"name": "CONDITIONING",
|
||||
"type": "CONDITIONING",
|
||||
"slot_index": 0,
|
||||
"links": [
|
||||
4
|
||||
]
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "CLIPTextEncode",
|
||||
"cnr_id": "comfy-core",
|
||||
"ver": "0.3.18",
|
||||
"ue_properties": {
|
||||
"widget_ue_connectable": {},
|
||||
"version": "7.8",
|
||||
"input_ue_unconnectable": {}
|
||||
}
|
||||
},
|
||||
"widgets_values": [
|
||||
"smile"
|
||||
]
|
||||
}
|
||||
],
|
||||
"links": [
|
||||
[
|
||||
4,
|
||||
6,
|
||||
0,
|
||||
3,
|
||||
1,
|
||||
"CONDITIONING"
|
||||
],
|
||||
[
|
||||
6,
|
||||
7,
|
||||
0,
|
||||
3,
|
||||
2,
|
||||
"CONDITIONING"
|
||||
],
|
||||
[
|
||||
22,
|
||||
8,
|
||||
0,
|
||||
9,
|
||||
0,
|
||||
"IMAGE"
|
||||
],
|
||||
[
|
||||
42,
|
||||
3,
|
||||
0,
|
||||
8,
|
||||
0,
|
||||
"LATENT"
|
||||
],
|
||||
[
|
||||
72,
|
||||
26,
|
||||
0,
|
||||
3,
|
||||
3,
|
||||
"LATENT"
|
||||
],
|
||||
[
|
||||
80,
|
||||
29,
|
||||
0,
|
||||
3,
|
||||
0,
|
||||
"MODEL"
|
||||
],
|
||||
[
|
||||
81,
|
||||
29,
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
"CLIP"
|
||||
],
|
||||
[
|
||||
82,
|
||||
29,
|
||||
1,
|
||||
7,
|
||||
0,
|
||||
"CLIP"
|
||||
],
|
||||
[
|
||||
84,
|
||||
29,
|
||||
2,
|
||||
8,
|
||||
1,
|
||||
"VAE"
|
||||
],
|
||||
[
|
||||
90,
|
||||
29,
|
||||
2,
|
||||
26,
|
||||
1,
|
||||
"VAE"
|
||||
],
|
||||
[
|
||||
101,
|
||||
32,
|
||||
0,
|
||||
26,
|
||||
0,
|
||||
"IMAGE"
|
||||
],
|
||||
[
|
||||
102,
|
||||
32,
|
||||
1,
|
||||
26,
|
||||
2,
|
||||
"MASK"
|
||||
]
|
||||
],
|
||||
"groups": [],
|
||||
"config": {},
|
||||
"extra": {
|
||||
"ds": {
|
||||
"scale": 0.9229599817706418,
|
||||
"offset": [
|
||||
365.6203139679832,
|
||||
118.10373545614928
|
||||
]
|
||||
},
|
||||
"ue_links": [],
|
||||
"links_added_by_ue": []
|
||||
},
|
||||
"version": 0.4
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 134 KiB |
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 250 KiB |
Reference in New Issue
Block a user