Compare commits

..
Author SHA1 Message Date
ausboss d759ca1cea Add tests for shared frontend helpers; fix link restore slot check
Restoring links after a failed change checked the source node but not
its output slot, so a link from another output of the same node could
be kept. 29 new tests cover scrub math, graph links, panel sizing,
Civitai parsing, brush math and widget card values.
2026-11-04 00:20:56 -06:00
454 changed files with 3379 additions and 52638 deletions
-6
View File
@@ -1,6 +0,0 @@
{
"attribution": {
"commit": "",
"pr": ""
}
}
-4
View File
@@ -24,10 +24,6 @@ SECURITY.md
.claude/
/docs/
# the skill an AI agent installs from the repository (npx skills add);
# nothing in the pack loads it
/skills/
# README media: GitHub shows it on the repository page, nothing in the
# pack loads it
/assets/
+2 -10
View File
@@ -13,11 +13,7 @@ name: ComfyUI updates
# and required input the example workflows use.
# 4. scripts/dev/face_smoke.mjs puts every node on a graph in headless
# Chrome, in the classic node view and in Nodes 2.0: its face comes up
# and nothing throws. A third run acts like a privacy browser that
# blanks canvas pixel reads: a node that loads a picture must still
# draw it.
# scripts/dev/h3_sockets_check.mjs then checks that H3 Prompt Writer
# still draws only the sockets in use, in both views.
# and nothing throws.
#
# A failure on the release opens an issue (or adds to the open one) and fails
# the run. The development head breaks and mends itself often, so that job
@@ -35,7 +31,6 @@ on:
- "tests/test_comfy_core_contract.py"
- "scripts/compat_boot.py"
- "scripts/dev/face_smoke.mjs"
- "scripts/dev/h3_sockets_check.mjs"
permissions:
contents: read
@@ -122,7 +117,7 @@ jobs:
echo "ComfyUI did not come up"; tail -60 "$GITHUB_WORKSPACE/comfyui.log"; exit 1
- name: Every node is offered and every example still fits
run: python ComfyUI-AusBoss/scripts/compat_boot.py --url http://127.0.0.1:8188 --log comfyui.log
- name: Every node's face comes up, classic, Nodes 2.0 and a privacy browser
- name: Every node's face comes up, classic and Nodes 2.0
run: |
google-chrome --headless=new --remote-debugging-port=9333 --no-sandbox --disable-gpu --disable-dev-shm-usage \
--user-data-dir="$RUNNER_TEMP/chrome" about:blank > "$GITHUB_WORKSPACE/chrome.log" 2>&1 &
@@ -130,9 +125,6 @@ jobs:
status=0
node ComfyUI-AusBoss/scripts/dev/face_smoke.mjs 9333 || status=1
node ComfyUI-AusBoss/scripts/dev/face_smoke.mjs 9333 --vue || status=1
node ComfyUI-AusBoss/scripts/dev/face_smoke.mjs 9333 --blocked-reads || status=1
node ComfyUI-AusBoss/scripts/dev/h3_sockets_check.mjs 9333 || status=1
node ComfyUI-AusBoss/scripts/dev/h3_sockets_check.mjs 9333 --vue || status=1
exit "$status"
- name: ComfyUI's log
if: ${{ always() }}
-33
View File
@@ -11,7 +11,6 @@ on:
# version in pyproject.toml, or on a manual run from main. Editing another
# pyproject field (description, keywords) without a new version publishes
# nothing, and the offline checks must pass before anything is uploaded.
# A successful upload also creates the version's tag and GitHub Release.
# Requires the repository secret REGISTRY_ACCESS_TOKEN, an API key created
# for the "ausboss" publisher at registry.comfy.org.
permissions:
@@ -29,7 +28,6 @@ jobs:
if: ${{ github.repository == 'ausboss/ComfyUI-AusBoss' && github.ref == 'refs/heads/main' }}
outputs:
publish: ${{ steps.version.outputs.publish }}
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v7
with:
@@ -46,7 +44,6 @@ jobs:
run: |
read_version='import sys, tomllib; print(tomllib.loads(sys.stdin.read())["project"]["version"])'
current=$(python -c "$read_version" < pyproject.toml)
echo "version=$current" >> "$GITHUB_OUTPUT"
previous=""
if [ -n "$BEFORE" ] && git cat-file -e "$BEFORE^{commit}" 2>/dev/null; then
previous=$(git show "$BEFORE:pyproject.toml" | python -c "$read_version")
@@ -87,33 +84,3 @@ jobs:
uses: Comfy-Org/publish-node-action@main
with:
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
github-release:
name: Create GitHub Release
needs: [check, publish-node]
if: ${{ needs.check.outputs.publish == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: write
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Publish release notes and tag
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
VERSION: ${{ needs.check.outputs.version }}
run: |
tag="v$VERSION"
if gh release view "$tag" >/dev/null 2>&1; then
echo "Release $tag already exists; leaving it unchanged."
exit 0
fi
python scripts/changelog_notes.py --version "$VERSION" --full > "$RUNNER_TEMP/release-notes.md"
gh release create "$tag" --target "$GITHUB_SHA" --title "$VERSION" \
--notes-file "$RUNNER_TEMP/release-notes.md" --latest
@@ -1,82 +0,0 @@
name: Publish Model Downloader addon
on:
workflow_dispatch:
inputs:
addon_commit:
description: Full commit SHA from ComfyUI-AusBoss-Model-Downloader main
required: true
type: string
changelog:
description: Release note for this version, shown in the Registry's Updates section
required: true
type: string
# The existing AusBoss publisher credential stays in this repository. This
# manual job publishes only the separately maintained Model Downloader addon.
# It does not release or change the main AusBoss node pack.
permissions:
contents: read
concurrency:
group: registry-publish-model-downloader
cancel-in-progress: false
jobs:
publish:
if: github.repository == 'ausboss/ComfyUI-AusBoss' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Require an exact addon commit
env:
ADDON_COMMIT: ${{ inputs.addon_commit }}
run: '[[ "$ADDON_COMMIT" =~ ^[0-9a-f]{40}$ ]]'
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
repository: ausboss/ComfyUI-AusBoss-Model-Downloader
ref: ${{ inputs.addon_commit }}
fetch-depth: 0
persist-credentials: false
- name: Require a commit merged into addon main
run: git merge-base --is-ancestor HEAD origin/main
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7
with:
python-version: '3.12'
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: '24'
package-manager-cache: false
- name: Install validation and publishing tools
run: python -m pip install -r requirements-dev.txt comfy-cli==1.25.0
- name: Offline checks
run: |
python -m unittest discover -s tests -v
ruff check --select F,E9 __init__.py downloader tests scripts
node --test tests/*.test.mjs
node --check js/model_downloader/index.js
node --check js/shared/download_controls.mjs
- name: Build and inspect Registry package
run: |
comfy --skip-prompt --no-enable-telemetry node pack
python scripts/check_registry_package.py
- name: Refuse an existing immutable version
run: python scripts/registry_status.py --require-unpublished
- name: Publish addon
id: publish
env:
REGISTRY_ACCESS_TOKEN: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
COMFY_NODE_CHANGELOG: ${{ inputs.changelog }}
run: |
if [ -z "$REGISTRY_ACCESS_TOKEN" ]; then
echo '::error::REGISTRY_ACCESS_TOKEN is not configured.'
exit 1
fi
if [ -z "${COMFY_NODE_CHANGELOG// /}" ]; then
echo '::error::The changelog input is empty; the Registry shows it as the release note.'
exit 1
fi
comfy --skip-prompt --no-enable-telemetry node publish --token "$REGISTRY_ACCESS_TOKEN"
- name: Report Registry review status
if: always() && steps.publish.outcome != 'skipped'
run: python scripts/registry_status.py --report
+3 -1008
View File
File diff suppressed because it is too large Load Diff
+6 -36
View File
@@ -150,13 +150,6 @@ example_workflows/ # example workflows (regular workflow JSON, not API JSON)
- Category: `🆎 AusBoss/<Group>`. The emoji is safe here — categories reach
the frontend as JSON and are never printed to the console at import time.
- Every node gets `DESCRIPTION`, input `tooltip`s, and `OUTPUT_TOOLTIPS`.
- Words a node face draws itself (card labels, buttons, choices, tooltips)
are translated for a Chinese ComfyUI by `js/i18n/index.js`: add the English
text and its Chinese to `js/shared/i18n_zh.mjs`, or to `STAYS_ENGLISH` there
when it should not change. Text with no entry stays English, and a widget's
name and value are never translated. Never read a label back from the DOM
to decide something; keep that in state (the translator changes the text).
`tests/i18n.test.mjs` fails on a card word with no entry.
- IMAGE tensors are BHWC float batches; MASK is BHW. Return tuples always,
even for one output: `(value,)`.
- Console output at import time must stay ASCII — ComfyUI on Windows often
@@ -200,16 +193,11 @@ example_workflows/ # example workflows (regular workflow JSON, not API JSON)
drag). Messages to the user go through `showToast`, never `alert()`.
- The mouse wheel over a node zooms the graph, on every part of its face.
`js/canvas_passthrough/` hands the wheel on from the pack's panels, and
keeps it only for a box that can still scroll, typed in or not,
keeps it only for a box that can still scroll or a field being typed in,
so a panel adds no wheel listener of its own
(`tests/canvas_passthrough.test.mjs` lists the few that exist). After a
change to a node face, `scripts/dev/wheel_sweep.mjs` turns the wheel at
every point of every node and must find no dead spot, in both renderers.
- For compact panel actions and preview switches, use `compactAction` and
`panelSwitch` from `js/shared/panel_controls.mjs`. That module owns their
appearance, section caption styles, and common file and save labels. A
node styles its layout locally; leave the shared control's face to the
component. Its selectors only match explicitly named AusBoss controls.
- Every INT and FLOAT a public node exposes reaches the user as a scrub
control, Adobe-style: drag the value to scrub, click to type, chevron
arrows step, Shift is always the fine step. Use `makeScrubInput` from
@@ -217,7 +205,8 @@ example_workflows/ # example workflows (regular workflow JSON, not API JSON)
never a classic canvas number widget on a finished node face. Units
(`px`, `MP`, `×`) ride inside the box in a fixed-width slot that every
single-field row reserves, so the numbers down a card share one centre
line. Known, deliberate exception: the Seed card's seed (typed).
line. Known, deliberate exceptions: the Seed card's seed (typed) and Load
Video's trim timecodes (typed).
- **Node faces are widget cards.** A node whose face would be classic
LiteGraph widgets (full-width rows with an arrow at each end) gets an
entry in `js/widget_cards/index.js` instead: `mountWidgetCard` from
@@ -240,13 +229,6 @@ example_workflows/ # example workflows (regular workflow JSON, not API JSON)
widget per row. A value that is meant to be wired rather than typed is a
backend `forceInput: True` socket (Math Expression `a`/`b`/`c`), and a
multi-type string such as `"FLOAT,INT"` accepts either kind of link.
- **App mode** is ComfyUI's form view of a workflow (fields and a Run
button). A file list from the input folder declares its upload flag
(`image_upload`, `video_upload`, `audio_upload`): the form builds the
field's Upload button from it, and without it the field is a bare list.
`tests/test_video_upload_flag.py` holds the video lists to it. A card's
hidden widgets reach the form through `js/app_mode/`, so a card needs
nothing of its own for App mode.
- Preview-carrying nodes (Select Frame, Mask Refine, Mask by Name, LaMa
Inpaint, Save Image) share
`js/input_preview/`: a thin bar (node tools left, a small `preview`
@@ -337,7 +319,7 @@ run by hand against any ComfyUI:
```bash
AUSBOSS_COMFY_ROOT=<ComfyUI> python tests/test_comfy_core_contract.py
python scripts/compat_boot.py --url http://127.0.0.1:8188
node scripts/dev/face_smoke.mjs <chrome port> # and again with --vue, and --blocked-reads
node scripts/dev/face_smoke.mjs <chrome port> # and again with --vue
```
- `test_comfy_core_contract.py` reads the pack's own source for everything
@@ -348,9 +330,7 @@ node scripts/dev/face_smoke.mjs <chrome port> # and again with --vue,
- `compat_boot.py` asks a running ComfyUI which nodes it offers: every public
node of the pack, and every node and required input the examples use.
- `face_smoke.mjs` puts every node on a graph and fails when a face does not
come up or something throws. With `--blocked-reads` it acts like a privacy
browser that blanks pixel reads, and fails when a node that loads a
picture then draws none.
come up or something throws.
A failure on the release opens an issue labelled `comfyui-update`. What these
cannot see is anything that needs a model: run the real thing on a GPU
@@ -360,17 +340,7 @@ before a release that follows a ComfyUI update.
A new `version` in `pyproject.toml` that lands on main publishes to the Comfy
Registry through the publish workflow (`.github/workflows/publish_action.yml`).
After a successful upload, the same workflow tags that commit and creates a
GitHub Release with the full changelog section. The README badge links to the
latest GitHub Release. If only that step fails, rerun the failed jobs to retry
it without uploading the Registry version again. Existing releases are left
unchanged on a rerun. Contributors never change `version`.
For an authorized release, update both `pyproject.toml` and
`AUSBOSS_JS_VERSION`, date the changelog section, then run
`python scripts/release_badge.py`. Preflight rejects a badge that does not
match the pack version. Its SVG lives in the repository so the release
number stays visible when an external badge service is unavailable.
Contributors never change `version`.
The Registry shows notes with each version. They are that version's section
of `CHANGELOG.md`, one line per entry: its bold opening, and for a new node
+15 -121
View File
@@ -3,13 +3,12 @@
<p>ComfyUI nodes for image and video work.</p>
<p>
<img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="MIT License">
<!-- Generated by scripts/release_badge.py. Release preflight checks
the badge against pyproject.toml so it cannot silently go stale. -->
<a href="https://github.com/ausboss/ComfyUI-AusBoss/releases/latest"><img src="assets/readme/release.svg" alt="Latest release"></a>
<!-- Dynamic: shields.io reads the version out of pyproject.toml on main
at view time, so this badge can never go stale. release_preflight.py
checks it stays the dynamic kind. -->
<img src="https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fausboss%2FComfyUI-AusBoss%2Fmain%2Fpyproject.toml&query=%24.project.version&label=release&color=00b4aa&style=flat-square" alt="Release">
<a href="https://www.youtube.com/@ausbossdev"><img src="https://img.shields.io/badge/YouTube-%40ausbossdev-00b4aa?style=flat-square&logo=youtube&logoColor=white" alt="YouTube @ausbossdev"></a>
<a href="https://discord.gg/RwVxY9Fuaj"><img src="https://img.shields.io/badge/Discord-AusBoss-00b4aa?style=flat-square&logo=discord&logoColor=white" alt="Discord: AusBoss"></a>
<a href="https://huggingface.co/ausboss"><img src="https://img.shields.io/badge/Hugging%20Face-ausboss-00b4aa?style=flat-square&logo=huggingface&logoColor=white" alt="Hugging Face: ausboss"></a>
<a href="https://x.com/Zanzibased"><img src="https://img.shields.io/badge/X-%40Zanzibased-00b4aa?style=flat-square&logo=x&logoColor=white" alt="X @Zanzibased"></a>
</p>
</div>
@@ -20,7 +19,6 @@ Most of them are for image and video work. ComfyUI's core nodes already cover th
- **[Mask by Touch](#mask-by-touch):** click a thing on the picture and get its mask. Hover shows what a click would take, and **Fine edges** follows hair and fur.
- **[Mask by Name](#mask-by-name):** type "the red jacket" and get its mask and a cut-out.
- **[Image Crop + Rotate + Pad](#image-crop--rotate--pad):** turn, crop and pad a picture by dragging handles on the node, for outpainting.
- **[Edit Lock](#edit-lock):** an edit changes what you asked for, and the rest of the picture stays exactly where it was. No mask needed.
- **[Stitch Inpaint](#stitch-inpaint):** after an inpaint or outpaint, everything you didn't ask to change is your original pixels again.
- **[Video Crop + Rotate + Pad → Clip](#video-crop--rotate--pad--clip):** trim a clip on a timeline, and pad or crop it to a new shape.
- **[Tiled Upscale](#tiled-upscale):** upscale a picture in tiles to the megapixels you set.
@@ -30,7 +28,7 @@ Most of them are for image and video work. ComfyUI's core nodes already cover th
- **[LoRA Loader](#lora-loader):** a whole LoRA stack in one node, each row with its own switch and strength.
- **[Workflow Switches](#workflow-switches):** turn parts of a workflow off and on from one small card.
The **?** in a classic node's title bar opens a short card with its inputs and outputs. In Nodes 2.0, right-click the node and choose **About this node**. Every node also has a longer help page in ComfyUI's node help panel. I post the workflows I make with them on [Civitai](https://civitai.com/user/AusBoss) and [X @Zanzibased](https://x.com/Zanzibased), and videos of them on [YouTube @ausbossdev](https://www.youtube.com/@ausbossdev). Can't open Civitai? All my workflows are on [my Discord](https://discord.gg/RwVxY9Fuaj) too. If a node saves you time, a star on the repo helps other people find it.
The **?** in a node's title bar opens a short card with its inputs and outputs, and every node has a longer help page in ComfyUI's node help panel. I post the workflows I make with them on [Civitai](https://civitai.com/user/AusBoss) and [X @Zanzibased](https://x.com/Zanzibased), and videos of them on [YouTube @ausbossdev](https://www.youtube.com/@ausbossdev). Can't open Civitai? All my workflows are on [my Discord](https://discord.gg/RwVxY9Fuaj) too. If a node saves you time, a star on the repo helps other people find it.
## Install
@@ -38,27 +36,15 @@ In **ComfyUI-Manager**, open the Custom Nodes Manager, search for **AusBoss** an
```bash
cd ComfyUI/custom_nodes
git clone https://github.com/ausboss/ComfyUI-AusBoss.git ausboss-nodes
git clone https://github.com/ausboss/ComfyUI-AusBoss.git
```
Restart ComfyUI and search the node library for **AusBoss**.
Clone into `ausboss-nodes`, the folder ComfyUI-Manager uses, so Manager sees the same copy and updates it instead of adding a second one. If you also have a `custom_nodes/ComfyUI-AusBoss` folder from an older clone, delete it: with two copies, an old one can keep loading after every update, and its newer nodes show as missing. ComfyUI shows a message naming the folder when this happens.
After an update, through Manager or `git pull`, restart ComfyUI and hard-refresh the browser with **Ctrl+Shift+R**. Otherwise the browser keeps the old JavaScript, and the pack warns you about it. Manager can install a version or two behind while the Comfy Registry reviews a new release. To get the newest one, pick it in Manager's version list, or update by hand: delete the pack's folder in `ComfyUI/custom_nodes` and clone the repository as shown above.
The pack uses the Pillow, NumPy, Torch and PyAV that come with ComfyUI. Each example lists the models it needs on its Workflow Note. LaMa Inpaint also needs [`big-lama.pt`](https://github.com/Sanster/models/releases/download/add_big_lama/big-lama.pt) in `ComfyUI/models/lama/`. The pack never downloads weights by itself.
### Using an AI agent
Your agent (Claude Code, Codex, Cursor or another one) can learn the video workflows: how to write the words for them, set them up, and run them on your computer.
```bash
npx skills add ausboss/ComfyUI-AusBoss
```
Or tell it: "Read https://ausboss-examples.vercel.app/skill.md and help me use these workflows." The skill is [skills/ausboss-workflows/SKILL.md](skills/ausboss-workflows/SKILL.md). For picking and wiring single nodes, point it at the [agent guide](js/docs/agents/README.md).
### Upgrading from 1.x
2.0 removed **LM Studio Chat** (use **Text** for a fixed prompt) and Align Image's `offset_x` and `offset_y` outputs. Math Expression's `a`, `b` and `c` are sockets now instead of typed boxes, so put constants in the expression itself. 1.2 removed **Drop Shadow**, **Pad Image** (use **Load Image + Pad**) and **Frame Chooser**. Save Image writes only inside ComfyUI's output folder. The [changelog](CHANGELOG.md) has the details.
@@ -80,7 +66,7 @@ Or tell it: "Read https://ausboss-examples.vercel.app/skill.md and help me use t
Rotate, crop and pad a picture by dragging handles on the node. Cyan squares crop, orange diamonds pad, and the green handle rotates. It rotates first, then crops, then pads. The full-screen editor adds exact sizes, zoom and pan.
Open **Crop, pad & resize** under the preview and tap a ratio to pad the picture to it, or to crop it with **Fit** set to crop. A lit ratio is the shape the canvas has right now: drag a handle to another shape and it goes dark, and the row says Custom. The padlock at the end of the row keeps the shape while you drag, and the button at the start turns the shape between portrait and landscape. **Reset crop** brings back the whole picture, and **Divisible by** makes the width and height divide evenly by a number such as 8, 16 or 32, for models that need it. Feather and output resizing are on the node and in the editor.
Tap a ratio under the preview to pad the picture to it, or to crop it with **Fit** set to crop. A lit ratio is the shape the canvas has right now: drag a handle to another shape and it goes dark, and the row says Custom. The padlock at the end of the row keeps the shape while you drag, and the button at the start turns the shape between portrait and landscape. **Reset crop** brings back the whole picture, and **Divisible by** makes the width and height divide evenly by a number such as 8, 16 or 32, for models that need it. Feather and output resizing are on the node and in the editor.
It returns the `image`, a `mask` of everything the model paints (padding, see-through parts of the source and the corners a rotation opens up), a `stitcher`, the untouched `original`, the output `width` and `height`, and a `prompt_image`. Wire the stitcher into **Stitch Inpaint** after the sampler to put your original back. See-through parts of a PNG, such as a cutout's missing background, are filled like the padding and painted; `prompt_image` and `original` show them as white. Give `prompt_image` to whatever writes your prompt, so it describes a real backdrop instead of the gray fill. **Load Image + Pad** has more fill choices and a separate reference output.
@@ -90,12 +76,6 @@ It returns the `image`, a `mask` of everything the model paints (padding, see-th
Krea 2 Rotate + Outpaint turns a photo, pads it and paints the new area in one pass. [Try the Krea 2 Rotate + Outpaint example →](example_workflows/Krea%202%20Rotate%20%2B%20Outpaint%20%28AusBoss%29.json)
### Load Image
Loads a picture and sets its size in one node. Pick a file, upload one, or step through the input folder with the arrows. **Size** can stay off, or bring the picture to a megapixel count, a longest side, a scale, a box it must fit inside, or a box it fills by cropping. It can also cut a piece or a shape such as 16:9 out of the picture without resizing, and **Keep** picks which part stays: the center, a side or a corner. **Round to** keeps the result on a multiple of 8, 16 or whatever the model wants. The node shows the picture going in and coming out, with both sizes, before you run, such as `912 × 1632 → 1144 × 2048`.
It returns the `image`, a `mask` of its see-through parts, the new `width` and `height`, the `filename` for a save prefix, and the file's `original_width` and `original_height`.
### Load Image + Pad
Makes a canvas for outpainting: drag the edges out to add room around a picture. The Source list shows the picture under the pointer. The new area can be a solid color, the average color of the nearest edge, the edge pixels smeared outward, a blurred copy of the picture, or a mirror of it. The card also has a seam feather, a canvas multiple and a megapixel budget, and **Exact padding** opens one control per side. A budget of 0 keeps the picture's size, and anything higher resizes the picture before padding. A picture wired into `source_image` is padded instead of the chosen file.
@@ -136,26 +116,10 @@ Rounds a picture's size to a multiple you choose, by resizing, cropping or paddi
Reads a picture's `width`, `height`, `longest_edge`, `shortest_edge` and batch `count` as whole numbers. Wire them into a resize, a latent, a frame count or Math Expression, so the rest of the graph follows the source's size. After a run the node shows each number beside its output.
### Image Toolbox
Small picture jobs in one node, picked from a list. **split sheet at gaps** cuts a row of pictures, such as a character sheet's views, into separate pictures, cutting at the gaps between them so no piece gets part of its neighbour. **cut a piece** cuts out one piece of the width and height you set, at the place you pick, and gives back the rest of the picture too.
### Color Match
Matches a picture's colors to a reference, with LAB, RGB, MKL or histogram transfer. Strength sets how much, and an optional mask (with invert) limits where. With `reference_mode` set to first frame, every frame of a batch matches the batch's first frame. That can cut down color drift in a clip, but it does not steady motion.
### Film Grain
Adds film grain to a picture or a video. The grain is strongest in the midtones and gentler in deep shadows and bright highlights, as on film. **Size** is the grain's size in pixels, **Roughness** mixes in finer grain that bunches up unevenly, and **Color** goes from black-and-white grain to colour film's. On a video the grain moves from frame to frame, or stays put with **Video grain** on *still*. An optional mask adds grain only where it is white, and the same seed always gives the same grain. **Auto** picks the grain for the picture's size, or copies the grain of a picture wired into `grain_from`. The preview shows the result.
### Cut Out
Turns a picture and a mask into a cut-out with a see-through background, ready to save as a PNG (Save Image keeps the transparency) or lay on a new background. Keep the white or the black part of the mask, grow or shrink it and soften its edge. **Clean edges** takes the old background's colour out of hair and soft edges, so the cut-out has no halo; fully kept pixels stay exactly as they were. It also returns the final mask, and works on video. The preview shows the cut-out on a checkerboard.
### Keep Detail
Puts the original picture's fine detail (skin, fabric, grain) back on an edited version that came out too smooth. Wire the edit and the original, which must line up (Realign to Source fixes an edit that drifted). The edit keeps its shapes, light and colour, and only detail smaller than **Detail size** comes from the original. **Light only** never shifts the edit's colours; **color + light** brings the detail's colour too. An optional mask limits where.
### Realign to Source (EXPERIMENTAL 🧪)
Lines an edited picture back up with the original. Qwen Image 2.1 often draws an edit, especially a style change, a little bigger or shifted: up to about 12% taller, by a different amount every seed. Wire in the edit and the picture it was made from. The node measures how far the edit moved and moves it back, at the original's size. It fixes the zoom and shift of the whole picture, not shapes the edit redrew in a new place, so the result lines up closely rather than pixel for pixel.
@@ -172,18 +136,6 @@ The same watercolor edit without and with Realign to Source: 61 px off before, 0
Qwen drew this watercolor 5.6% taller, and Realign to Source lined it back up with the original.
### Edit Lock
Keeps every part of your picture that an edit did not change exactly where it was, with the colors it had. An edit model redraws the whole picture, so the parts you did not ask about often come back a little zoomed in, shifted or tinted, and the picture jumps when you flip between before and after. Put Edit Lock between the model and the sampler and give it the picture you are editing. It needs no mask: it sees what the edit changes while the picture is being made, and holds on to everything else.
When the edit changes the whole picture (a new style, new light), there is nothing to keep, so the node steps aside and the edit runs as usual. A soft effect over the whole picture, such as rain or falling snow, is let through as well: the node then only holds the picture in place. **Lock** (`lock`) set to `off` does nothing at all, `always` locks even a whole-picture edit, and an optional `mask` says where the edit may happen. **Tolerance** (`tolerance`) sets how big a change must be to count as part of the edit.
On MiniMax-H3-Image, 4 megapixel edits moved the picture by up to 14 px without the lock (measured at 1 megapixel) and by 0.2 px or less with it (0.08 px or less on 35 of the 36 locked runs), on 19 local edits at two seeds each. After five edits in a row on one picture the plain chain had drifted 1.65 px and turned visibly pink; the locked chain sat at 0.04 px with no tint.
### Edit Lock Restore
Puts your picture's own pixels back in every part the edit did not change. Edit Lock keeps those parts in place, but they still pass through the VAE, which softens fine detail a little. Add this right after the VAE Decode and wire in Edit Lock's `edit_lock` output. **Feather** (`feather`) sets how softly the original fades into the edit. It also returns `edit_mask`, white where the edit changed the picture, and a one-line `report` of how much was kept.
### Image Compare A/B
Compares two pictures with a slider, or flips between them whole. Nothing covers the picture, and its size shows underneath. The panel grows with the node, and images A and B pass through, so you can put it anywhere on an image wire. **Erase** mixes the two by hand: rub parts of one picture away with a brush so the other shows through, then save the mix as a PNG under a name you type, with a layered PSD for Photoshop or GIMP if you want it.
@@ -206,25 +158,19 @@ The example keeps the clip's audio when there is any. The outpaint LoRA needs a
### Load Video
Upload a video, or pick one from the Source list, which plays the clip under the pointer. Set the part you want with Start, Duration and Ends at, in seconds or frames, or drag the handles under the player. The player plays the part you kept and can loop it. Width and height resize while decoding, and setting only one keeps the shape. `every_nth` skips frames and lowers the reported fps so the timing stays right, and the Duration caps how many frames load.
Upload a video, or pick one from the Source list, which plays the clip under the pointer. Trim it with IN and OUT handles or typed timecodes. The player plays the part you kept and can loop it. Width and height resize while decoding, and setting only one keeps the shape. `every_nth` skips frames and lowers the reported fps so the timing stays right, and `max_frames` caps how many frames load.
It returns the frames, audio, frame count, fps, width, height, duration and a core `VIDEO`. Only the part you kept is decoded, and it checks memory before a large load. When you save the frames, wire its fps into the save node.
### Load Audio
Upload a sound file, or pick one from the Source list, and the node shows it as a wave. Drag the two handles to keep only the part you want, or type a Start, a Duration or an Ends at. Press play to hear just that part. Set the Duration to the length the next step needs, such as a video's length.
It returns the `audio` you kept and its length in `seconds`. Only that part is decoded. [Help page](js/docs/AUSBOSS_NODES_LoadAudio.md).
### Video Crop + Rotate + Pad → Frame
Picks one frame from a video, then gives you the same rotate, crop and pad controls as the image node, plus an optional megapixel resize. Scrub to the frame with the playhead on the node; the editor adds frame-by-frame stepping and playback. It returns the transformed `image`, a `mask` of the added area, a `stitcher`, the chosen `original` frame, and the output `width` and `height`. For a whole clip, use the Clip version below.
### Video Crop + Rotate + Pad → Clip
Applies one rotate, crop and pad to every frame of a trimmed clip. It has the source picker, a timeline with a playhead and frame-accurate start and end handles, Start, Duration and Ends at boxes, frame skipping, the transform handles and output resizing. While you drag a trim handle, the node shows the exact first or last frame the run keeps. The bright part of the selection is what gets output.
Applies one rotate, crop and pad to every frame of a trimmed clip. It has the source picker, a timeline with a playhead and frame-accurate IN and OUT handles, frame skipping, a frame limit, the transform handles and output resizing. While you drag a trim handle, the node shows the exact first or last frame the run keeps. The bright part of the selection is what gets output.
Fill, feather and the resize budget are in **Crop, pad & resize** below the timeline, and a new clip keeps them. That matters for video outpainting, because the black, hard-edged canvas the model needs survives a source swap. A fresh Clip node starts with that canvas, and the editor's **Reset transform** goes back to it. **Frames for** trims the end to the frame count the next video model takes: LTX (8n+1) or Wan (4n+1). Tap a ratio to pad the clip to it; a new clip is padded to the lit ratio too. The padlock keeps the shape while you drag a handle.
Fill, feather and the resize budget sit on the node face, and a new clip keeps them. That matters for video outpainting, because the black, hard-edged canvas the model needs survives a source swap. A fresh Clip node starts with that canvas, and the editor's **Reset transform** goes back to it. **Frames for** trims the end to the frame count the next video model takes: LTX (8n+1) or Wan (4n+1). Tap a ratio to pad the clip to it; a new clip is padded to the lit ratio too. The padlock keeps the shape while you drag a handle.
It returns the frames, mask, audio, frame count, fps, size, duration, a `stitcher`, and the chosen `original` frames before the transform. **Inpaint & Stitch** in the editor sets the protected source area and previews the blend. After a video outpaint, wire the stitcher straight into **Stitch Inpaint**, with no Crop For Inpaint in between. It works in chunks to keep memory down.
@@ -240,21 +186,15 @@ Picks one frame from a batch, unchanged: `1` is the first, `-1` the last and `-2
### Frame Interpolate
Changes a clip's frame rate by making in-between frames. You set the source and target fps, so 24 to 30 works as well as doubling. The blend method crossfades frames, and optical flow uses RAFT weights you put in place yourself. At a hard cut it holds the frame instead of blending two shots together, even when both shots show the same place. It works in chunks to keep memory down.
Changes a clip's frame rate by making in-between frames. You set the source and target fps, so 24 to 30 works as well as doubling. The blend method crossfades frames, and optical flow uses RAFT weights you put in place yourself. At a hard cut it holds the frame instead of blending two unrelated shots. It works in chunks to keep memory down.
It returns the new frames and their fps. It doesn't touch audio, so carry the source audio to Save Video separately. The [help page](js/docs/AUSBOSS_NODES_FrameInterpolate.md) covers the weights and timing.
### FlashVSR Upscale
Makes a video larger and sharper with the FlashVSR model. Set **Scale** from 1 to 4 and it returns every frame at the new size, with fine detail drawn back in. It reads the clip a few frames at a time, so a long clip needs no more graphics memory than a short one, and a result too large for the free memory is made in tiles.
It needs one model file in `ComfyUI/models/diffusion_models` and no other pack. The [help page](js/docs/AUSBOSS_NODES_FlashVSRUpscale.md) has the download link, the memory it needs and the speed. [Try the FlashVSR Video Upscale example →](example_workflows/FlashVSR%20Video%20Upscale%20%28AusBoss%29.json)
### Save Video
Saves a frame batch or a core `VIDEO` as MP4 (H.264 or H.265), WebM (VP9 or AV1), ProRes MOV, lossless FFV1 MKV, GIF or WebP. Which encoders you get depends on your FFmpeg and PyAV build, and H.264 and H.265 come in CPU and NVENC versions. The videos carry color tags, and optionally audio and the workflow.
**Ping-pong** plays forward and then back without repeating the turnaround frames. A wired `VIDEO` brings its own frame rate; otherwise wire fps from Load Video or Frame Interpolate. The player on the node shows the saved file, and **Preview steps** shows the clip's first frame while it is being made, with a **STOP** button. Drop a saved video back on the canvas to load the workflow inside it, for the formats that can hold one. The [help page](js/docs/AUSBOSS_NODES_SaveVideo.md) has the format and audio details.
**Ping-pong** plays forward and then back without repeating the turnaround frames. A wired `VIDEO` brings its own frame rate; otherwise wire fps from Load Video or Frame Interpolate. The player on the node shows the saved file, and **STEPS** shows the clip's first frame while it is being made, with a **STOP** button. Drop a saved video back on the canvas to load the workflow inside it, for the formats that can hold one. The [help page](js/docs/AUSBOSS_NODES_SaveVideo.md) has the format and audio details.
## Mask and inpaint nodes
@@ -332,16 +272,12 @@ In the **+ LoRA** list, tick several files to add them at once. Rows can be gath
When a file has moved, the node finds it by name if only one file matches. A missing LoRA that is switched on stops the run by default. Turn off **Stop on missing LoRA** to warn and skip it instead. A LoRA that changes nothing in the model gets a warning with its file name.
Wire a [Strength Curve](#strength-curve) into the `curve` input and click the curve mark on a row, and that row's strength changes over the run: fade a style LoRA out so the last steps come out clean. It works with every model file, fp8 and int8 included.
### Krea 2 Encode
Krea 2's positive and negative prompts in one card. Connect a VAE and reference pictures, and it adds them as references too, resized for the model first. **VLM reference** sets whether the text encoder also looks at them. Leave the references empty for plain text to image. For an outpaint, connect the pad node's mask too: the model then sees the new area in your picture's own colour instead of gray, so it paints it rather than keeping a gray frame.
The prompt box takes several lines and a linked text. The [help page](js/docs/AUSBOSS_NODES_Krea2Encode.md) covers preparing references. With an outpaint LoRA, copy the wiring from the matching example.
Wire a [Strength Curve](#strength-curve) into `reference_curve` and the picture follows the references as strongly as the curve says at each step, from 1 (as today) to 0 (ignored): hold the layout early and let go late.
### Krea 2 Outpaint Model Patch
Tells Krea 2 where a reference picture sits on the canvas. It's made for Krea 2 outpaint LoRAs, and the two that exist want different placements. Put it after the LoRAs and before the sampler, and connect a stitcher and the reference conditioning from Krea 2 Encode.
@@ -357,29 +293,6 @@ Here Krea 2 Outpaint takes a 16:9 photo to 4:5 in one pass. [Open the Krea 2 Out
The patch relies on ComfyUI's internal attention code. Its [help page](js/docs/AUSBOSS_NODES_Krea2OutpaintModelPatch.md) explains both setups and what happens without reference conditioning.
### Strength Curve
Draw how strong something should be from the first step of a run to the last: drag the points, or start from flat, fade out, fade in, ease out or ease in. **Top** and **Bottom** set the strength at the top and bottom of the curve box. Wire the curve into LoRA Loader's `curve` (rows you mark follow it) or Krea 2 Encode's `reference_curve`. The output is ComfyUI's list of numbers (`FLOATS`), so it also feeds ComfyUI's own hook keyframe nodes.
## 3D viewer
### Pause for Shot
Stops a run right after a **Preview 3D (Advanced)** viewer, so you can frame your shot on the model that run just made. Turn the camera, zoom, move the model, then press **Continue**: the run goes on with the shot exactly as the viewer shows it, and nothing before the pause runs again. **Stop** ends the run there. Wire a 360 picture into `panorama` and it shows behind the model while you frame, and `backdrop` hands on the part of it the camera sees, with an optional floor shadow. Set **Pause** to *run through* for runs nobody is watching.
### Photo Camera
Works out the camera your photo was taken with, so a 3D model of the person lines up with the photo. Made for **Pixal3D**, the TRELLIS 2 model that builds the model lined up with the photo. Wire in the photo, the person's mask and the photo's lens width (**Get FoV from MoGe** measures it). It hands Pixal3D the crop's lens, the 3D viewer your photo's own view (so the viewer opens where the photo was taken), and where the photo goes on a 360 canvas so the 360 lines up behind the model.
### Extras in ComfyUI's 3D viewers
The pack also adds to ComfyUI's own 3D viewers, with no new node:
- **Shape chips** above the width and height of Preview 3D (Advanced) and Save 3D (Advanced): pick a shape and the frame follows.
- **Blender keys** with the mouse over a viewer: G move, R rotate, S scale, X / Y / Z to lock an axis, a typed number for an exact amount, the number keys for front, side and top views, and Home to frame the model.
- **Viewport tools** in the top-right corner: drag the axis gizmo to orbit, the magnifier to zoom, the hand to pan, and a grid switch.
- **A 360 strip** (press N, or the small 360 tab): spin and tip the model, cut its front or back away, turn, tilt and roll the 360 background, its brightness and blur, the light and the model's colours. The settings save with the workflow.
## Workflow utilities
Core ComfyUI has its own nodes for most of these jobs, and they work fine. These versions add the extras described under each one.
@@ -400,8 +313,6 @@ Drag to draw a box, drag it to move it and its handles to size it; under the can
The `mask` output is white inside every box: load a picture, draw a box over the words on a sign, and an inpaint chain can write new words there while the rest of the picture stays as it was. For words at a slant, drag the round handle over a box to turn it: the mask turns with it, and a turned text box tells the model its slant.
For a model that reads only a prompt and has no box input, the `placement` output says the boxes as plain sentences, what goes in each box and where, to add to your prompt.
![Layout Boxes over a photo of a woman in front of a neon ramen sign: a text box is drawn over the sign, AUSBOSS and red neon letters are typed in, and MOSS-Image's result wipes in with the sign reading AUSBOSS.](assets/readme/layout-boxes.gif)
### Seed
@@ -424,20 +335,10 @@ Puts batch `b` after `a`. When the sizes match, nothing is resized. When they di
A text box that grows with the node and sends its text, unchanged, down a `STRING` wire. Use it for a prompt, caption, path or other text that several nodes share. Spaces and line breaks are kept. Ctrl + Up and Ctrl + Down change the weight of the selected words, as in ComfyUI's own prompt boxes.
### Text Lines
Runs what comes after once for each line of your text. Type five prompts, one on each line, and one run makes five pictures. It also takes a list another node wrote, skips empty lines, and can take a leading `1.` or `-` off each line. `number` counts the lines from 1, to give each its own seed.
### Prompt Variations
A prompt box that changes on every run. Write choices in curly brackets, split by `|`, such as `a {red|blue|green} {sweater|jacket}`, and the node picks one from each set. Wire in the seed your sampler uses: a new seed gives a new mix, and the same seed gives the same prompt again. Set the seed to randomize and queue 50 runs to get 50 different prompts. Text without brackets comes out exactly as typed, so a JSON prompt is safe.
### H3 Prompt Writer
Type what happens, one line for each moment, and leave a blank line to cut to a new place. Connect up to four pictures and give each one a job: a person, a place, an outfit, a thing or a style. Copy the moves from a video, keep a clip going, or add a voice or a song. A timeline on the node shows when each moment plays before you run it. It needs no extra model and you never see H3's prompt format. Connect a small text model and it fills in a one-line idea.
**Change something** edits the named part of a video while keeping its person and sound. For a person swap, an optional `@1 looks like ...` line describes the connected replacement. Jobs that keep the source clip's length show **From the clip**; the `keeps_clip_sound` output helps a workflow choose the source audio.
### Integer
One whole number (`INT`) on a scrub control, for sharing a size, count or other whole number across nodes. Like every number box in the pack, it takes a typed sum: `1024*1.5`.
@@ -466,10 +367,6 @@ A setup card for a shared workflow: a title, instructions in Markdown, each mode
A note for the canvas whose text grows to fill it, so it reads without zooming in. Double-click to type; a blank line starts a new point and `**two stars**` stress a word. Type an arrow emoji such as ⬆️ and it turns into a teal arrow in the middle of the line. Click a node while you edit, then press an arrow, and the arrow is linked to that node: click it later and the canvas brings the node into view. It never runs and has no wires.
### Compact note and link tiles
**Callout Tile** shows a compact title or colored YouTube/Discord link button. **Workflow Note Tile** opens a full help note from a compact button. They reuse the note editors and save as distinct node types, so an older install reports a missing node instead of drawing an incompatible plain note. Install or update ComfyUI-AusBoss, restart ComfyUI and reload when either tile is missing. Existing ordinary notes and callouts keep their original types.
### Run Timer
A stopwatch for the whole run, with no wires. It starts when the queue starts running, holds the total when the run ends, and saves the last time with the workflow. Recent times are in its right-click menu. You can resize it. It only shows time and doesn't change how the graph runs.
@@ -484,7 +381,7 @@ Turns parts of a workflow off and on from one small card. Select the nodes of on
## Example workflows
These are the workflows where the nodes do something core ComfyUI doesn't do by itself: outpainting and inpainting that put your original picture back, lining an edit back up with its source, upscaling a picture in tiles, masking a thing by its name or with a click, removing a watermark from a clip, and making a clip larger and sharper. Open a JSON file from [`example_workflows/`](example_workflows), or find them under this pack in ComfyUI's template browser. Each one has a thumbnail, numbered groups and a Workflow Note with the setup steps and model downloads.
These are the workflows where the nodes do something core ComfyUI doesn't do by itself: outpainting and inpainting that put your original picture back, lining an edit back up with its source, upscaling a picture in tiles, masking a thing by its name or with a click, and removing a watermark from a clip. Open a JSON file from [`example_workflows/`](example_workflows), or find them under this pack in ComfyUI's template browser. Each one has a thumbnail, numbered groups and a Workflow Note with the setup steps and model downloads.
![The Krea 2 Rotate + Outpaint workflow: a setup note on the left, then groups for your input, the two boxes and the model loaders, and the result with a before-and-after slider and Save Image.](assets/readme/workflow-layout.webp)
@@ -505,7 +402,6 @@ The workflows open with their image and video loaders empty, so you load your ow
| [Mask by Name](example_workflows/Mask%20by%20Name%20%28AusBoss%29.json) | Type what to find in a picture, and get its mask and a cut-out with a see-through background | ComfyUI's own SAM 3.1 (ComfyUI 0.20 or newer) |
| [Mask by Touch](example_workflows/Mask%20by%20Touch%20%28AusBoss%29.json) | Click a thing in a picture, or its whole subject, and get its mask and a cut-out with hair-fine edges | ComfyUI's own SAM 3.1 and its background-removal model (ComfyUI 0.21 or newer) |
| [Simple Video Watermark Remover](example_workflows/Simple%20Video%20Watermark%20Remover%20%28AusBoss%29.json) | Find an overlay in a clip and remove it, with a one-frame comparison branch | ComfyUI's own SAM 3.1 (ComfyUI 0.20 or newer), plus `big-lama.pt` |
| [FlashVSR Video Upscale](example_workflows/FlashVSR%20Video%20Upscale%20%28AusBoss%29.json) | Make a clip larger and sharper with one node | `flashvsr_v1.1_fp16.safetensors` |
Every example uses only core nodes and this pack. Speed and memory use depend on the models, the sizes, the frame count and whatever else is using the GPU.
@@ -515,7 +411,6 @@ If you share workflows, a few of these nodes help the people who download them:
- **Workflow Note** puts a setup card on the canvas with each model's download link, folder and size, the node packs it needs and your links, and checks them against the reader's install.
- **Callout** is a note with big readable text and teal arrows you type with an emoji.
- **Check layout 🆎** lists overlaps, hidden and backwards wires and nodes outside the groups before you share.
- **Image Compare A/B** shows the result against its source with a slider.
- **Seed** keeps runs repeatable, and **Use last run** brings back the seed the last run used.
- **Run Timer** shows how long the whole run took, so a speed note is measured.
@@ -527,10 +422,9 @@ People who download your workflow get the nodes through ComfyUI-Manager's missin
## Pack-wide tools
- **Help cards:** the **?** in a classic node's title bar opens its description, inputs and outputs. Nodes 2.0 and titleless nodes such as Run Timer have **About this node** in their right-click menu.
- **Help cards:** the **?** in a node's title bar opens its description, inputs and outputs. Run Timer has no title bar, so it has **About this node** in its right-click menu.
- **Recreate node 🆎** (right-click an AusBoss node) rebuilds a node saved by an older version from the current definition. It keeps the values, links, position and colors.
- **Replace with AusBoss nodes 🆎** (canvas right-click or the command palette) finds third-party nodes this pack can stand in for, such as VideoHelperSuite's Load Video and Video Combine or KJNodes' Color Match. It previews each swap and replaces the ones you leave ticked.
- **Check layout 🆎** (canvas right-click or the command palette) lists what makes a workflow hard to read: overlapping nodes and groups (title bars included), wires that run backwards or hide behind a node, a node just under one that grows when it shows a picture, nodes outside every group, a saved zoom too small for the text to draw, and a missing Workflow Note. It checks inside every subgraph too. Click an entry to jump to it and select it. It moves nothing.
- **Snap into line:** a node, group or selection you drag lines up with the nodes and groups around it, edge to edge or middle to middle, and a teal line shows what it lines up with. Pulling a corner to resize lines up the same way. Hold Shift while you drag to skip it, or turn it off in Settings → 🆎 AusBoss → Canvas.
- **Line up:** select two or more nodes or groups and the selection toolbar gets a Line up button: line up edges or middles, match widths or heights, or space them evenly. With two or more nodes selected, pulling the edge or corner of one resizes them all: a column gets one width, a row one height, a grid both (turn it off in Settings → 🆎 AusBoss → Canvas → Resize together).
- **Node colors:** Settings → 🆎 AusBoss → Appearance sets the scheme for every AusBoss node (AusBoss, Graphite, Slate, Teal, Moss, Plum, Rust, Navy, Custom or Theme default). A node's right-click **AusBoss color** menu recolors just that node, and nodes you colored by hand keep their colors.
@@ -543,7 +437,7 @@ People who download your workflow get the nodes through ComfyUI-Manager's missin
- Hold Shift while you turn the green rotation handle to snap to 15° steps.
- In the full-screen editor, the mouse wheel zooms, and the middle mouse button or Alt-drag pans. On the node itself, the wheel and middle mouse button still move the graph.
- **Alt+E** opens the selected node's transform editor. Change the key in Settings → Keybindings.
- The video editors have frame stepping, playback and exact timeline seeking, on the node face as well as in the editor. The Clip node's start and end handles sit on the source's own frames, so the frame shown at the start is the first one decoded and the frame shown at the end is the last.
- The video editors have frame stepping, playback and exact timeline seeking, on the node face as well as in the editor. The Clip node's IN and OUT handles sit on the source's own frames, so the frame shown for IN is the first one decoded and the frame shown for OUT is the last.
- Your own aspect presets go in `ausboss_presets.json` beside the pack. Copy [`ausboss_presets_example.json`](ausboss_presets_example.json) to start. Your file survives updates.
LoRA Loader and Latent Size have their own gear menus for per-node preferences.
+12 -62
View File
@@ -11,6 +11,7 @@ of taking the whole pack down, so one broken node never hides the rest.
import importlib
import os
import re
import traceback
# One entry per file in nodes/, kept alphabetical. The order has no
@@ -21,10 +22,6 @@ NODE_MODULES = [
"node_callout",
"node_color_match",
"node_compare",
"node_cut_out",
"node_edit_lock",
"node_film_grain",
"node_flashvsr_upscale",
"node_frame_interpolate",
"node_free_memory",
"node_h3_prompt_writer",
@@ -32,25 +29,18 @@ NODE_MODULES = [
"node_image_folder",
"node_image_resize",
"node_image_size",
"node_image_toolbox",
"node_inpaint_crop_stitch",
"node_keep_detail",
"node_krea2_encode",
"node_krea2_model_patch",
"node_lama_inpaint",
"node_layout_boxes",
"node_literals",
"node_load_image",
"node_load_image_pad",
"node_load_audio",
"node_load_video",
"node_lora_loader",
"node_mask_by_name",
"node_mask_by_touch",
"node_math",
"node_pause_shot",
"node_photo_camera",
"node_prompt_variations",
"node_realign_to_source",
"node_refine_mask",
"node_resolution",
@@ -61,8 +51,6 @@ NODE_MODULES = [
"node_select_frame",
"node_show_text",
"node_step_preview",
"node_strength_curve",
"node_text_lines",
"node_tiled_upscale",
"node_video_crop_rotate_pad",
"node_video_crop_rotate_pad_clip",
@@ -74,19 +62,7 @@ NODE_CLASS_MAPPINGS = {}
NODE_DISPLAY_NAME_MAPPINGS = {}
_failed_modules = []
# Two copies of the pack (a Manager install beside a git clone) add every
# route twice and ComfyUI stops while starting. Only one copy loads.
_other_copy = None
try:
from .nodes._single_copy import other_copy_that_loads
_other_copy = other_copy_that_loads(os.path.dirname(__file__))
except Exception:
traceback.print_exc()
for _module_name in NODE_MODULES:
if _other_copy:
break
try:
_module = importlib.import_module(f".nodes.{_module_name}", __name__)
NODE_CLASS_MAPPINGS.update(getattr(_module, "NODE_CLASS_MAPPINGS", {}))
@@ -98,10 +74,8 @@ for _module_name in NODE_MODULES:
traceback.print_exc()
# Folder ComfyUI serves to the browser; every .js file in it is loaded as a
# frontend extension. Shared modules use .mjs so they are import-only. A copy
# that steps aside serves only the script that warns about it in the browser,
# since the console line alone is easy to miss.
WEB_DIRECTORY = "./web_second_copy" if _other_copy else "./js"
# frontend extension. Shared modules use .mjs so they are import-only.
WEB_DIRECTORY = "./js"
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY"]
@@ -109,11 +83,10 @@ __all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY"]
def _read_version():
"""Version straight from pyproject.toml so it is never duplicated."""
try:
from .nodes._pyproject import read_project
pyproject = os.path.join(os.path.dirname(__file__), "pyproject.toml")
version = read_project(pyproject).get("version")
return version if isinstance(version, str) and version.strip() else "unknown"
with open(pyproject, "r", encoding="utf-8") as f:
match = re.search(r'^version\s*=\s*"([^"]+)"', f.read(), re.MULTILINE)
return match.group(1) if match else "unknown"
except Exception:
return "unknown"
@@ -138,34 +111,11 @@ def _print_banner():
print(bar)
def _print_second_copy():
# ASCII only, as in the banner.
red = "\033[0;31m"
reset = "\033[0m"
own = os.path.basename(os.path.dirname(os.path.realpath(__file__)))
other = os.path.basename(_other_copy["folder"])
print(f"{red}AusBoss: this pack is installed twice.{reset}")
print(f" Using: custom_nodes/{other} (v{_other_copy['version']})")
print(f" Skipping: custom_nodes/{own} (v{_read_version()})")
print(" Delete one of the two folders, then restart ComfyUI.")
try:
from .nodes._frontend_cache import register_frontend_cache_guard
register_frontend_cache_guard()
except Exception:
traceback.print_exc()
if _other_copy:
_print_second_copy()
try:
from .nodes._single_copy import register_second_copy_notice, second_copy_notice
register_second_copy_notice(
second_copy_notice(os.path.dirname(__file__), _read_version(), _other_copy)
)
except Exception:
traceback.print_exc()
else:
try:
from .nodes._frontend_cache import register_frontend_cache_guard
register_frontend_cache_guard()
except Exception:
traceback.print_exc()
_print_banner()
_print_banner()
-9
View File
@@ -1,9 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="105" height="20" role="img" aria-label="release: v2.30.0">
<title>release: v2.30.0</title>
<path fill="#555" d="M0 0h48v20H0z"/>
<path fill="#00b4aa" d="M48 0h57v20H48z"/>
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
<text x="24" y="14">release</text>
<text x="76.5" y="14">v2.30.0</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 425 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

+1 -2
View File
@@ -42,8 +42,7 @@ recipe.
| `cdp_drag.mjs <port> <setup.js> <mid.png\|-> <after.png\|-> [check.js]` | `setup.js` returns `{from, to, __clip}` in client pixels; presses at `from`, moves to `to`, screenshots mid-drag, releases, evaluates `check.js`, screenshots again |
| `audit_workflows.mjs <port> <output-dir> [workflow.json ...]` | loads every example (or selected files), exports API and loaded graphs, captures screenshots, and fails on overlaps, missing nodes, browser exceptions, or exposed AusBoss number widgets |
| `wheel_sweep.mjs <port> [--vue] [--only=Type,Type] [--workflow=file.json] [--shots=dir]` | turns the mouse wheel at every point of every node of the pack (or of the nodes in one workflow) and fails on any spot where the graph does not zoom, naming the element that took the wheel; `--real` sends real wheel turns, slower and on a coarser grid |
| `face_smoke.mjs <port> [--vue] [--blocked-reads] [--only=Type,Type]` | puts one of each node of the pack on an empty graph and fails when a face does not come up: no node, a panel that is not on the page or has no size, an error thrown, a file of the pack that did not load. `--blocked-reads` acts like a privacy browser that blanks canvas pixel reads, gives every node that loads a picture a sample picture, and fails when its face then draws no picture. Needs no model, so it also runs in the nightly ComfyUI check |
| `h3_sockets_check.mjs <port> [--vue]` | puts H3 Prompt Writer on a graph and reads the screen: which socket rows are drawn fresh, wired, unwired, after undo, a paste, a collapse and a switch of renderer, what a run would send, and what a save would write. Fails when a row shows or hides against the rule in `js/shared/h3_sockets.mjs`. `H3_LIVE_WORKFLOWS` adds saved workflows to open. Needs no model, so it also runs in the nightly ComfyUI check |
| `face_smoke.mjs <port> [--vue] [--only=Type,Type]` | puts one of each node of the pack on an empty graph and fails when a face does not come up: no node, a panel that is not on the page or has no size, an error thrown, a file of the pack that did not load. Needs no model, so it also runs in the nightly ComfyUI check |
| `cdp_nav_debug.mjs <port>` | navigates the tab in place and logs every CDP event, for when a tab stops answering |
| `cdp_hang.mjs <port>` | pre-arms the debugger on a fresh tab, loads ComfyUI, and pauses to print the stack if the page stops answering |
Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 KiB

@@ -1,993 +0,0 @@
{
"id": "aba7bd0c-8de6-4044-a89e-cada288c8911",
"revision": 0,
"last_node_id": 15,
"last_link_id": 11,
"nodes": [
{
"id": 1,
"type": "AUSBOSS_NODES_WorkflowNote",
"pos": [
0,
30
],
"size": [
440,
640
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"Node name for S&R": "AUSBOSS_NODES_WorkflowNote"
},
"widgets_values": [
"{\"v\":1,\"title\":\"Film Grain, Cut Out and Keep Detail\",\"subtitle\":\"Finish a picture: add film grain, cut it out, or put back detail an edit smoothed away.\",\"author\":\"AusBoss\",\"layout\":\"card\",\"accent\":\"\",\"body\":\"[▶ AusBoss on YouTube](https://www.youtube.com/@ausbossdev) · videos on these nodes and workflows\\n\\n---\\n\\n1. Load your picture.\\n2. Press **Run**. Each node shows its result, and Save Image keeps it.\\n\\n### Good to know\\n\\n- **Film Grain** works on video too: new grain on every frame, or the same grain with **Video grain** on *still*.\\n- **Cut Out** gets its mask from two core nodes, Convert Image to Mask and Threshold Mask, so it needs no model. Wire Mask by Name or Mask by Touch for a real subject. The PNG keeps the transparency.\\n- **Keep Detail** needs the two pictures to line up. Image Blur here stands in for an edit; wire your own edit and the original.\\n\\nRuns on the CPU, with nothing to download. Needs AusBoss nodes newer than 2.28.1.\",\"models\":[],\"packs\":[{\"name\":\"ComfyUI-AusBoss\",\"url\":\"https://github.com/ausboss/ComfyUI-AusBoss\",\"node\":\"AUSBOSS_NODES_KeepDetail\"}],\"links\":[{\"label\":\"YouTube · ausbossdev\",\"url\":\"https://www.youtube.com/@ausbossdev\"},{\"label\":\"GitHub · ausboss\",\"url\":\"https://github.com/ausboss\"},{\"label\":\"Civitai · AusBoss\",\"url\":\"https://civitai.com/user/AusBoss\"},{\"label\":\"X · Zanzibased\",\"url\":\"https://x.com/Zanzibased\"}]}"
],
"widgets_values_named": {
"note": "{\"v\":1,\"title\":\"Film Grain, Cut Out and Keep Detail\",\"subtitle\":\"Finish a picture: add film grain, cut it out, or put back detail an edit smoothed away.\",\"author\":\"AusBoss\",\"layout\":\"card\",\"accent\":\"\",\"body\":\"[▶ AusBoss on YouTube](https://www.youtube.com/@ausbossdev) · videos on these nodes and workflows\\n\\n---\\n\\n1. Load your picture.\\n2. Press **Run**. Each node shows its result, and Save Image keeps it.\\n\\n### Good to know\\n\\n- **Film Grain** works on video too: new grain on every frame, or the same grain with **Video grain** on *still*.\\n- **Cut Out** gets its mask from two core nodes, Convert Image to Mask and Threshold Mask, so it needs no model. Wire Mask by Name or Mask by Touch for a real subject. The PNG keeps the transparency.\\n- **Keep Detail** needs the two pictures to line up. Image Blur here stands in for an edit; wire your own edit and the original.\\n\\nRuns on the CPU, with nothing to download. Needs AusBoss nodes newer than 2.28.1.\",\"models\":[],\"packs\":[{\"name\":\"ComfyUI-AusBoss\",\"url\":\"https://github.com/ausboss/ComfyUI-AusBoss\",\"node\":\"AUSBOSS_NODES_KeepDetail\"}],\"links\":[{\"label\":\"YouTube · ausbossdev\",\"url\":\"https://www.youtube.com/@ausbossdev\"},{\"label\":\"GitHub · ausboss\",\"url\":\"https://github.com/ausboss\"},{\"label\":\"Civitai · AusBoss\",\"url\":\"https://civitai.com/user/AusBoss\"},{\"label\":\"X · Zanzibased\",\"url\":\"https://x.com/Zanzibased\"}]}"
},
"color": "#14424d",
"bgcolor": "#161f21"
},
{
"id": 2,
"type": "LoadImage",
"pos": [
500,
272
],
"size": [
424,
760
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
1,
3,
5,
8,
10
]
},
{
"name": "MASK",
"type": "MASK",
"links": null
}
],
"title": "Your picture",
"properties": {
"Node name for S&R": "LoadImage"
},
"widgets_values": [
"",
"image"
],
"widgets_values_named": {
"image": "",
"upload": "image"
},
"color": "#14424d",
"bgcolor": "#161f21"
},
{
"id": 3,
"type": "AUSBOSS_NODES_Callout",
"pos": [
500,
80
],
"size": [
424,
122
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [],
"outputs": [],
"title": "Callout",
"properties": {
"Node name for S&R": "AUSBOSS_NODES_Callout"
},
"widgets_values": [
"⬇️#2 Load your **picture** here."
],
"widgets_values_named": {
"text": "⬇️#2 Load your **picture** here."
},
"color": "#07090a",
"bgcolor": "#07090a"
},
{
"id": 4,
"type": "AUSBOSS_NODES_FilmGrain",
"pos": [
984,
272
],
"size": [
424,
449
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 1
},
{
"name": "mask",
"shape": 7,
"type": "MASK",
"link": null
}
],
"outputs": [
{
"name": "image",
"type": "IMAGE",
"links": [
2
]
}
],
"properties": {
"Node name for S&R": "AUSBOSS_NODES_FilmGrain"
},
"widgets_values": [
0.3,
1.2,
0.5,
0.2,
true,
0,
true
],
"widgets_values_named": {
"amount": 0.3,
"size": 1.2,
"roughness": 0.5,
"color": 0.2,
"moving": true,
"seed": 0,
"preview": true
},
"color": "#14424d",
"bgcolor": "#161f21"
},
{
"id": 5,
"type": "AUSBOSS_NODES_Callout",
"pos": [
984,
80
],
"size": [
424,
122
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [],
"outputs": [],
"title": "Callout",
"properties": {
"Node name for S&R": "AUSBOSS_NODES_Callout"
},
"widgets_values": [
"⬇️#4 Set the **grain**.\n###### Amount is how strong, Size how big each grain is in pixels. Color 0 is black-and-white grain."
],
"widgets_values_named": {
"text": "⬇️#4 Set the **grain**.\n###### Amount is how strong, Size how big each grain is in pixels. Color 0 is black-and-white grain."
},
"color": "#07090a",
"bgcolor": "#07090a"
},
{
"id": 6,
"type": "AUSBOSS_NODES_SaveImage",
"pos": [
984,
791
],
"size": [
424,
422
],
"flags": {},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 2
},
{
"name": "filename",
"shape": 7,
"type": "STRING",
"link": null
},
{
"name": "caption_text",
"shape": 7,
"type": "STRING",
"link": null
}
],
"outputs": [
{
"name": "file_path",
"type": "STRING",
"links": null
},
{
"name": "images",
"type": "IMAGE",
"links": null
}
],
"title": "Save Image - With grain",
"properties": {
"Node name for S&R": "AUSBOSS_NODES_SaveImage"
},
"widgets_values": {
"filename_prefix": "film_grain",
"format": "png",
"save_metadata": true,
"exact_name": "",
"on_existing": "overwrite",
"output_dir": "",
"caption": "",
"name_counter": true,
"name_date": false,
"name_time": false,
"name_size": false,
"name_batch": false,
"preview": false,
"step_preview": false,
"autosave": true,
"civitai_info": false
},
"widgets_values_named": {
"filename_prefix": "film_grain",
"format": "png",
"save_metadata": true,
"exact_name": "",
"on_existing": "overwrite",
"output_dir": "",
"caption": "",
"name_counter": true,
"name_date": false,
"name_time": false,
"name_size": false,
"name_batch": false,
"preview": false,
"step_preview": false,
"autosave": true,
"civitai_info": false
},
"color": "#14424d",
"bgcolor": "#161f21"
},
{
"id": 7,
"type": "AUSBOSS_NODES_Callout",
"pos": [
1468,
80
],
"size": [
424,
122
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [],
"outputs": [],
"title": "Callout",
"properties": {
"Node name for S&R": "AUSBOSS_NODES_Callout"
},
"widgets_values": [
"The mask is the picture's blue channel, with no model.\n###### Wire your own mask here, such as one from Mask by Name."
],
"widgets_values_named": {
"text": "The mask is the picture's blue channel, with no model.\n###### Wire your own mask here, such as one from Mask by Name."
},
"color": "#07090a",
"bgcolor": "#07090a"
},
{
"id": 8,
"type": "ImageToMask",
"pos": [
1468,
272
],
"size": [
424,
58
],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 3
}
],
"outputs": [
{
"name": "MASK",
"type": "MASK",
"links": [
4
]
}
],
"title": "Convert Image to Mask - Blue channel",
"properties": {
"Node name for S&R": "ImageToMask"
},
"widgets_values": [
"blue"
],
"widgets_values_named": {
"channel": "blue"
},
"color": "#14424d",
"bgcolor": "#161f21"
},
{
"id": 9,
"type": "ThresholdMask",
"pos": [
1468,
400
],
"size": [
424,
58
],
"flags": {},
"order": 10,
"mode": 0,
"inputs": [
{
"name": "mask",
"type": "MASK",
"link": 4
}
],
"outputs": [
{
"name": "MASK",
"type": "MASK",
"links": [
6
]
}
],
"title": "Threshold Mask - Sky and mist",
"properties": {
"Node name for S&R": "ThresholdMask"
},
"widgets_values": [
0.55
],
"widgets_values_named": {
"value": 0.55
},
"color": "#14424d",
"bgcolor": "#161f21"
},
{
"id": 10,
"type": "AUSBOSS_NODES_CutOut",
"pos": [
1468,
528
],
"size": [
424,
418
],
"flags": {},
"order": 12,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 5
},
{
"name": "mask",
"type": "MASK",
"link": 6
}
],
"outputs": [
{
"name": "image",
"type": "IMAGE",
"links": [
7
]
},
{
"name": "alpha",
"type": "MASK",
"links": null
}
],
"properties": {
"Node name for S&R": "AUSBOSS_NODES_CutOut"
},
"widgets_values": [
"black",
0,
1,
true,
0,
1,
0,
true
],
"widgets_values_named": {
"keep": "black",
"grow": 0,
"feather": 1,
"clean_edges": true,
"clear_haze": 0,
"solid_above": 1,
"smooth_frames": 0,
"preview": true
},
"color": "#14424d",
"bgcolor": "#161f21"
},
{
"id": 11,
"type": "AUSBOSS_NODES_SaveImage",
"pos": [
1468,
1016
],
"size": [
424,
422
],
"flags": {},
"order": 14,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 7
},
{
"name": "filename",
"shape": 7,
"type": "STRING",
"link": null
},
{
"name": "caption_text",
"shape": 7,
"type": "STRING",
"link": null
}
],
"outputs": [
{
"name": "file_path",
"type": "STRING",
"links": null
},
{
"name": "images",
"type": "IMAGE",
"links": null
}
],
"title": "Save Image - The cut-out",
"properties": {
"Node name for S&R": "AUSBOSS_NODES_SaveImage"
},
"widgets_values": {
"filename_prefix": "cut_out",
"format": "png",
"save_metadata": true,
"exact_name": "",
"on_existing": "overwrite",
"output_dir": "",
"caption": "",
"name_counter": true,
"name_date": false,
"name_time": false,
"name_size": false,
"name_batch": false,
"preview": false,
"step_preview": false,
"autosave": true,
"civitai_info": false
},
"widgets_values_named": {
"filename_prefix": "cut_out",
"format": "png",
"save_metadata": true,
"exact_name": "",
"on_existing": "overwrite",
"output_dir": "",
"caption": "",
"name_counter": true,
"name_date": false,
"name_time": false,
"name_size": false,
"name_batch": false,
"preview": false,
"step_preview": false,
"autosave": true,
"civitai_info": false
},
"color": "#14424d",
"bgcolor": "#161f21"
},
{
"id": 12,
"type": "AUSBOSS_NODES_Callout",
"pos": [
1952,
80
],
"size": [
424,
122
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [],
"outputs": [],
"title": "Callout",
"properties": {
"Node name for S&R": "AUSBOSS_NODES_Callout"
},
"widgets_values": [
"Image Blur stands in for an edit that came out too smooth.\n###### Edge safe is off under More, because a blur softens strong edges too. Wire your own edit to image and the original to detail_from."
],
"widgets_values_named": {
"text": "Image Blur stands in for an edit that came out too smooth.\n###### Edge safe is off under More, because a blur softens strong edges too. Wire your own edit to image and the original to detail_from."
},
"color": "#07090a",
"bgcolor": "#07090a"
},
{
"id": 13,
"type": "ImageBlur",
"pos": [
1952,
272
],
"size": [
424,
82
],
"flags": {},
"order": 8,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 8
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
9
]
}
],
"title": "Image Blur - Stands in for a smooth edit",
"properties": {
"Node name for S&R": "ImageBlur"
},
"widgets_values": [
4,
2
],
"widgets_values_named": {
"blur_radius": 4,
"sigma": 2
},
"color": "#14424d",
"bgcolor": "#161f21"
},
{
"id": 14,
"type": "AUSBOSS_NODES_KeepDetail",
"pos": [
1952,
424
],
"size": [
424,
407
],
"flags": {},
"order": 11,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 9
},
{
"name": "detail_from",
"type": "IMAGE",
"link": 10
},
{
"name": "mask",
"shape": 7,
"type": "MASK",
"link": null
}
],
"outputs": [
{
"name": "image",
"type": "IMAGE",
"links": [
11
]
}
],
"properties": {
"Node name for S&R": "AUSBOSS_NODES_KeepDetail"
},
"widgets_values": [
4,
1,
false,
false,
true
],
"widgets_values_named": {
"detail_size": 4,
"strength": 1,
"color_detail": false,
"edge_safe": false,
"preview": true
},
"color": "#14424d",
"bgcolor": "#161f21"
},
{
"id": 15,
"type": "AUSBOSS_NODES_SaveImage",
"pos": [
1952,
901
],
"size": [
424,
422
],
"flags": {},
"order": 13,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 11
},
{
"name": "filename",
"shape": 7,
"type": "STRING",
"link": null
},
{
"name": "caption_text",
"shape": 7,
"type": "STRING",
"link": null
}
],
"outputs": [
{
"name": "file_path",
"type": "STRING",
"links": null
},
{
"name": "images",
"type": "IMAGE",
"links": null
}
],
"title": "Save Image - With the detail back",
"properties": {
"Node name for S&R": "AUSBOSS_NODES_SaveImage"
},
"widgets_values": {
"filename_prefix": "keep_detail",
"format": "png",
"save_metadata": true,
"exact_name": "",
"on_existing": "overwrite",
"output_dir": "",
"caption": "",
"name_counter": true,
"name_date": false,
"name_time": false,
"name_size": false,
"name_batch": false,
"preview": false,
"step_preview": false,
"autosave": true,
"civitai_info": false
},
"widgets_values_named": {
"filename_prefix": "keep_detail",
"format": "png",
"save_metadata": true,
"exact_name": "",
"on_existing": "overwrite",
"output_dir": "",
"caption": "",
"name_counter": true,
"name_date": false,
"name_time": false,
"name_size": false,
"name_batch": false,
"preview": false,
"step_preview": false,
"autosave": true,
"civitai_info": false
},
"color": "#14424d",
"bgcolor": "#161f21"
}
],
"links": [
[
1,
2,
0,
4,
0,
"IMAGE"
],
[
2,
4,
0,
6,
0,
"IMAGE"
],
[
3,
2,
0,
8,
0,
"IMAGE"
],
[
4,
8,
0,
9,
0,
"MASK"
],
[
5,
2,
0,
10,
0,
"IMAGE"
],
[
6,
9,
0,
10,
1,
"MASK"
],
[
7,
10,
0,
11,
0,
"IMAGE"
],
[
8,
2,
0,
13,
0,
"IMAGE"
],
[
9,
13,
0,
14,
0,
"IMAGE"
],
[
10,
2,
0,
14,
1,
"IMAGE"
],
[
11,
14,
0,
15,
0,
"IMAGE"
]
],
"groups": [
{
"id": 1,
"title": "1 · Your picture",
"bounding": [
480,
0,
464,
1458
],
"color": "#1d5560",
"flags": {}
},
{
"id": 2,
"title": "2 · Film Grain",
"bounding": [
964,
0,
464,
1458
],
"color": "#1d5560",
"flags": {}
},
{
"id": 3,
"title": "3 · Cut Out",
"bounding": [
1448,
0,
464,
1458
],
"color": "#1d5560",
"flags": {}
},
{
"id": 4,
"title": "4 · Keep Detail",
"bounding": [
1932,
0,
464,
1458
],
"color": "#1d5560",
"flags": {}
}
],
"config": {},
"extra": {
"ds": {
"scale": 0.6,
"offset": [
20,
60
]
},
"frontendVersion": "1.58.5",
"reroutes": [
{
"id": 1,
"pos": [
954,
222
],
"linkIds": [
3,
5,
8,
10
]
},
{
"id": 2,
"parentId": 1,
"pos": [
1438,
222
],
"linkIds": [
3,
5,
8,
10
]
},
{
"id": 3,
"parentId": 2,
"pos": [
1922,
222
],
"linkIds": [
8,
10
]
}
],
"linkExtensions": [
{
"id": 3,
"parentId": 2
},
{
"id": 5,
"parentId": 2
},
{
"id": 8,
"parentId": 3
},
{
"id": 10,
"parentId": 3
}
]
},
"version": 0.4
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

@@ -1,561 +0,0 @@
{
"id": "0b455c1f-6b0c-4f69-8a7e-86f8de61df5c",
"revision": 0,
"last_node_id": 5,
"last_link_id": 4,
"nodes": [
{
"id": 1,
"type": "AUSBOSS_NODES_WorkflowNote",
"pos": [
0,
30
],
"size": [
440,
640
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [
{
"name": "note",
"type": "STRING",
"link": null,
"widget": {
"name": "note"
}
}
],
"outputs": [],
"title": "🆎 AusBoss",
"properties": {
"cnr_id": "ausboss-nodes",
"ver": "2.24.0",
"Node name for S&R": "AUSBOSS_NODES_WorkflowNote"
},
"widgets_values": [
"{\"v\": 1, \"title\": \"FlashVSR Video Upscale\", \"subtitle\": \"Make a video larger and sharper with one node and one model file.\", \"author\": \"AusBoss\", \"layout\": \"card\", \"accent\": \"\", \"body\": \"[▶ AusBoss on YouTube](https://www.youtube.com/@ausbossdev) · videos on these nodes and workflows\\n\\n---\\n\\n1. Load your video.\\n2. Set **Scale**: how many times larger each side gets. At 1 the video keeps its size and is only sharpened.\\n3. Press **Run**, then play the result in **Save Video**.\\n\\nTo try a short piece first, drag the right end of the bar under the player in Load Video.\\n\\nA long video needs no more graphics memory than a short one. A large result is made in tiles, so it fits the memory you have and takes longer.\\n\\nNeeds AusBoss nodes 2.24.0 or newer. No other pack is needed.\", \"models\": [{\"name\": \"flashvsr_v1.1_fp16.safetensors\", \"dir\": \"diffusion_models\", \"size\": \"3.5 GB\", \"url\": \"https://huggingface.co/ausboss/FlashVSR-v1.1-ComfyUI/resolve/main/flashvsr_v1.1_fp16.safetensors\", \"note\": \"FlashVSR v1.1 by Junhao Zhuang and the OpenImagingLab team, in one file\"}], \"packs\": [{\"name\": \"ComfyUI-AusBoss\", \"url\": \"https://github.com/ausboss/ComfyUI-AusBoss\", \"node\": \"AUSBOSS_NODES_FlashVSRUpscale\"}], \"links\": [{\"label\": \"YouTube · ausbossdev\", \"url\": \"https://www.youtube.com/@ausbossdev\"}, {\"label\": \"GitHub · ausboss\", \"url\": \"https://github.com/ausboss\"}, {\"label\": \"Civitai · AusBoss\", \"url\": \"https://civitai.com/user/AusBoss\"}, {\"label\": \"X · Zanzibased\", \"url\": \"https://x.com/Zanzibased\"}]}",
""
],
"widgets_values_named": {
"note": "{\"v\": 1, \"title\": \"FlashVSR Video Upscale\", \"subtitle\": \"Make a video larger and sharper with one node and one model file.\", \"author\": \"AusBoss\", \"layout\": \"card\", \"accent\": \"\", \"body\": \"[▶ AusBoss on YouTube](https://www.youtube.com/@ausbossdev) · videos on these nodes and workflows\\n\\n---\\n\\n1. Load your video.\\n2. Set **Scale**: how many times larger each side gets. At 1 the video keeps its size and is only sharpened.\\n3. Press **Run**, then play the result in **Save Video**.\\n\\nTo try a short piece first, drag the right end of the bar under the player in Load Video.\\n\\nA long video needs no more graphics memory than a short one. A large result is made in tiles, so it fits the memory you have and takes longer.\\n\\nNeeds AusBoss nodes 2.24.0 or newer. No other pack is needed.\", \"models\": [{\"name\": \"flashvsr_v1.1_fp16.safetensors\", \"dir\": \"diffusion_models\", \"size\": \"3.5 GB\", \"url\": \"https://huggingface.co/ausboss/FlashVSR-v1.1-ComfyUI/resolve/main/flashvsr_v1.1_fp16.safetensors\", \"note\": \"FlashVSR v1.1 by Junhao Zhuang and the OpenImagingLab team, in one file\"}], \"packs\": [{\"name\": \"ComfyUI-AusBoss\", \"url\": \"https://github.com/ausboss/ComfyUI-AusBoss\", \"node\": \"AUSBOSS_NODES_FlashVSRUpscale\"}], \"links\": [{\"label\": \"YouTube · ausbossdev\", \"url\": \"https://www.youtube.com/@ausbossdev\"}, {\"label\": \"GitHub · ausboss\", \"url\": \"https://github.com/ausboss\"}, {\"label\": \"Civitai · AusBoss\", \"url\": \"https://civitai.com/user/AusBoss\"}, {\"label\": \"X · Zanzibased\", \"url\": \"https://x.com/Zanzibased\"}]}",
"ausboss_workflow_note_panel": ""
},
"color": "#14424d",
"bgcolor": "#161f21"
},
{
"id": 2,
"type": "AUSBOSS_NODES_LoadVideo",
"pos": [
500,
80
],
"size": [
420,
760
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [
{
"name": "video",
"type": "COMBO",
"link": null,
"widget": {
"name": "video"
}
},
{
"name": "start_seconds",
"type": "FLOAT",
"link": null,
"widget": {
"name": "start_seconds"
}
},
{
"name": "end_seconds",
"type": "FLOAT",
"link": null,
"widget": {
"name": "end_seconds"
}
},
{
"name": "custom_width",
"type": "INT",
"link": null,
"widget": {
"name": "custom_width"
}
},
{
"name": "custom_height",
"type": "INT",
"link": null,
"widget": {
"name": "custom_height"
}
},
{
"name": "every_nth",
"type": "INT",
"link": null,
"widget": {
"name": "every_nth"
}
},
{
"name": "max_frames",
"type": "INT",
"link": null,
"widget": {
"name": "max_frames"
}
},
{
"name": "single_frame",
"type": "BOOLEAN",
"link": null,
"widget": {
"name": "single_frame"
}
},
{
"name": "upload",
"type": "IMAGEUPLOAD",
"link": null,
"widget": {
"name": "upload"
}
}
],
"outputs": [
{
"name": "frames",
"type": "IMAGE",
"links": [
1
]
},
{
"name": "audio",
"type": "AUDIO",
"links": [
3
]
},
{
"name": "frame_count",
"type": "INT",
"links": []
},
{
"name": "fps",
"type": "FLOAT",
"links": [
4
]
},
{
"name": "width",
"type": "INT",
"links": []
},
{
"name": "height",
"type": "INT",
"links": []
},
{
"name": "duration",
"type": "FLOAT",
"links": []
},
{
"name": "video",
"type": "VIDEO",
"links": []
}
],
"title": "Load Video - Your video",
"properties": {
"cnr_id": "ausboss-nodes",
"ver": "2.24.0",
"Node name for S&R": "AUSBOSS_NODES_LoadVideo",
"ausboss_load_video_loop": true
},
"widgets_values": {
"video": "",
"start_seconds": 0,
"end_seconds": 0,
"custom_width": 0,
"custom_height": 0,
"every_nth": 1,
"max_frames": 0,
"single_frame": false
},
"widgets_values_named": {
"video": "",
"start_seconds": 0,
"end_seconds": 0,
"custom_width": 0,
"custom_height": 0,
"every_nth": 1,
"max_frames": 0,
"single_frame": false,
"upload": "image",
"ausboss_widget_card": "",
"ausboss_load_video_viewer": ""
},
"color": "#14424d",
"bgcolor": "#161f21"
},
{
"id": 3,
"type": "AUSBOSS_NODES_FlashVSRUpscale",
"pos": [
980,
80
],
"size": [
360,
190
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [
{
"name": "frames",
"type": "IMAGE",
"link": 1
},
{
"name": "vae",
"type": "VAE",
"shape": 7,
"link": null
},
{
"name": "model",
"type": "COMBO",
"link": null,
"widget": {
"name": "model"
}
},
{
"name": "scale",
"type": "FLOAT",
"link": null,
"widget": {
"name": "scale"
}
},
{
"name": "color_match",
"type": "BOOLEAN",
"link": null,
"widget": {
"name": "color_match"
}
}
],
"outputs": [
{
"name": "frames",
"type": "IMAGE",
"links": [
2
]
}
],
"title": "FlashVSR Upscale",
"properties": {
"cnr_id": "ausboss-nodes",
"ver": "2.24.0",
"Node name for S&R": "AUSBOSS_NODES_FlashVSRUpscale",
"models": [
{
"name": "flashvsr_v1.1_fp16.safetensors",
"url": "https://huggingface.co/ausboss/FlashVSR-v1.1-ComfyUI/resolve/main/flashvsr_v1.1_fp16.safetensors",
"directory": "diffusion_models"
}
]
},
"widgets_values": [
"flashvsr_v1.1_fp16.safetensors",
2,
true,
""
],
"widgets_values_named": {
"model": "flashvsr_v1.1_fp16.safetensors",
"scale": 2,
"color_match": true,
"ausboss_widget_card": ""
},
"color": "#14424d",
"bgcolor": "#161f21"
},
{
"id": 4,
"type": "AUSBOSS_NODES_SaveVideo",
"pos": [
1400,
80
],
"size": [
440,
640
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [
{
"name": "frames",
"type": "IMAGE",
"link": 2
},
{
"name": "audio",
"type": "AUDIO",
"link": 3
},
{
"name": "video",
"type": "VIDEO",
"link": null
},
{
"name": "fps",
"type": "FLOAT",
"link": 4
},
{
"name": "filename_prefix",
"type": "STRING",
"link": null,
"widget": {
"name": "filename_prefix"
}
},
{
"name": "crf",
"type": "INT",
"link": null
},
{
"name": "format",
"type": "COMBO",
"link": null,
"widget": {
"name": "format"
}
},
{
"name": "pingpong",
"type": "BOOLEAN",
"link": null,
"widget": {
"name": "pingpong"
}
},
{
"name": "save_metadata",
"type": "BOOLEAN",
"link": null,
"widget": {
"name": "save_metadata"
}
}
],
"outputs": [
{
"name": "file_path",
"type": "STRING",
"links": []
}
],
"title": "Save Video",
"properties": {
"cnr_id": "ausboss-nodes",
"ver": "2.24.0",
"Node name for S&R": "AUSBOSS_NODES_SaveVideo",
"ausboss_save_video_loop": true
},
"widgets_values": {
"fps": 24,
"filename_prefix": "flashvsr_upscaled",
"crf": 19,
"format": "mp4 h264",
"pingpong": false,
"save_metadata": true
},
"widgets_values_named": {
"fps": 24,
"filename_prefix": "flashvsr_upscaled",
"crf": 19,
"format": "mp4 h264",
"pingpong": false,
"save_metadata": true,
"ausboss_widget_card": "",
"ausboss_save_video_viewer": ""
},
"color": "#14424d",
"bgcolor": "#161f21"
},
{
"id": 5,
"type": "AUSBOSS_NODES_RunTimer",
"pos": [
1515,
770
],
"size": [
210,
67
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [],
"title": "Run Timer",
"properties": {
"cnr_id": "ausboss-nodes",
"ver": "2.24.0",
"Node name for S&R": "AUSBOSS_NODES_RunTimer"
},
"color": "#14424d",
"bgcolor": "#161f21"
}
],
"links": [
[
1,
2,
0,
3,
0,
"IMAGE"
],
[
2,
3,
0,
4,
0,
"IMAGE"
],
[
3,
2,
1,
4,
1,
"AUDIO"
],
[
4,
2,
3,
4,
3,
"FLOAT"
]
],
"groups": [
{
"id": 1,
"title": "1 · Your video",
"bounding": [
480,
0,
460,
880
],
"color": "#1d5560",
"flags": {}
},
{
"id": 2,
"title": "2 · Make it larger",
"bounding": [
960,
0,
400,
880
],
"color": "#1d5560",
"flags": {}
},
{
"id": 3,
"title": "3 · Result",
"bounding": [
1380,
0,
480,
880
],
"color": "#1d5560",
"flags": {}
}
],
"definitions": {
"subgraphs": []
},
"config": {},
"extra": {
"ds": {
"scale": 0.73,
"offset": [
137,
20
]
},
"reroutes": [
{
"id": 1,
"pos": [
950,
310
],
"linkIds": [
3,
4
]
},
{
"id": 2,
"parentId": 1,
"pos": [
1370,
310
],
"linkIds": [
3,
4
]
}
],
"linkExtensions": [
{
"id": 3,
"parentId": 2
},
{
"id": 4,
"parentId": 2
}
]
},
"version": 0.4
}
@@ -1706,7 +1706,7 @@
"type": "SetLatentNoiseMask",
"pos": [
20,
398
354
],
"size": [
460,
@@ -1947,7 +1947,7 @@
"type": "KSampler",
"pos": [
1100,
338
304
],
"size": [
460,
@@ -2325,7 +2325,7 @@
0,
0,
500,
470
428
],
"color": "#1d5560",
"flags": {}
@@ -2349,7 +2349,7 @@
1080,
0,
500,
620
586
],
"color": "#1d5560",
"flags": {}
@@ -2361,7 +2361,7 @@
1620,
0,
500,
620
529
],
"color": "#1d5560",
"flags": {}
@@ -2446,8 +2446,7 @@
"origin_slot": 0,
"target_id": 11,
"target_slot": 0,
"type": "CONDITIONING",
"parentId": 1
"type": "CONDITIONING"
},
{
"id": 34,
@@ -2554,19 +2553,7 @@
"type": "IMAGE"
}
],
"extra": {},
"reroutes": [
{
"id": 1,
"pos": [
1060,
540
],
"linkIds": [
33
]
}
]
"extra": {}
}
]
},
@@ -2579,92 +2566,7 @@
20
]
},
"frontendVersion": "1.53.6",
"reroutes": [
{
"id": 1,
"pos": [
1040,
188
],
"linkIds": [
14
]
},
{
"id": 2,
"parentId": 1,
"pos": [
1580,
188
],
"linkIds": [
14
]
},
{
"id": 3,
"pos": [
1580,
325
],
"linkIds": [
4
]
},
{
"id": 4,
"pos": [
1562,
450
],
"linkIds": [
10
]
},
{
"id": 5,
"pos": [
1580,
425
],
"linkIds": [
11
]
},
{
"id": 6,
"pos": [
1604,
400
],
"linkIds": [
12
]
}
],
"linkExtensions": [
{
"id": 14,
"parentId": 2
},
{
"id": 4,
"parentId": 3
},
{
"id": 10,
"parentId": 4
},
{
"id": 11,
"parentId": 5
},
{
"id": 12,
"parentId": 6
}
]
"frontendVersion": "1.53.6"
},
"version": 0.4
}
@@ -1913,7 +1913,7 @@
"The painted area, grown a little, is filled with flat gray, so Krea 2 knows where to paint. The plain crop goes along too."
],
"widgets_values_named": {
"text": "The painted area, grown a little, is filled with flat gray, so Krea 2 knows where to paint. The plain crop goes along too."
"text": "The painted area, grown a little, is filled with flat gray. Krea 2 never sees what you are replacing."
},
"color": "#1f2c38",
"bgcolor": "#2a3b4a"
@@ -2769,7 +2769,7 @@
"type": "KSampler",
"pos": [
1100,
646
546
],
"size": [
460,
@@ -3052,7 +3052,7 @@
"The gray-filled crop is the reference. Painting starts from the plain crop, inside the noise mask: the painted area, widened by 24 px."
],
"widgets_values_named": {
"text": "The gray-filled crop is the reference. Painting starts from the plain crop, inside the noise mask: the painted area, widened by 24 px."
"text": "The gray-filled crop is the reference. The noise mask is the grown painted area, widened by 24 px. Krea 2 paints only inside it."
},
"color": "#1f2c38",
"bgcolor": "#2a3b4a"
@@ -3088,8 +3088,8 @@
"id": 37,
"type": "Reroute",
"pos": [
1082,
510
1100,
450
],
"size": [
75,
@@ -3150,7 +3150,7 @@
"id": 47,
"type": "Reroute",
"pos": [
1118,
1200,
450
],
"size": [
@@ -3214,7 +3214,7 @@
1080,
0,
500,
928
828
],
"color": "#1d5560",
"flags": {}
@@ -3226,7 +3226,7 @@
1620,
0,
500,
600
529
],
"color": "#1d5560",
"flags": {}
@@ -3466,8 +3466,7 @@
"type": "FLOAT"
}
],
"extra": {},
"reroutes": []
"extra": {}
}
]
},
@@ -3480,117 +3479,7 @@
96
]
},
"frontendVersion": "1.53.6",
"reroutes": [
{
"id": 1,
"pos": [
964,
350
],
"linkIds": [
70
]
},
{
"id": 2,
"pos": [
976,
410
],
"linkIds": [
79
]
},
{
"id": 3,
"pos": [
952,
860
],
"linkIds": [
71
]
},
{
"id": 4,
"parentId": 3,
"pos": [
964,
430
],
"linkIds": [
71
]
},
{
"id": 5,
"pos": [
1556,
420
],
"linkIds": [
73
]
},
{
"id": 6,
"pos": [
1576,
450
],
"linkIds": [
74
]
},
{
"id": 7,
"pos": [
955,
188
],
"linkIds": [
42
]
},
{
"id": 8,
"parentId": 7,
"pos": [
1564,
188
],
"linkIds": [
42
]
}
],
"linkExtensions": [
{
"id": 70,
"parentId": 1
},
{
"id": 79,
"parentId": 2
},
{
"id": 71,
"parentId": 4
},
{
"id": 73,
"parentId": 5
},
{
"id": 74,
"parentId": 6
},
{
"id": 42,
"parentId": 8
}
]
"frontendVersion": "1.53.6"
},
"version": 0.4
}
}
@@ -2183,7 +2183,7 @@
1080,
0,
500,
600
529
],
"color": "#1d5560",
"flags": {}
@@ -2375,8 +2375,7 @@
"type": "MASK"
}
],
"extra": {},
"reroutes": []
"extra": {}
}
]
},
@@ -2389,78 +2388,7 @@
20
]
},
"frontendVersion": "1.53.6",
"reroutes": [
{
"id": 1,
"pos": [
950,
188
],
"linkIds": [
31
]
},
{
"id": 2,
"parentId": 1,
"pos": [
1462,
188
],
"linkIds": [
31
]
},
{
"id": 3,
"pos": [
1468,
325
],
"linkIds": [
43
]
},
{
"id": 4,
"pos": [
1444,
475
],
"linkIds": [
50
]
},
{
"id": 5,
"pos": [
1468,
450
],
"linkIds": [
51
]
}
],
"linkExtensions": [
{
"id": 31,
"parentId": 2
},
{
"id": 43,
"parentId": 3
},
{
"id": 50,
"parentId": 4
},
{
"id": 51,
"parentId": 5
}
]
"frontendVersion": "1.53.6"
},
"version": 0.4
}
@@ -612,7 +612,7 @@
"type": "2f8cb72f-ebab-4ed9-bb0c-328a4e6493d9",
"pos": [
1020,
380
238
],
"size": [
240,
@@ -2139,10 +2139,10 @@
"title": "Note",
"properties": {},
"widgets_values": [
"Blend in fades the model's picture into yours just inside its edge. Tone match is fully on, so the new area is adjusted to your picture's tone."
"Blend in fades the model's picture into yours just inside its edge, with no tone shift. The new area stays as painted."
],
"widgets_values_named": {
"text": "Blend in fades the model's picture into yours just inside its edge. Tone match is fully on, so the new area is adjusted to your picture's tone."
"text": "Blend in fades the model's picture into yours just inside its edge, with no tone shift. The new area stays as painted."
},
"color": "#1f2c38",
"bgcolor": "#2a3b4a"
@@ -2180,7 +2180,7 @@
1080,
0,
500,
600
529
],
"color": "#1d5560",
"flags": {}
@@ -2372,8 +2372,7 @@
"type": "MASK"
}
],
"extra": {},
"reroutes": []
"extra": {}
}
]
},
@@ -2386,131 +2385,7 @@
20
]
},
"frontendVersion": "1.53.6",
"reroutes": [
{
"id": 1,
"pos": [
950,
188
],
"linkIds": [
31
]
},
{
"id": 2,
"parentId": 1,
"pos": [
1580,
188
],
"linkIds": [
31
]
},
{
"id": 3,
"pos": [
968,
900
],
"linkIds": [
48
]
},
{
"id": 4,
"parentId": 3,
"pos": [
984,
350
],
"linkIds": [
48
]
},
{
"id": 5,
"pos": [
1564,
450
],
"linkIds": [
50
]
},
{
"id": 6,
"pos": [
1596,
400
],
"linkIds": [
51
]
},
{
"id": 7,
"pos": [
955,
182
],
"linkIds": [
44
]
},
{
"id": 8,
"pos": [
955,
194
],
"linkIds": [
45
]
},
{
"id": 9,
"pos": [
955,
206
],
"linkIds": [
46
]
}
],
"linkExtensions": [
{
"id": 31,
"parentId": 2
},
{
"id": 48,
"parentId": 4
},
{
"id": 50,
"parentId": 5
},
{
"id": 51,
"parentId": 6
},
{
"id": 44,
"parentId": 7
},
{
"id": 45,
"parentId": 8
},
{
"id": 46,
"parentId": 9
}
]
"frontendVersion": "1.53.6"
},
"version": 0.4
}
@@ -2785,7 +2785,7 @@
1080,
0,
500,
780
719
],
"color": "#1d5560",
"flags": {}
@@ -2990,8 +2990,7 @@
"origin_slot": 0,
"target_id": 19,
"target_slot": 0,
"type": "CONDITIONING",
"parentId": 1
"type": "CONDITIONING"
},
{
"id": 147,
@@ -2999,8 +2998,7 @@
"origin_slot": 1,
"target_id": 19,
"target_slot": 1,
"type": "CONDITIONING",
"parentId": 2
"type": "CONDITIONING"
},
{
"id": 148,
@@ -3067,29 +3065,7 @@
"type": "FLOAT"
}
],
"extra": {},
"reroutes": [
{
"id": 1,
"pos": [
1080,
900
],
"linkIds": [
146
]
},
{
"id": 2,
"pos": [
1090,
900
],
"linkIds": [
147
]
}
]
"extra": {}
}
]
},
@@ -3102,53 +3078,7 @@
25
]
},
"frontendVersion": "1.53.6",
"reroutes": [
{
"id": 1,
"pos": [
1508,
325
],
"linkIds": [
63
]
},
{
"id": 2,
"pos": [
1476,
475
],
"linkIds": [
59
]
},
{
"id": 3,
"pos": [
1508,
400
],
"linkIds": [
60
]
}
],
"linkExtensions": [
{
"id": 63,
"parentId": 1
},
{
"id": 59,
"parentId": 2
},
{
"id": 60,
"parentId": 3
}
]
"frontendVersion": "1.53.6"
},
"version": 0.4
}
+1 -30
View File
@@ -1280,36 +1280,7 @@
60
]
},
"frontendVersion": "1.53.6",
"reroutes": [
{
"id": 1,
"pos": [
1464,
205
],
"linkIds": [
5
]
},
{
"id": 2,
"parentId": 1,
"pos": [
1924,
205
],
"linkIds": [
5
]
}
],
"linkExtensions": [
{
"id": 5,
"parentId": 2
}
]
"frontendVersion": "1.53.6"
},
"version": 0.4
}
+3 -60
View File
@@ -439,7 +439,7 @@
0,
0,
0,
false,
true,
"stop the run",
false,
false,
@@ -451,7 +451,7 @@
"grow": 0,
"soften": 0,
"smooth": 0,
"fill_holes": false,
"fill_holes": true,
"if_nothing": "stop the run",
"free_vram": false,
"invert": false,
@@ -1135,64 +1135,7 @@
60
]
},
"frontendVersion": "1.53.6",
"reroutes": [
{
"id": 1,
"pos": [
1504,
205
],
"linkIds": [
5
]
},
{
"id": 2,
"parentId": 1,
"pos": [
1964,
205
],
"linkIds": [
5
]
},
{
"id": 3,
"pos": [
1508,
441
],
"linkIds": [
2
]
},
{
"id": 4,
"pos": [
1516,
451
],
"linkIds": [
3
]
}
],
"linkExtensions": [
{
"id": 5,
"parentId": 2
},
{
"id": 2,
"parentId": 3
},
{
"id": 3,
"parentId": 4
}
]
"frontendVersion": "1.53.6"
},
"version": 0.4
}
@@ -1679,8 +1679,7 @@
"origin_slot": 0,
"target_id": 72,
"target_slot": 1,
"type": "IMAGE",
"parentId": 1
"type": "IMAGE"
},
{
"id": 5,
@@ -1707,19 +1706,7 @@
"type": "STRING"
}
],
"extra": {},
"reroutes": [
{
"id": 1,
"pos": [
1048,
676
],
"linkIds": [
6
]
}
]
"extra": {}
},
{
"id": "fe7eddff-ee33-40d2-98aa-e25b894fc34e",
@@ -2726,8 +2713,7 @@
"origin_slot": 4,
"target_id": 66,
"target_slot": 2,
"type": "AUSBOSS_STITCHER",
"parentId": 4
"type": "AUSBOSS_STITCHER"
},
{
"id": 28,
@@ -2743,8 +2729,7 @@
"origin_slot": 0,
"target_id": 68,
"target_slot": 1,
"type": "IMAGE",
"parentId": 2
"type": "IMAGE"
},
{
"id": 30,
@@ -2795,51 +2780,7 @@
"type": "STRING"
}
],
"extra": {},
"reroutes": [
{
"id": 1,
"pos": [
522,
248
],
"linkIds": [
29
]
},
{
"id": 2,
"parentId": 1,
"pos": [
1600,
248
],
"linkIds": [
29
]
},
{
"id": 3,
"pos": [
522,
262
],
"linkIds": [
27
]
},
{
"id": 4,
"parentId": 3,
"pos": [
1600,
262
],
"linkIds": [
27
]
}
]
"extra": {}
}
]
},
@@ -2852,53 +2793,7 @@
27
]
},
"frontendVersion": "1.53.6",
"reroutes": [
{
"id": 1,
"pos": [
1460,
360
],
"linkIds": [
35
]
},
{
"id": 2,
"pos": [
1444,
500
],
"linkIds": [
40
]
},
{
"id": 3,
"pos": [
1476,
450
],
"linkIds": [
41
]
}
],
"linkExtensions": [
{
"id": 35,
"parentId": 1
},
{
"id": 40,
"parentId": 2
},
{
"id": 41,
"parentId": 3
}
]
"frontendVersion": "1.53.6"
},
"version": 0.4
}
@@ -37,10 +37,10 @@
"Node name for S&R": "AUSBOSS_NODES_WorkflowNote"
},
"widgets_values": [
"{\"v\": 1, \"title\": \"Qwen Image 2.1 Inpaint\", \"subtitle\": \"Click a thing in your picture and say what to change. Only that part is repainted.\", \"author\": \"AusBoss\", \"layout\": \"card\", \"accent\": \"\", \"body\": \"1. Load your image. You can crop it right there with the blue handles.\\n2. On **Mask by Touch**, click the thing you want to change. It lights up before you click.\\n3. In **What to change**, say it the way you would ask a person: \\\"Replace the cup with a glass of orange juice.\\\"\\n4. Press **Run**.\\n\\nOnly the picked part is repainted. Everything outside it stays your own picture.\\n\\n### Tips\\n- Wrong thing picked? The arrows under the picture swap it for the next thing it could mean.\\n- Name everything that should go: \\\"the iced coffee and its straw\\\". What you do not name can stay.\\n- To remove something, pick it and write \\\"Remove the cup.\\\" Pick its shadow too, or the shadow stays.\\n- To add something, switch to **Paint** and paint where it should go, with some room. Say how big: \\\"Add small black sunglasses on her eyes.\\\"\\n- Not what you wanted? Change **Seed** and run it again. It stays fixed between runs.\\n\\n### Switches\\n- **Fast** on: 8 steps with the Viggle Turbo LoRA from the list below. Off: 25 steps without it, about twice as long.\\n\\nNeeds ComfyUI 0.38 or newer and AusBoss nodes 2.12.0 or newer (update first).\", \"models\": [{\"name\": \"qwen_image_2.1_int8_convrot.safetensors\", \"dir\": \"diffusion_models\", \"size\": \"7.26 GB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/diffusion_models/qwen_image_2.1_int8_convrot.safetensors\", \"note\": \"\"}, {\"name\": \"qwen3vl_8b_int8_convrot.safetensors\", \"dir\": \"text_encoders\", \"size\": \"9.35 GB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/text_encoders/qwen3vl_8b_int8_convrot.safetensors\", \"note\": \"\"}, {\"name\": \"qwen_image_2.1_vae_bf16.safetensors\", \"dir\": \"vae\", \"size\": \"676 MB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/vae/qwen_image_2.1_vae_bf16.safetensors\", \"note\": \"\"}, {\"name\": \"sam3.1_multiplex_fp16.safetensors\", \"dir\": \"checkpoints\", \"size\": \"1.75 GB\", \"url\": \"https://huggingface.co/Comfy-Org/sam3.1/resolve/main/checkpoints/sam3.1_multiplex_fp16.safetensors\", \"note\": \"by Meta, packaged by Comfy-Org\"}, {\"name\": \"Qwen-Image-2.1-viggle-turbo-v0.3-6step-lora-r128.safetensors\", \"dir\": \"loras\", \"size\": \"680 MB\", \"url\": \"https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/resolve/main/Qwen-Image-2.1-viggle-turbo-v0.3-6step-lora-r128.safetensors\", \"note\": \"optional, for Fast · Qwen Research License, research use\"}], \"packs\": [{\"name\": \"ComfyUI-AusBoss\", \"url\": \"https://github.com/ausboss/ComfyUI-AusBoss\", \"node\": \"AUSBOSS_NODES_MaskByTouch\"}], \"links\": [{\"label\": \"YouTube · this workflow\", \"url\": \"https://youtu.be/iMgaiXoB0v4\"}, {\"label\": \"GitHub · ausboss\", \"url\": \"https://github.com/ausboss\"}, {\"label\": \"Civitai · AusBoss\", \"url\": \"https://civitai.com/user/AusBoss\"}, {\"label\": \"X · Zanzibased\", \"url\": \"https://x.com/Zanzibased\"}]}"
"{\"v\": 1, \"title\": \"Qwen Image 2.1 Inpaint\", \"subtitle\": \"Click a thing in your picture and say what to change. Only that part is repainted.\", \"author\": \"AusBoss\", \"layout\": \"card\", \"accent\": \"\", \"body\": \"1. Load your image. You can crop it right there with the blue handles.\\n2. On **Mask by Touch**, click the thing you want to change. It lights up before you click.\\n3. In **What to change**, say it the way you would ask a person: \\\"Replace the cup with a glass of orange juice.\\\"\\n4. Press **Run**.\\n\\nOnly the picked part is repainted. Everything outside it stays your own picture.\\n\\n### Tips\\n- Wrong thing picked? The arrows under the picture swap it for the next thing it could mean.\\n- Name everything that should go: \\\"the iced coffee and its straw\\\". What you do not name can stay.\\n- To remove something, pick it and write \\\"Remove the cup.\\\" Pick its shadow too, or the shadow stays.\\n- To add something, switch to **Paint** and paint where it should go, with some room. Say how big: \\\"Add small black sunglasses on her eyes.\\\"\\n- Not what you wanted? Run it again. The seed changes each run.\\n\\n### Switches\\n- **Fast** on: 8 steps with the Viggle Turbo LoRA from the list below. Off: 25 steps without it, about twice as long.\\n\\nNeeds ComfyUI 0.38 or newer and AusBoss nodes 2.12.0 or newer (update first).\", \"models\": [{\"name\": \"qwen_image_2.1_int8_convrot.safetensors\", \"dir\": \"diffusion_models\", \"size\": \"7.26 GB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/diffusion_models/qwen_image_2.1_int8_convrot.safetensors\", \"note\": \"\"}, {\"name\": \"qwen3vl_8b_int8_convrot.safetensors\", \"dir\": \"text_encoders\", \"size\": \"9.35 GB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/text_encoders/qwen3vl_8b_int8_convrot.safetensors\", \"note\": \"\"}, {\"name\": \"qwen_image_2.1_vae_bf16.safetensors\", \"dir\": \"vae\", \"size\": \"676 MB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/vae/qwen_image_2.1_vae_bf16.safetensors\", \"note\": \"\"}, {\"name\": \"sam3.1_multiplex_fp16.safetensors\", \"dir\": \"checkpoints\", \"size\": \"1.75 GB\", \"url\": \"https://huggingface.co/Comfy-Org/sam3.1/resolve/main/checkpoints/sam3.1_multiplex_fp16.safetensors\", \"note\": \"by Meta, packaged by Comfy-Org\"}, {\"name\": \"Qwen-Image-2.1-viggle-turbo-v0.3-6step-lora-r128.safetensors\", \"dir\": \"loras\", \"size\": \"680 MB\", \"url\": \"https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/resolve/main/Qwen-Image-2.1-viggle-turbo-v0.3-6step-lora-r128.safetensors\", \"note\": \"optional, for Fast · Qwen Research License, research use\"}], \"packs\": [{\"name\": \"ComfyUI-AusBoss\", \"url\": \"https://github.com/ausboss/ComfyUI-AusBoss\", \"node\": \"AUSBOSS_NODES_MaskByTouch\"}], \"links\": [{\"label\": \"YouTube · this workflow\", \"url\": \"https://youtu.be/iMgaiXoB0v4\"}, {\"label\": \"GitHub · ausboss\", \"url\": \"https://github.com/ausboss\"}, {\"label\": \"Civitai · AusBoss\", \"url\": \"https://civitai.com/user/AusBoss\"}, {\"label\": \"X · Zanzibased\", \"url\": \"https://x.com/Zanzibased\"}]}"
],
"widgets_values_named": {
"note": "{\"v\": 1, \"title\": \"Qwen Image 2.1 Inpaint\", \"subtitle\": \"Click a thing in your picture and say what to change. Only that part is repainted.\", \"author\": \"AusBoss\", \"layout\": \"card\", \"accent\": \"\", \"body\": \"1. Load your image. You can crop it right there with the blue handles.\\n2. On **Mask by Touch**, click the thing you want to change. It lights up before you click.\\n3. In **What to change**, say it the way you would ask a person: \\\"Replace the cup with a glass of orange juice.\\\"\\n4. Press **Run**.\\n\\nOnly the picked part is repainted. Everything outside it stays your own picture.\\n\\n### Tips\\n- Wrong thing picked? The arrows under the picture swap it for the next thing it could mean.\\n- Name everything that should go: \\\"the iced coffee and its straw\\\". What you do not name can stay.\\n- To remove something, pick it and write \\\"Remove the cup.\\\" Pick its shadow too, or the shadow stays.\\n- To add something, switch to **Paint** and paint where it should go, with some room. Say how big: \\\"Add small black sunglasses on her eyes.\\\"\\n- Not what you wanted? Change **Seed** and run it again. It stays fixed between runs.\\n\\n### Switches\\n- **Fast** on: 8 steps with the Viggle Turbo LoRA from the list below. Off: 25 steps without it, about twice as long.\\n\\nNeeds ComfyUI 0.38 or newer and AusBoss nodes 2.12.0 or newer (update first).\", \"models\": [{\"name\": \"qwen_image_2.1_int8_convrot.safetensors\", \"dir\": \"diffusion_models\", \"size\": \"7.26 GB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/diffusion_models/qwen_image_2.1_int8_convrot.safetensors\", \"note\": \"\"}, {\"name\": \"qwen3vl_8b_int8_convrot.safetensors\", \"dir\": \"text_encoders\", \"size\": \"9.35 GB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/text_encoders/qwen3vl_8b_int8_convrot.safetensors\", \"note\": \"\"}, {\"name\": \"qwen_image_2.1_vae_bf16.safetensors\", \"dir\": \"vae\", \"size\": \"676 MB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/vae/qwen_image_2.1_vae_bf16.safetensors\", \"note\": \"\"}, {\"name\": \"sam3.1_multiplex_fp16.safetensors\", \"dir\": \"checkpoints\", \"size\": \"1.75 GB\", \"url\": \"https://huggingface.co/Comfy-Org/sam3.1/resolve/main/checkpoints/sam3.1_multiplex_fp16.safetensors\", \"note\": \"by Meta, packaged by Comfy-Org\"}, {\"name\": \"Qwen-Image-2.1-viggle-turbo-v0.3-6step-lora-r128.safetensors\", \"dir\": \"loras\", \"size\": \"680 MB\", \"url\": \"https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/resolve/main/Qwen-Image-2.1-viggle-turbo-v0.3-6step-lora-r128.safetensors\", \"note\": \"optional, for Fast · Qwen Research License, research use\"}], \"packs\": [{\"name\": \"ComfyUI-AusBoss\", \"url\": \"https://github.com/ausboss/ComfyUI-AusBoss\", \"node\": \"AUSBOSS_NODES_MaskByTouch\"}], \"links\": [{\"label\": \"YouTube · this workflow\", \"url\": \"https://youtu.be/iMgaiXoB0v4\"}, {\"label\": \"GitHub · ausboss\", \"url\": \"https://github.com/ausboss\"}, {\"label\": \"Civitai · AusBoss\", \"url\": \"https://civitai.com/user/AusBoss\"}, {\"label\": \"X · Zanzibased\", \"url\": \"https://x.com/Zanzibased\"}]}"
"note": "{\"v\": 1, \"title\": \"Qwen Image 2.1 Inpaint\", \"subtitle\": \"Click a thing in your picture and say what to change. Only that part is repainted.\", \"author\": \"AusBoss\", \"layout\": \"card\", \"accent\": \"\", \"body\": \"1. Load your image. You can crop it right there with the blue handles.\\n2. On **Mask by Touch**, click the thing you want to change. It lights up before you click.\\n3. In **What to change**, say it the way you would ask a person: \\\"Replace the cup with a glass of orange juice.\\\"\\n4. Press **Run**.\\n\\nOnly the picked part is repainted. Everything outside it stays your own picture.\\n\\n### Tips\\n- Wrong thing picked? The arrows under the picture swap it for the next thing it could mean.\\n- Name everything that should go: \\\"the iced coffee and its straw\\\". What you do not name can stay.\\n- To remove something, pick it and write \\\"Remove the cup.\\\" Pick its shadow too, or the shadow stays.\\n- To add something, switch to **Paint** and paint where it should go, with some room. Say how big: \\\"Add small black sunglasses on her eyes.\\\"\\n- Not what you wanted? Run it again. The seed changes each run.\\n\\n### Switches\\n- **Fast** on: 8 steps with the Viggle Turbo LoRA from the list below. Off: 25 steps without it, about twice as long.\\n\\nNeeds ComfyUI 0.38 or newer and AusBoss nodes 2.12.0 or newer (update first).\", \"models\": [{\"name\": \"qwen_image_2.1_int8_convrot.safetensors\", \"dir\": \"diffusion_models\", \"size\": \"7.26 GB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/diffusion_models/qwen_image_2.1_int8_convrot.safetensors\", \"note\": \"\"}, {\"name\": \"qwen3vl_8b_int8_convrot.safetensors\", \"dir\": \"text_encoders\", \"size\": \"9.35 GB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/text_encoders/qwen3vl_8b_int8_convrot.safetensors\", \"note\": \"\"}, {\"name\": \"qwen_image_2.1_vae_bf16.safetensors\", \"dir\": \"vae\", \"size\": \"676 MB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/vae/qwen_image_2.1_vae_bf16.safetensors\", \"note\": \"\"}, {\"name\": \"sam3.1_multiplex_fp16.safetensors\", \"dir\": \"checkpoints\", \"size\": \"1.75 GB\", \"url\": \"https://huggingface.co/Comfy-Org/sam3.1/resolve/main/checkpoints/sam3.1_multiplex_fp16.safetensors\", \"note\": \"by Meta, packaged by Comfy-Org\"}, {\"name\": \"Qwen-Image-2.1-viggle-turbo-v0.3-6step-lora-r128.safetensors\", \"dir\": \"loras\", \"size\": \"680 MB\", \"url\": \"https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/resolve/main/Qwen-Image-2.1-viggle-turbo-v0.3-6step-lora-r128.safetensors\", \"note\": \"optional, for Fast · Qwen Research License, research use\"}], \"packs\": [{\"name\": \"ComfyUI-AusBoss\", \"url\": \"https://github.com/ausboss/ComfyUI-AusBoss\", \"node\": \"AUSBOSS_NODES_MaskByTouch\"}], \"links\": [{\"label\": \"YouTube · this workflow\", \"url\": \"https://youtu.be/iMgaiXoB0v4\"}, {\"label\": \"GitHub · ausboss\", \"url\": \"https://github.com/ausboss\"}, {\"label\": \"Civitai · AusBoss\", \"url\": \"https://civitai.com/user/AusBoss\"}, {\"label\": \"X · Zanzibased\", \"url\": \"https://x.com/Zanzibased\"}]}"
},
"color": "#14424d",
"bgcolor": "#161f21"
@@ -1025,7 +1025,7 @@
"type": "AUSBOSS_NODES_LoraLoader",
"pos": [
2288,
1290
1040.0
],
"size": [
440,
@@ -2005,9 +2005,9 @@
"title": "3 · Models",
"bounding": [
1968,
960,
960.0,
780,
540
500.0
],
"color": "#1d5560",
"flags": {
@@ -2550,7 +2550,7 @@
"type": "Reroute",
"pos": [
560,
640
676.0
],
"size": [
75,
@@ -2587,8 +2587,8 @@
"id": 25,
"type": "Reroute",
"pos": [
580,
784
560,
772.0
],
"size": [
75,
@@ -3094,8 +3094,7 @@
"origin_slot": 0,
"target_id": 26,
"target_slot": 3,
"type": "LATENT",
"parentId": 1
"type": "LATENT"
},
{
"id": 20,
@@ -3242,19 +3241,7 @@
"type": "IMAGE"
}
],
"extra": {},
"reroutes": [
{
"id": 1,
"pos": [
1060,
640
],
"linkIds": [
25
]
}
]
"extra": {}
},
{
"id": "f03669a3-61c2-44c8-ad63-bad928a695fa",
@@ -3841,8 +3828,7 @@
"type": "MASK"
}
],
"extra": {},
"reroutes": []
"extra": {}
}
]
},
@@ -3855,106 +3841,7 @@
60
]
},
"frontendVersion": "1.53.6",
"reroutes": [
{
"id": 1,
"pos": [
954,
36
],
"linkIds": [
46,
31
]
},
{
"id": 2,
"parentId": 1,
"pos": [
1945,
36
],
"linkIds": [
46,
31
]
},
{
"id": 3,
"parentId": 2,
"pos": [
2768,
36
],
"linkIds": [
31
]
},
{
"id": 4,
"pos": [
2768,
300
],
"linkIds": [
45
]
},
{
"id": 5,
"parentId": 4,
"pos": [
3208,
300
],
"linkIds": [
45
]
},
{
"id": 6,
"pos": [
956,
1030
],
"linkIds": [
2
]
},
{
"id": 7,
"pos": [
962,
980
],
"linkIds": [
3
]
}
],
"linkExtensions": [
{
"id": 46,
"parentId": 2
},
{
"id": 31,
"parentId": 3
},
{
"id": 45,
"parentId": 5
},
{
"id": 2,
"parentId": 6
},
{
"id": 3,
"parentId": 7
}
]
"frontendVersion": "1.53.6"
},
"version": 0.4
}
@@ -37,10 +37,10 @@
"ver": "2.9.0"
},
"widgets_values": [
"{\"v\": 1, \"title\": \"Qwen Image 2.1 Upscale + Restore\", \"subtitle\": \"Load a small, soft or worn picture. Qwen Image 2.1 redraws it sharp at the megapixels you set, in its own colors.\", \"author\": \"AusBoss\", \"layout\": \"card\", \"accent\": \"\", \"body\": \"[▶ AusBoss on YouTube](https://www.youtube.com/@ausbossdev) · videos on these nodes and workflows\\n\\n---\\n\\n1. Load your image. You can crop it right there with the blue handles.\\n2. Set **Megapixels**: the size of the result.\\n3. Press **Run**.\\n4. Slide **Before and after** to compare. The result is saved as a PNG.\\n\\n### What you get\\n\\n- Your picture redrawn sharp, at the size you asked for.\\n- Its own colors, also on a noisy or faded photo.\\n\\n### Megapixels\\n\\n- Up to about 2: one pass.\\n- Over that: redrawn in tiles of about 2 megapixels and joined. 4 takes two tiles, 8 takes four.\\n- The redraw limit for a small picture is 8 times its own megapixels or one roughly 2 megapixel tile, whichever is larger. The rest is enlarged the plain way.\\n- A picture of 1 megapixel or more only looks better when it grows about 1.6 times per side.\\n\\n### Switches\\n\\n- **Fast** on: 8 steps with the Viggle Turbo LoRA. Off: 25 steps without it, about three times as long.\\n\\n### Tips\\n\\n- It is a redraw. Fine detail is made up to fit, so a face stays the same person, not the same pixels.\\n- Small lettering on signs and labels can come back misspelled.\\n- Each tile is matched to your picture's colors. To let Qwen's own colors through, lower **Keep colors** inside the box.\\n- If the run stops at a red **LoRA Loader**, a LoRA that is switched on is missing. Download it from the list below.\\n- Not tested on blur from a moving camera or missed focus.\\n\\nNeeds ComfyUI 0.38 or newer and AusBoss nodes 2.9.0 or newer (update first).\", \"models\": [{\"name\": \"qwen_image_2.1_int8_convrot.safetensors\", \"dir\": \"diffusion_models\", \"size\": \"7.26 GB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/diffusion_models/qwen_image_2.1_int8_convrot.safetensors\", \"note\": \"\"}, {\"name\": \"qwen3vl_8b_int8_convrot.safetensors\", \"dir\": \"text_encoders\", \"size\": \"9.35 GB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/text_encoders/qwen3vl_8b_int8_convrot.safetensors\", \"note\": \"\"}, {\"name\": \"qwen_image_2.1_vae_bf16.safetensors\", \"dir\": \"vae\", \"size\": \"676 MB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/vae/qwen_image_2.1_vae_bf16.safetensors\", \"note\": \"\"}, {\"name\": \"qwen-image-2.1-restore.safetensors\", \"dir\": \"loras\", \"size\": \"159 MB\", \"url\": \"https://huggingface.co/ausboss/Qwen-Image-2.1-Restore-LoRA/resolve/main/qwen-image-2.1-restore.safetensors\", \"note\": \"keeps the result close to your picture\"}, {\"name\": \"Qwen-Image-2.1-viggle-turbo-v0.3-6step-lora-r128.safetensors\", \"dir\": \"loras\", \"size\": \"680 MB\", \"url\": \"https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/resolve/main/Qwen-Image-2.1-viggle-turbo-v0.3-6step-lora-r128.safetensors\", \"note\": \"for Fast on · Qwen Research License, research use\"}], \"packs\": [{\"name\": \"ComfyUI-AusBoss\", \"url\": \"https://github.com/ausboss/ComfyUI-AusBoss\", \"node\": \"AUSBOSS_NODES_TiledUpscale\"}], \"links\": [{\"label\": \"YouTube · ausbossdev\", \"url\": \"https://www.youtube.com/@ausbossdev\"}, {\"label\": \"GitHub · ausboss\", \"url\": \"https://github.com/ausboss\"}, {\"label\": \"Civitai · AusBoss\", \"url\": \"https://civitai.com/user/AusBoss\"}, {\"label\": \"X · Zanzibased\", \"url\": \"https://x.com/Zanzibased\"}]}"
"{\"v\": 1, \"title\": \"Qwen Image 2.1 Upscale + Restore\", \"subtitle\": \"Load a small, soft or worn picture. Qwen Image 2.1 redraws it sharp at the megapixels you set, in its own colors.\", \"author\": \"AusBoss\", \"layout\": \"card\", \"accent\": \"\", \"body\": \"[▶ AusBoss on YouTube](https://www.youtube.com/@ausbossdev) · videos on these nodes and workflows\\n\\n---\\n\\n1. Load your image. You can crop it right there with the blue handles.\\n2. Set **Megapixels**: the size of the result.\\n3. Press **Run**.\\n4. Slide **Before and after** to compare. The result is saved as a PNG.\\n\\n### What you get\\n\\n- Your picture redrawn sharp, at the size you asked for.\\n- Its own colors, also on a noisy or faded photo.\\n\\n### Megapixels\\n\\n- Up to about 2: one pass.\\n- Over that: redrawn in tiles of about 2 megapixels and joined. 4 takes two tiles, 8 takes four.\\n- A small picture is redrawn at up to 8 times its own megapixels, then enlarged the plain way.\\n- A picture of 1 megapixel or more only looks better when it grows about 1.6 times per side.\\n\\n### Switches\\n\\n- **Fast** on: 8 steps with the Viggle Turbo LoRA. Off: 25 steps without it, about three times as long.\\n\\n### Tips\\n\\n- It is a redraw. Fine detail is made up to fit, so a face stays the same person, not the same pixels.\\n- Small lettering on signs and labels can come back misspelled.\\n- Each tile is matched to your picture's colors. To let Qwen's own colors through, lower **Keep colors** inside the box.\\n- If the run stops at a red **LoRA Loader**, a LoRA that is switched on is missing. Download it from the list below.\\n- Not tested on blur from a moving camera or missed focus.\\n\\nNeeds ComfyUI 0.38 or newer and AusBoss nodes 2.9.0 or newer (update first).\", \"models\": [{\"name\": \"qwen_image_2.1_int8_convrot.safetensors\", \"dir\": \"diffusion_models\", \"size\": \"7.26 GB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/diffusion_models/qwen_image_2.1_int8_convrot.safetensors\", \"note\": \"\"}, {\"name\": \"qwen3vl_8b_int8_convrot.safetensors\", \"dir\": \"text_encoders\", \"size\": \"9.35 GB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/text_encoders/qwen3vl_8b_int8_convrot.safetensors\", \"note\": \"\"}, {\"name\": \"qwen_image_2.1_vae_bf16.safetensors\", \"dir\": \"vae\", \"size\": \"676 MB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/vae/qwen_image_2.1_vae_bf16.safetensors\", \"note\": \"\"}, {\"name\": \"qwen-image-2.1-restore.safetensors\", \"dir\": \"loras\", \"size\": \"159 MB\", \"url\": \"https://huggingface.co/ausboss/Qwen-Image-2.1-Restore-LoRA/resolve/main/qwen-image-2.1-restore.safetensors\", \"note\": \"keeps the result close to your picture\"}, {\"name\": \"Qwen-Image-2.1-viggle-turbo-v0.3-6step-lora-r128.safetensors\", \"dir\": \"loras\", \"size\": \"680 MB\", \"url\": \"https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/resolve/main/Qwen-Image-2.1-viggle-turbo-v0.3-6step-lora-r128.safetensors\", \"note\": \"for Fast on · Qwen Research License, research use\"}], \"packs\": [{\"name\": \"ComfyUI-AusBoss\", \"url\": \"https://github.com/ausboss/ComfyUI-AusBoss\", \"node\": \"AUSBOSS_NODES_TiledUpscale\"}], \"links\": [{\"label\": \"YouTube · ausbossdev\", \"url\": \"https://www.youtube.com/@ausbossdev\"}, {\"label\": \"GitHub · ausboss\", \"url\": \"https://github.com/ausboss\"}, {\"label\": \"Civitai · AusBoss\", \"url\": \"https://civitai.com/user/AusBoss\"}, {\"label\": \"X · Zanzibased\", \"url\": \"https://x.com/Zanzibased\"}]}"
],
"widgets_values_named": {
"note": "{\"v\": 1, \"title\": \"Qwen Image 2.1 Upscale + Restore\", \"subtitle\": \"Load a small, soft or worn picture. Qwen Image 2.1 redraws it sharp at the megapixels you set, in its own colors.\", \"author\": \"AusBoss\", \"layout\": \"card\", \"accent\": \"\", \"body\": \"[▶ AusBoss on YouTube](https://www.youtube.com/@ausbossdev) · videos on these nodes and workflows\\n\\n---\\n\\n1. Load your image. You can crop it right there with the blue handles.\\n2. Set **Megapixels**: the size of the result.\\n3. Press **Run**.\\n4. Slide **Before and after** to compare. The result is saved as a PNG.\\n\\n### What you get\\n\\n- Your picture redrawn sharp, at the size you asked for.\\n- Its own colors, also on a noisy or faded photo.\\n\\n### Megapixels\\n\\n- Up to about 2: one pass.\\n- Over that: redrawn in tiles of about 2 megapixels and joined. 4 takes two tiles, 8 takes four.\\n- The redraw limit for a small picture is 8 times its own megapixels or one roughly 2 megapixel tile, whichever is larger. The rest is enlarged the plain way.\\n- A picture of 1 megapixel or more only looks better when it grows about 1.6 times per side.\\n\\n### Switches\\n\\n- **Fast** on: 8 steps with the Viggle Turbo LoRA. Off: 25 steps without it, about three times as long.\\n\\n### Tips\\n\\n- It is a redraw. Fine detail is made up to fit, so a face stays the same person, not the same pixels.\\n- Small lettering on signs and labels can come back misspelled.\\n- Each tile is matched to your picture's colors. To let Qwen's own colors through, lower **Keep colors** inside the box.\\n- If the run stops at a red **LoRA Loader**, a LoRA that is switched on is missing. Download it from the list below.\\n- Not tested on blur from a moving camera or missed focus.\\n\\nNeeds ComfyUI 0.38 or newer and AusBoss nodes 2.9.0 or newer (update first).\", \"models\": [{\"name\": \"qwen_image_2.1_int8_convrot.safetensors\", \"dir\": \"diffusion_models\", \"size\": \"7.26 GB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/diffusion_models/qwen_image_2.1_int8_convrot.safetensors\", \"note\": \"\"}, {\"name\": \"qwen3vl_8b_int8_convrot.safetensors\", \"dir\": \"text_encoders\", \"size\": \"9.35 GB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/text_encoders/qwen3vl_8b_int8_convrot.safetensors\", \"note\": \"\"}, {\"name\": \"qwen_image_2.1_vae_bf16.safetensors\", \"dir\": \"vae\", \"size\": \"676 MB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/vae/qwen_image_2.1_vae_bf16.safetensors\", \"note\": \"\"}, {\"name\": \"qwen-image-2.1-restore.safetensors\", \"dir\": \"loras\", \"size\": \"159 MB\", \"url\": \"https://huggingface.co/ausboss/Qwen-Image-2.1-Restore-LoRA/resolve/main/qwen-image-2.1-restore.safetensors\", \"note\": \"keeps the result close to your picture\"}, {\"name\": \"Qwen-Image-2.1-viggle-turbo-v0.3-6step-lora-r128.safetensors\", \"dir\": \"loras\", \"size\": \"680 MB\", \"url\": \"https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/resolve/main/Qwen-Image-2.1-viggle-turbo-v0.3-6step-lora-r128.safetensors\", \"note\": \"for Fast on · Qwen Research License, research use\"}], \"packs\": [{\"name\": \"ComfyUI-AusBoss\", \"url\": \"https://github.com/ausboss/ComfyUI-AusBoss\", \"node\": \"AUSBOSS_NODES_TiledUpscale\"}], \"links\": [{\"label\": \"YouTube · ausbossdev\", \"url\": \"https://www.youtube.com/@ausbossdev\"}, {\"label\": \"GitHub · ausboss\", \"url\": \"https://github.com/ausboss\"}, {\"label\": \"Civitai · AusBoss\", \"url\": \"https://civitai.com/user/AusBoss\"}, {\"label\": \"X · Zanzibased\", \"url\": \"https://x.com/Zanzibased\"}]}"
"note": "{\"v\": 1, \"title\": \"Qwen Image 2.1 Upscale + Restore\", \"subtitle\": \"Load a small, soft or worn picture. Qwen Image 2.1 redraws it sharp at the megapixels you set, in its own colors.\", \"author\": \"AusBoss\", \"layout\": \"card\", \"accent\": \"\", \"body\": \"[▶ AusBoss on YouTube](https://www.youtube.com/@ausbossdev) · videos on these nodes and workflows\\n\\n---\\n\\n1. Load your image. You can crop it right there with the blue handles.\\n2. Set **Megapixels**: the size of the result.\\n3. Press **Run**.\\n4. Slide **Before and after** to compare. The result is saved as a PNG.\\n\\n### What you get\\n\\n- Your picture redrawn sharp, at the size you asked for.\\n- Its own colors, also on a noisy or faded photo.\\n\\n### Megapixels\\n\\n- Up to about 2: one pass.\\n- Over that: redrawn in tiles of about 2 megapixels and joined. 4 takes two tiles, 8 takes four.\\n- A small picture is redrawn at up to 8 times its own megapixels, then enlarged the plain way.\\n- A picture of 1 megapixel or more only looks better when it grows about 1.6 times per side.\\n\\n### Switches\\n\\n- **Fast** on: 8 steps with the Viggle Turbo LoRA. Off: 25 steps without it, about three times as long.\\n\\n### Tips\\n\\n- It is a redraw. Fine detail is made up to fit, so a face stays the same person, not the same pixels.\\n- Small lettering on signs and labels can come back misspelled.\\n- Each tile is matched to your picture's colors. To let Qwen's own colors through, lower **Keep colors** inside the box.\\n- If the run stops at a red **LoRA Loader**, a LoRA that is switched on is missing. Download it from the list below.\\n- Not tested on blur from a moving camera or missed focus.\\n\\nNeeds ComfyUI 0.38 or newer and AusBoss nodes 2.9.0 or newer (update first).\", \"models\": [{\"name\": \"qwen_image_2.1_int8_convrot.safetensors\", \"dir\": \"diffusion_models\", \"size\": \"7.26 GB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/diffusion_models/qwen_image_2.1_int8_convrot.safetensors\", \"note\": \"\"}, {\"name\": \"qwen3vl_8b_int8_convrot.safetensors\", \"dir\": \"text_encoders\", \"size\": \"9.35 GB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/text_encoders/qwen3vl_8b_int8_convrot.safetensors\", \"note\": \"\"}, {\"name\": \"qwen_image_2.1_vae_bf16.safetensors\", \"dir\": \"vae\", \"size\": \"676 MB\", \"url\": \"https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/vae/qwen_image_2.1_vae_bf16.safetensors\", \"note\": \"\"}, {\"name\": \"qwen-image-2.1-restore.safetensors\", \"dir\": \"loras\", \"size\": \"159 MB\", \"url\": \"https://huggingface.co/ausboss/Qwen-Image-2.1-Restore-LoRA/resolve/main/qwen-image-2.1-restore.safetensors\", \"note\": \"keeps the result close to your picture\"}, {\"name\": \"Qwen-Image-2.1-viggle-turbo-v0.3-6step-lora-r128.safetensors\", \"dir\": \"loras\", \"size\": \"680 MB\", \"url\": \"https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/resolve/main/Qwen-Image-2.1-viggle-turbo-v0.3-6step-lora-r128.safetensors\", \"note\": \"for Fast on · Qwen Research License, research use\"}], \"packs\": [{\"name\": \"ComfyUI-AusBoss\", \"url\": \"https://github.com/ausboss/ComfyUI-AusBoss\", \"node\": \"AUSBOSS_NODES_TiledUpscale\"}], \"links\": [{\"label\": \"YouTube · ausbossdev\", \"url\": \"https://www.youtube.com/@ausbossdev\"}, {\"label\": \"GitHub · ausboss\", \"url\": \"https://github.com/ausboss\"}, {\"label\": \"Civitai · AusBoss\", \"url\": \"https://civitai.com/user/AusBoss\"}, {\"label\": \"X · Zanzibased\", \"url\": \"https://x.com/Zanzibased\"}]}"
},
"color": "#14424d",
"bgcolor": "#161f21"
@@ -921,8 +921,8 @@
"id": 11,
"type": "AUSBOSS_NODES_LoraLoader",
"pos": [
1468,
1072
1808,
608
],
"size": [
400,
@@ -2021,7 +2021,7 @@
"type": "Reroute",
"pos": [
560,
430
394
],
"size": [
75,
@@ -2059,7 +2059,7 @@
"type": "Reroute",
"pos": [
560,
360
460
],
"size": [
75,
@@ -2096,11 +2096,11 @@
"id": 20,
"type": "KSampler",
"pos": [
640,
560,
546
],
"size": [
380,
460,
262
],
"flags": {},
@@ -2607,8 +2607,7 @@
"type": "IMAGE"
}
],
"extra": {},
"reroutes": []
"extra": {}
}
]
},
@@ -2621,64 +2620,7 @@
60
]
},
"frontendVersion": "1.53.6",
"reroutes": [
{
"id": 1,
"pos": [
1428,
210
],
"linkIds": [
21
]
},
{
"id": 2,
"parentId": 1,
"pos": [
2248,
210
],
"linkIds": [
21
]
},
{
"id": 3,
"pos": [
1820,
400
],
"linkIds": [
27
]
},
{
"id": 4,
"pos": [
1860,
450
],
"linkIds": [
28
]
}
],
"linkExtensions": [
{
"id": 21,
"parentId": 2
},
{
"id": 27,
"parentId": 3
},
{
"id": 28,
"parentId": 4
}
]
"frontendVersion": "1.53.6"
},
"version": 0.4
}
}
@@ -1816,8 +1816,7 @@
"type": "IMAGE"
}
],
"extra": {},
"reroutes": []
"extra": {}
},
{
"id": "a988ba93-208b-4af3-b721-61365d1292ac",
@@ -2613,8 +2612,7 @@
"type": "IMAGE"
}
],
"extra": {},
"reroutes": []
"extra": {}
}
]
},
@@ -2626,111 +2624,7 @@
137,
20
]
},
"reroutes": [
{
"id": 1,
"pos": [
940,
34
],
"linkIds": [
1
]
},
{
"id": 2,
"parentId": 1,
"pos": [
1420,
34
],
"linkIds": [
1
]
},
{
"id": 3,
"pos": [
940,
38
],
"linkIds": [
13
]
},
{
"id": 4,
"parentId": 3,
"pos": [
1780,
38
],
"linkIds": [
13
]
},
{
"id": 5,
"pos": [
940,
42
],
"linkIds": [
14
]
},
{
"id": 6,
"parentId": 5,
"pos": [
1780,
42
],
"linkIds": [
14
]
},
{
"id": 7,
"pos": [
934,
450
],
"linkIds": [
15
]
},
{
"id": 8,
"parentId": 7,
"pos": [
942,
700
],
"linkIds": [
15
]
}
],
"linkExtensions": [
{
"id": 1,
"parentId": 2
},
{
"id": 13,
"parentId": 4
},
{
"id": 14,
"parentId": 6
},
{
"id": 15,
"parentId": 8
}
]
}
},
"version": 0.4
}
-98
View File
@@ -1,98 +0,0 @@
// App mode for nodes with cards: the simple form view shows a real control
// for each field instead of an empty row. The logic is in
// js/shared/app_mode.mjs; this file watches which mode the open workflow is
// in and hands the fields over.
import { app } from "../../../scripts/app.js";
import { APP_MODE, appFields, createAppModeSync, formHostSelector, workflowMode } from "../shared/app_mode.mjs";
const sync = createAppModeSync({
find(nodeId, name) {
const graph = app.rootGraph ?? app.graph;
const node = graph?.getNodeById?.(/^\d+$/.test(nodeId) ? Number(nodeId) : nodeId);
const widget = node?.widgets?.find((entry) => entry.name === name);
return widget ? { node, widget } : null;
},
changed(node) {
node.setDirtyCanvas?.(true, true);
},
});
function findWidget(nodeId, name) {
const graph = app.rootGraph ?? app.graph;
const node = graph?.getNodeById?.(/^\d+$/.test(nodeId) ? Number(nodeId) : nodeId);
return node?.widgets?.find((entry) => entry.name === name) ?? null;
}
// A DOM widget the form lists goes into its row, and back again if the
// graph's widget layer took it (see formHostSelector). Rows mount whenever
// the form draws, which can be well after the mode changes, so while a
// workflow is in App mode the page is watched and an empty row is filled
// on the next frame.
function rehomeDomWidgets() {
const workflow = app.extensionManager?.workflow?.activeWorkflow;
if (workflowMode(workflow) !== APP_MODE) return;
for (const { nodeId, widget: name } of appFields((app.rootGraph ?? app.graph)?.extra?.linearData)) {
const element = findWidget(nodeId, name)?.element;
if (!(element instanceof HTMLElement)) continue;
const host = document.querySelector(formHostSelector(nodeId, name));
if (!host || host.contains(element)) continue;
// Something that keeps taking it back: stop rather than fight.
const now = Date.now();
moves = moves.filter((at) => now - at < 3000);
if (moves.length >= 30) return;
moves.push(now);
host.replaceChildren(element);
}
}
let moves = [];
let watcher = null;
let framed = false;
function watchForm(on) {
if (!on) {
watcher?.disconnect();
watcher = null;
return;
}
if (!watcher) {
watcher = new MutationObserver(() => {
if (framed) return;
framed = true;
requestAnimationFrame(() => {
framed = false;
try { rehomeDomWidgets(); } catch (error) { console.warn("[AusBoss] App mode fields:", error); }
});
});
watcher.observe(document.body, { childList: true, subtree: true });
}
rehomeDomWidgets();
}
let queued = false;
// After the current task: a card hides its widgets in a microtask once the
// node has loaded, and the form's fields are shown after that.
function schedule() {
if (queued) return;
queued = true;
setTimeout(() => {
queued = false;
try {
const workflow = app.extensionManager?.workflow?.activeWorkflow;
const mode = workflowMode(workflow);
sync(mode, (app.rootGraph ?? app.graph)?.extra?.linearData);
watchForm(mode === APP_MODE);
} catch (error) {
console.warn("[AusBoss] App mode fields:", error);
}
}, 0);
}
app.registerExtension({
name: "ausboss.app.mode",
setup() {
app.extensionManager?.workflow?.$subscribe?.(schedule);
},
afterConfigureGraph() {
schedule();
},
});
+19 -32
View File
@@ -1,4 +1,4 @@
import { app } from "../../../scripts/app.js";
import { app } from "/scripts/app.js";
import {
CUSTOM_SCHEME,
DEFAULT_SCHEME,
@@ -23,7 +23,6 @@ import { openInfoCard } from "../shared/settings_menu.mjs";
const SETTING_ID = "AusBoss.Appearance.NodeColor";
const CUSTOM_SETTING_ID = "AusBoss.Appearance.CustomColor";
const COLOR_OVERRIDE = "ausbossColor";
// Stored bare (no "#") to match the color setting's storage contract.
const DEFAULT_CUSTOM_COLOR = "00b4aa";
@@ -41,7 +40,6 @@ let activeCustomColor = DEFAULT_CUSTOM_COLOR;
let activeCustomTitle = normalizeHexColor(DEFAULT_CUSTOM_COLOR);
function setActiveCustomColor(value) {
if (!normalizeHexColor(value)) return;
activeCustomColor = value;
activeCustomTitle = normalizeHexColor(value);
}
@@ -58,7 +56,6 @@ function applyScheme(node, colors) {
function repaintAll(next, previous) {
for (const node of collectGraphNodes(app.graph)) {
if (!isAusbossNode(node)) continue;
if (Object.hasOwn(node.properties ?? {}, COLOR_OVERRIDE)) continue;
if (!shouldRecolor(node, previous)) continue;
applyScheme(node, next);
}
@@ -152,8 +149,8 @@ app.registerExtension({
},
getNodeMenuItems(node) {
if (!isAusbossNode(node)) return [];
// Vue nodes skip the canvas badge callbacks; title-less nodes have no bar.
const about = isTitleless(node) || globalThis.LiteGraph?.vueNodesMode === true
// A title-less node has no bar for the "?" badge; its card opens here.
const about = isTitleless(node)
? [{ content: "About this node", callback: () => openHelpCard(node, null) }]
: [];
return [
@@ -165,14 +162,12 @@ app.registerExtension({
options: SCHEME_NAMES.map((name) => ({
content: name,
callback: () => {
// Keep an explicit choice, including no colors, through saves
// and setting changes. Custom stores the pair picked today.
// A menu pick writes the colors directly; shouldRecolor then
// treats them as the user's choice during setting sweeps.
const colors = schemeColors(name, activeCustomColor);
// Custom with an unusable stored color resolves to null, which
// would wrongly read as "Theme default" — do nothing instead.
if (name === CUSTOM_SCHEME && !colors) return;
node.properties ??= {};
node.properties[COLOR_OVERRIDE] = colors ? { ...colors } : null;
applyScheme(node, colors);
app.graph?.setDirtyCanvas?.(true, true);
},
@@ -184,28 +179,18 @@ app.registerExtension({
nodeCreated(node) {
if (!isAusbossNode(node)) return;
installHelpBadge(node);
restoreAppearance(node);
// Construction precedes saved fields; reload, paste and undo restore
// their colors and properties before this callback runs.
chainCallback(node, "onConfigure", function (saved) {
restoreAppearance(this, saved);
});
// Colors restored from a saved workflow (and manual picks) land before
// this hook runs — an already-colored node is left alone, unless it
// wears a retired flagship pair: those colors were ours, so the node
// upgrades to the active scheme instead of keeping them forever.
if ((node.color || node.bgcolor) && !wearsLegacyScheme(node)) return;
const colors = schemeColors(activeScheme, activeCustomColor);
if (colors) applyScheme(node, colors);
},
});
function restoreAppearance(node, saved) {
if (Object.hasOwn(node.properties ?? {}, COLOR_OVERRIDE)) {
// A later pick in ComfyUI's own color menu is saved in the native fields.
if (saved?.color || saved?.bgcolor) return;
applyScheme(node, node.properties[COLOR_OVERRIDE]);
return;
}
if ((node.color || node.bgcolor) && !wearsLegacyScheme(node)) return;
applyScheme(node, schemeColors(activeScheme, activeCustomColor));
}
function isTitleless(node) {
return (node.title_mode ?? node.constructor?.title_mode) === (globalThis.LiteGraph?.NO_TITLE ?? 1);
return node.constructor?.title_mode === (globalThis.LiteGraph?.NO_TITLE ?? 1);
}
function openHelpCard(node, event) {
@@ -219,13 +204,15 @@ function openHelpCard(node, event) {
});
}
// Classic nodes get a quiet "?" in the title bar. Vue nodes open the same
// card from their context menu. Its text comes from DESCRIPTION and tooltips.
// Every AusBoss node gets a quiet "?" in the title bar; clicking it opens a
// card built from the node's own DESCRIPTION and tooltips, so the docs on
// screen are exactly the docs in the source.
function installHelpBadge(node) {
// A title-less node (Run Timer) has no bar to hang the badge on; its
// card opens from the node's context menu instead.
if (isTitleless(node)) return;
chainCallback(node, "onDrawForeground", function (ctx) {
if (isTitleless(this) || !showBadge(this.size?.[0] ?? 0, this.flags?.collapsed)) return;
if (!showBadge(this.size?.[0] ?? 0, this.flags?.collapsed)) return;
const [x, y] = badgeCenter(this.size[0]);
ctx.save();
ctx.beginPath();
@@ -241,7 +228,7 @@ function installHelpBadge(node) {
ctx.restore();
});
chainHandler(node, "onMouseDown", function (event, pos) {
if (isTitleless(this) || !showBadge(this.size?.[0] ?? 0, this.flags?.collapsed)) return false;
if (!showBadge(this.size?.[0] ?? 0, this.flags?.collapsed)) return false;
if (!pos || !hitsBadge(pos, this.size[0])) return false;
openHelpCard(this, event);
return true; // consume the click so it does not start a drag
+3 -22
View File
@@ -4,8 +4,8 @@
//
// Imports nothing from ../shared on purpose. Old cached copies of those files
// are the problem this entry has to survive.
import { api } from "../../../scripts/api.js";
import { app } from "../../../scripts/app.js";
import { api } from "/scripts/api.js";
import { app } from "/scripts/app.js";
const PACK_URL = new URL("../", import.meta.url).href;
const PARALLEL = 6;
@@ -49,25 +49,6 @@ function askForReload(installed) {
}
}
// "2.26.2" -> [2, 26, 2]. Anything else, such as "unknown", is null.
function parseVersion(version) {
const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(typeof version === "string" ? version : "");
return match ? match.slice(1).map(Number) : null;
}
// Only a server newer than the page means this tab runs old files. The page
// is newer when the Manager switched the pack on disk and the page was
// reloaded before ComfyUI restarted, and then a restart is what is needed.
// Two version numbers cannot tell that apart from a downgrade with the tab
// left open, which needs a reload, so in that case the guard says nothing.
function serverIsNewer(installed, running) {
const server = parseVersion(installed);
const page = parseVersion(running);
if (!server || !page) return false;
const step = server.findIndex((part, index) => part !== page[index]);
return step >= 0 && server[step] > page[step];
}
// The installed version this page already asked a reload for. A server that
// drops and comes back several times must not stack the same message.
let asked = null;
@@ -77,7 +58,7 @@ async function check() {
try {
const installed = (await (await api.fetchApi("/ausboss/pack_version")).json())?.version;
const running = await runningVersion();
if (!serverIsNewer(installed, running) || installed === asked) return;
if (!installed || installed === "unknown" || !running || installed === running || installed === asked) return;
asked = installed;
const listing = await (await api.fetchApi("/ausboss/pack_modules")).json();
await refreshModules(Array.isArray(listing?.modules) ? listing.modules : []);
+28 -266
View File
@@ -6,25 +6,19 @@
// and copy ride the default path); the panel only shows it. Decisions live in
// js/shared/callout.mjs under node:test.
import { app } from "../../../scripts/app.js";
import { setTileFace, TILE_FACE_CSS } from "../shared/tile_face.mjs";
import { CALLOUT_TYPES, serializeNoteIdentity } from "../shared/note_identity.mjs";
import { app } from "/scripts/app.js";
import { BRAND, chainCallback, keepDomWidgetWidthAuto } from "../shared/index.mjs";
import {
ARROW_ANGLE,
ARROW_CHOICES,
CARD_TEMPLATE,
DOUBLE_ARROWS,
arrowText,
fitFontSize,
parseBlocks,
parseCard,
pastedLink,
repointLinks,
targetId,
toggleSmall,
tileLinkFields,
tileLinkText,
urlLabel,
wrapLink,
} from "../shared/callout.mjs";
@@ -33,9 +27,9 @@ import { keepKeyInField } from "../shared/canvas_passthrough.mjs";
import { WIDGET_FRAME, fillNodeHeight } from "../shared/panel_layout.mjs";
import { hideInputsInDef, hideWidget } from "../shared/widget_visibility.mjs";
import { commitWidgetValue } from "../shared/widget_card_math.mjs";
import { compactAction } from "../shared/panel_controls.mjs";
import { frameBounds } from "../shared/workflow_switches.mjs";
const NODE_CLASS = "AUSBOSS_NODES_Callout";
const CSS_ID = "ausboss-callout-css";
const WIDGET_NAME = "ausboss_callout_panel";
const DEFAULT_SIZE = [380, 160];
@@ -43,14 +37,6 @@ const PANEL_MIN_WIDTH = 200;
const PANEL_MIN_HEIGHT = 64;
const SVG_NS = "http://www.w3.org/2000/svg";
const ARROW_COLOR = "#1fd3c6";
const LINK_TILES = {
youtube: { label: "Watch Me on YouTube", url: "https://www.youtube.com/@ausbossdev" },
discord: { label: "Join for Help or More Workflows", url: "https://discord.gg/RwVxY9Fuaj" },
};
// A new Info card opens at this size, which shows its starter text whole.
const CARD_SIZE = [300, 230];
// The card's text grows with the node like a note's, but a card stays a card.
const CARD_FONT_MAX = 20;
const FRAME_FILL = 0.8; // the share of the view a node brought into view takes, as in Workflow Switches
const FONT = '"IBM Plex Sans", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif';
@@ -69,7 +55,6 @@ function ensureCss() {
const style = document.createElement("style");
style.id = CSS_ID;
style.textContent = `
${TILE_FACE_CSS}
.ausboss-callout{box-sizing:border-box;width:100%;height:100%;padding:2px 4px 6px;overflow:hidden;pointer-events:none;}
.ausboss-callout-card{position:relative;box-sizing:border-box;width:100%;height:100%;overflow:hidden;border-radius:8px;background:linear-gradient(135deg,rgba(0,180,170,.07),rgba(0,0,0,.2));}
.ausboss-callout-inner{position:absolute;top:0;bottom:0;left:0;box-sizing:border-box;width:100%;height:fit-content;margin:auto 0;padding:.6em 1em .6em .85em;color:#d6e6e4;font-family:${FONT};font-weight:500;line-height:1.4;letter-spacing:.003em;overflow-wrap:anywhere;}
@@ -78,29 +63,6 @@ ${TILE_FACE_CSS}
.ausboss-callout-point b{color:#6fe0d6;font-weight:650;}
.ausboss-callout-small{margin-top:.3em;color:#9fb5b2;font-size:max(11px,.62em);font-weight:400;line-height:1.4;}
.ausboss-callout-small b{color:#8fd6cf;font-weight:600;}
.ausboss-callout-card[data-tile=youtube]{background:#ae2639}
.ausboss-callout-card[data-tile=discord]{background:#5146aa}
.ausboss-callout-card[data-tile=title]{background:#090909;border-left:4px solid #21c7b9}
.ausboss-callout-card[data-tile] .ausboss-callout-inner{padding-block:.15em;}
.ausboss-callout-card[data-tile] .ausboss-callout-point{border:0;padding:0;margin:0;font-weight:650;color:#fff}
.ausboss-callout-card[data-tile] .ausboss-callout-url{color:white;text-decoration:none;display:flex;align-items:center;gap:12px}
.ausboss-callout-card[data-tile] .ausboss-callout-url svg{width:36px;height:28px;flex:none}
.ausboss-callout-card[data-tile] .ausboss-callout-out{margin-left:auto}
.ausboss-callout-card[data-tile] .ausboss-callout-tools{right:27px;}
.ausboss-callout-card[data-card]{background:#111818;border:1px solid #2e3c3b;}
.ausboss-callout-card[data-card] .ausboss-callout-inner{padding:.8em 1em;color:#d9e4e3;font-weight:400;line-height:1.45;}
.ausboss-callout-card[data-card] b{color:#f2f7f6;font-weight:650;}
.ausboss-callout-block{margin:0 0 .85em;}
.ausboss-callout-block:last-child{margin-bottom:0;}
.ausboss-callout-block>*+*{margin-top:.3em;}
.ausboss-callout-title{display:flex;align-items:center;gap:.4em;color:#f2f7f6;font-size:1.08em;font-weight:650;}
.ausboss-callout-icon{flex:none;width:1em;height:1em;color:#c9d6d4;}
.ausboss-callout-icon svg{display:block;width:100%;height:100%;}
.ausboss-callout-row{display:flex;justify-content:space-between;align-items:baseline;gap:1em;}
.ausboss-callout-row>span:last-child{flex:none;text-align:right;white-space:nowrap;}
.ausboss-callout-row.is-mark,.ausboss-callout-row.is-mark b{color:#6fe0d6;font-weight:500;}
.ausboss-card-small,.ausboss-card-small b{color:#93a6a4;}
.ausboss-card-small{font-size:.92em;}
.ausboss-callout-empty{color:#6f8987;font-size:14px;font-weight:400;}
.ausboss-callout-arrow{display:inline-block;width:1.2em;height:1.2em;margin:0 .1em;vertical-align:-.26em;filter:drop-shadow(0 0 .3em rgba(0,180,170,.55));}
.ausboss-callout-arrow svg{display:block;width:100%;height:100%;overflow:visible;}
@@ -113,7 +75,7 @@ ${TILE_FACE_CSS}
.ausboss-callout-out{display:inline-block;margin-left:.2em;font-size:.7em;font-weight:600;vertical-align:.14em;text-decoration:none;opacity:.85;}
.ausboss-callout-jump.is-gone{opacity:.45;cursor:default;text-decoration-style:dotted;}
.ausboss-callout-tools{position:absolute;top:5px;right:5px;display:flex;gap:4px;opacity:0;transition:opacity .15s;pointer-events:auto;}
.ausboss-callout-card:is(:hover,:focus-within) .ausboss-callout-tools,.ausboss-callout.is-selected .ausboss-callout-tools{opacity:.95;}
.ausboss-callout-card:hover .ausboss-callout-tools,.ausboss-callout.is-selected .ausboss-callout-tools{opacity:.95;}
.ausboss-callout-tool{height:22px;padding:0 8px;border:1px solid rgba(0,180,170,.45);border-radius:5px;background:rgba(8,14,16,.86);color:#9fd8d3;font:600 11px ${FONT};letter-spacing:.02em;cursor:pointer;}
.ausboss-callout-tool:hover{color:#fff;border-color:${BRAND};}
.ausboss-callout-editor{position:absolute;inset:0;box-sizing:border-box;display:flex;flex-direction:column;gap:6px;padding:6px;border:1px solid ${BRAND};border-radius:8px;background:rgba(5,10,11,.95);pointer-events:auto;container-type:size;}
@@ -128,17 +90,6 @@ ${TILE_FACE_CSS}
.ausboss-callout-pick svg{display:block;width:100%;height:100%;}
.ausboss-callout-size{flex:none;height:24px;margin-left:4px;padding:0 7px;border:1px solid rgba(0,180,170,.35);border-radius:5px;background:rgba(8,14,16,.9);color:#9fd8d3;font:600 11px ${FONT};cursor:pointer;}
.ausboss-callout-size:hover{border-color:${BRAND};background:rgba(0,180,170,.14);}
.ausboss-tile-editor{box-sizing:border-box;width:min(520px,94vw);max-height:86vh;overflow:auto;margin:auto;padding:24px;border:1px solid #365957;border-top:3px solid ${BRAND};border-radius:10px;background:#111b1c;color:#e6f4f3;box-shadow:0 18px 64px #0008;font:14px/1.5 ${FONT};}
.ausboss-tile-editor::backdrop{background:#06090ab8;}
.ausboss-tile-editor h2{margin:0 0 18px;font-size:21px;}
.ausboss-tile-editor label{display:flex;flex-direction:column;gap:7px;margin-bottom:16px;font-weight:600;}
.ausboss-tile-editor input,.ausboss-tile-editor textarea{box-sizing:border-box;width:100%;padding:10px 12px;border:1px solid #365957;border-radius:5px;background:#080e10;color:#e6f4f3;font:16px/1.5 ${FONT};user-select:text;}
.ausboss-tile-editor textarea{min-height:120px;resize:vertical;}
.ausboss-tile-editor :is(input,textarea):focus{outline:2px solid ${BRAND};outline-offset:1px;}
.ausboss-tile-editor footer{display:flex;justify-content:flex-end;align-items:center;gap:8px;}
.ausboss-tile-editor footer span{margin-right:auto;color:#99b0ad;font-size:12px;}
.ausboss-tile-editor .ausboss-compact-action{height:32px;padding:0 15px;font-size:13px;}
.ausboss-tile-editor .ausboss-tile-error{color:#ffc36d;margin:0 0 12px;}
@container (max-width:395px){.ausboss-callout-arrowbar>span:first-child,.ausboss-callout-link:not(.has-node){display:none;}}
@container (max-width:395px) and (min-height:112px){.ausboss-callout-arrowbar{flex-wrap:wrap;}.ausboss-callout-pick{flex:none;}}
`;
@@ -174,25 +125,6 @@ function arrowIcon(kind) {
return root;
}
// The small line icons an Info card's title can start with.
const CARD_ICON_PATHS = {
clock: ["M12 7v5l3.2 2"],
info: ["M12 11v6", "M12 7.6v.01"],
warning: ["M12 3.5 2.8 19.5h18.4Z", "M12 10v4", "M12 16.9v.01"],
tip: ["M9.5 18h5", "M10.5 21h3", "M12 3a6 6 0 0 0-3.6 10.8c.7.6 1.1 1.3 1.1 2.2h5c0-.9.4-1.6 1.1-2.2A6 6 0 0 0 12 3Z"],
check: ["M8 12.4l2.8 2.8 5.2-5.6"],
};
const CARD_ICON_RING = new Set(["clock", "info", "check"]);
function cardIcon(kind) {
const span = el("span", "ausboss-callout-icon");
const root = svg("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" });
if (CARD_ICON_RING.has(kind)) root.append(svg("circle", { cx: 12, cy: 12, r: 9 }));
for (const d of CARD_ICON_PATHS[kind] ?? []) root.append(svg("path", { d }));
span.append(root);
return span;
}
// The node a link names, looked up in the graph the note sits in.
function linkedNode(state, id) {
const graph = state.node.graph ?? app.graph;
@@ -245,18 +177,6 @@ function arrowSpan(state, kind, piece = {}) {
function linkRun(state, first) {
if (first.url !== undefined) {
const link = el("a", "ausboss-callout-url");
const tile = state.card.dataset.tile;
if (tile === "youtube" || tile === "discord") {
const icon = svg("svg", { viewBox:"0 0 28 20", "aria-hidden":"true" });
if (tile === "youtube") {
icon.append(svg("rect",{x:0,y:1,width:28,height:18,rx:5,fill:"white"}),
svg("path",{d:"M11 5.5 19 10 11 14.5Z",fill:"#ae2639"}));
} else {
icon.append(svg("path",{d:"M4 3 10 1l1 2a15 15 0 0 1 6 0l1-2 6 2c2 4 3 8 3 12l-6 4-2-3a17 17 0 0 1-10 0l-2 3-6-4c0-4 1-8 3-12Z",fill:"white"}));
for (const cx of [9,19]) icon.append(svg("ellipse",{cx,cy:10,rx:2,ry:2.6,fill:"#5146aa"}));
}
link.append(icon);
}
link.href = first.url;
link.target = "_blank";
link.rel = "noopener noreferrer";
@@ -301,79 +221,13 @@ function bringIntoView(target) {
}
}
// One line's pieces into an element. The pieces of one link sit in one
// element; a link that leaves ComfyUI ends with a small ↗.
function appendPieces(state, into, line) {
let run = null;
let wrap = null;
const close = () => {
if (wrap?.classList.contains("ausboss-callout-url")) wrap.append(el("span", "ausboss-callout-out", "↗"));
};
for (const piece of line) {
if (piece.run !== run) {
close();
run = piece.run;
wrap = run === undefined ? null : linkRun(state, piece);
if (wrap) into.append(wrap);
}
const target = wrap ?? into;
if (piece.arrow) target.append(arrowSpan(state, piece.arrow, piece));
else target.append(piece.bold ? el("b", "", piece.text) : document.createTextNode(piece.text));
}
close();
}
// An Info card: a title, rows of label and value, and small print.
function renderCard(state, blocks) {
for (const lines of blocks) {
const block = el("div", "ausboss-callout-block");
for (const line of lines) {
let row;
if (line.kind === "title") {
row = el("div", "ausboss-callout-title");
if (line.icon) row.append(cardIcon(line.icon));
const words = el("span");
appendPieces(state, words, line.pieces);
row.append(words);
} else if (line.kind === "row") {
row = el("div", `ausboss-callout-row${line.highlight ? " is-mark" : ""}`);
for (const cell of line.cells) {
const side = el("span");
appendPieces(state, side, cell);
row.append(side);
}
} else {
row = el("div", "ausboss-card-text");
appendPieces(state, row, line.pieces);
}
if (line.small) row.classList.add("ausboss-card-small");
block.append(row);
}
state.inner.append(block);
}
}
function renderText(state) {
const style = state.node.properties?.ausbossCalloutTile;
if (["youtube","discord","title"].includes(style)) state.card.dataset.tile = style;
else delete state.card.dataset.tile;
// An Info card has no title bar, like a tile, but keeps the full editor
// and saves as a plain Callout: an older pack shows its text as a note.
if (style === "card") state.card.dataset.card = "";
else delete state.card.dataset.card;
const isCard = style === "card";
setTileFace(state.node, state.root, Boolean(state.card.dataset.tile) || isCard, () => startEdit(state));
const blocks = isCard ? parseCard(state.valueWidget.value) : parseBlocks(state.valueWidget.value);
const blocks = parseBlocks(state.valueWidget.value);
state.inner.replaceChildren();
state.empty = blocks.length === 0;
if (state.empty) {
state.inner.append(el("div", "ausboss-callout-empty", "Double-click to write a note"));
}
if (isCard) {
renderCard(state, blocks);
fit(state);
return;
}
for (const lines of blocks) {
const point = el("div", "ausboss-callout-point");
lines.forEach((line, index) => {
@@ -381,7 +235,21 @@ function renderText(state) {
// lines are told apart by a break, as before; a block needs none.
const into = line.small ? el("div", "ausboss-callout-small") : point;
if (index && !line.small && !lines[index - 1].small) point.append(document.createElement("br"));
appendPieces(state, into, line);
let run = null;
let wrap = null;
for (const piece of line) {
// The pieces of one link sit in one element.
if (piece.run !== run) {
if (wrap?.classList.contains("ausboss-callout-url")) wrap.append(el("span", "ausboss-callout-out", "↗"));
run = piece.run;
wrap = run === undefined ? null : linkRun(state, piece);
if (wrap) into.append(wrap);
}
const target = wrap ?? into;
if (piece.arrow) target.append(arrowSpan(state, piece.arrow, piece));
else target.append(piece.bold ? el("b", "", piece.text) : document.createTextNode(piece.text));
}
if (wrap?.classList.contains("ausboss-callout-url")) wrap.append(el("span", "ausboss-callout-out", "↗"));
if (line.small) point.append(into);
});
state.inner.append(point);
@@ -451,9 +319,7 @@ function fit(state) {
inner.style.fontSize = `${px}px`;
return inner.offsetHeight <= height && inner.scrollWidth <= width + 1;
};
const size = fitFontSize(fits, undefined, card.dataset.card === undefined ? undefined : CARD_FONT_MAX);
const social = card.dataset.tile === "youtube" || card.dataset.tile === "discord";
inner.style.fontSize = `${social ? Math.min(size, 16) : size}px`;
inner.style.fontSize = `${fitFontSize(fits)}px`;
}
function markChanged() {
@@ -465,84 +331,12 @@ function markChanged() {
}
}
function startTileEdit(state) {
if (state.editor) return;
const original = String(state.valueWidget.value ?? "");
const social = ["youtube", "discord"].includes(state.card.dataset.tile);
const link = social ? tileLinkFields(original) : null;
const dialog = el("dialog", "ausboss-tile-editor");
const heading = social ? "Edit link tile" : "Edit title";
dialog.setAttribute("aria-label", heading);
dialog.append(el("h2", "", heading));
const label = el("label", "", link ? "Button text" : "Text");
const text = el(link ? "input" : "textarea");
text.value = link?.label ?? original;
label.append(text);
dialog.append(label);
let address;
if (link) {
const field = el("label", "", "Link address");
address = el("input");
address.type = "url";
address.value = link.url;
field.append(address);
dialog.append(field);
}
const error = el("p", "ausboss-tile-error");
error.setAttribute("role", "alert");
const foot = el("footer");
const cancel = compactAction("Cancel");
const save = compactAction("Save");
foot.append(el("span", "", "Ctrl + Enter to save"), cancel, save);
dialog.append(error, foot);
const commit = () => {
let value = text.value;
try {
if (address) value = tileLinkText(text.value, address.value);
} catch (problem) {
error.textContent = problem.message;
return;
}
if (value !== original) {
state.node.graph?.beforeChange?.();
commitWidgetValue(state.node, state.valueWidget, value, app.canvas);
renderText(state);
state.node.graph?.afterChange?.();
markChanged();
}
dialog.close();
};
save.addEventListener("click", commit);
cancel.addEventListener("click", () => dialog.close());
dialog.addEventListener("keydown", event => {
event.stopPropagation();
if (event.key === "Enter" && (event.ctrlKey || event.metaKey)) {
event.preventDefault();
commit();
}
});
dialog.addEventListener("keyup", event => event.stopPropagation());
dialog.addEventListener("close", () => {
state.editor = null;
dialog.remove();
state.root.querySelector(".ausboss-callout-tool")?.focus();
}, { once: true });
state.editor = dialog;
document.body.append(dialog);
dialog.showModal();
text.focus();
text.select();
}
function startEdit(state) {
if (state.editor) return;
if (state.card.dataset.tile) return startTileEdit(state);
const wrap = el("div", "ausboss-callout-editor");
const area = el("textarea", "ausboss-callout-edit");
area.value = state.valueWidget.value ?? "";
area.placeholder = state.card.dataset.card === undefined
? "One idea per paragraph. **Bold** a word to stress it. The buttons below add an arrow, make a line small or make words a link."
: "The first line is the title. Write label | value for a row. **Bold** a whole row to make it teal. Small makes a line small print.";
area.placeholder = "One idea per paragraph. **Bold** a word to stress it. The buttons below add an arrow, make a line small or make words a link.";
area.spellcheck = true;
const bar = el("div", "ausboss-callout-arrowbar");
bar.append(el("span", "", "Arrow"));
@@ -649,6 +443,7 @@ function startEdit(state) {
if (event.target !== area) event.preventDefault();
});
wrap.addEventListener("pointerdown", (event) => event.stopPropagation());
wrap.addEventListener("wheel", (event) => event.stopPropagation(), { passive: true });
// Clicking another node on the canvas takes the keyboard from the text box.
// That is how the link is picked, so the edit stays open then; a click on
// empty canvas, or on the note itself, ends it.
@@ -704,17 +499,16 @@ function buildPanel(node) {
root.append(card);
tools.addEventListener("pointerdown", (event) => event.stopPropagation());
const panelHeight = () => (card.dataset.tile ? 36 : PANEL_MIN_HEIGHT) + WIDGET_FRAME;
const domWidget = node.addDOMWidget(WIDGET_NAME, "ausboss_callout", root, {
serialize: false,
hideOnZoom: false,
getMinHeight: panelHeight,
getMinHeight: () => PANEL_MIN_HEIGHT + WIDGET_FRAME,
});
keepDomWidgetWidthAuto(domWidget);
domWidget.serialize = false;
fillNodeHeight(domWidget, {
minWidth: PANEL_MIN_WIDTH,
minHeight: panelHeight,
minHeight: () => PANEL_MIN_HEIGHT + WIDGET_FRAME,
minNodeSize: [PANEL_MIN_WIDTH, PANEL_MIN_HEIGHT + 40],
exactMinWidth: true,
});
@@ -722,9 +516,6 @@ function buildPanel(node) {
const state = { node, valueWidget, domWidget, root, card, inner, empty: true, editor: null, frame: 0 };
node.__ausbossCallout = state;
edit.addEventListener("click", () => startEdit(state));
card.addEventListener("dblclick", (event) => {
if (card.dataset.tile && !event.target.closest("a,button,textarea,.ausboss-callout-editor")) startEdit(state);
});
state.observer = new ResizeObserver(() => {
cancelAnimationFrame(state.frame);
state.frame = requestAnimationFrame(() => fit(state));
@@ -744,7 +535,7 @@ app.registerExtension({
// A note copied with what its links name follows the copies.
onPaste(({ nodes, groups, created }) => {
for (const node of created) {
if (!CALLOUT_TYPES.has(node?.comfyClass) && !CALLOUT_TYPES.has(node?.type)) continue;
if (node?.comfyClass !== NODE_CLASS && node?.type !== NODE_CLASS) continue;
const state = buildPanel(node);
if (!state) continue;
const text = repointLinks(state.valueWidget.value, nodes, groups);
@@ -755,29 +546,16 @@ app.registerExtension({
});
},
beforeRegisterNodeDef(nodeType, nodeData) {
if (!CALLOUT_TYPES.has(nodeData?.name)) return;
if (nodeData?.name !== NODE_CLASS) return;
hideInputsInDef(nodeData, ["text"]);
chainCallback(nodeType.prototype, "onNodeCreated", function () {
if (nodeData.name === "AUSBOSS_NODES_CalloutTile") {
this.properties ??= {};
this.properties.ausbossCalloutTile ??= "title";
}
buildPanel(this);
// Keep new tiles compact without changing ordinary or saved callouts.
if (nodeData.name === "AUSBOSS_NODES_CalloutTile") this.setSize?.([380, 80]);
});
chainCallback(nodeType.prototype, "onSerialize", function (saved) {
serializeNoteIdentity(saved, ["youtube", "discord", "title"].includes(this.properties?.ausbossCalloutTile));
});
chainCallback(nodeType.prototype, "onConfigure", function (saved) {
chainCallback(nodeType.prototype, "onConfigure", function () {
// Saved values land after onNodeCreated; show them.
queueMicrotask(() => {
const state = buildPanel(this);
if (!state) return;
renderText(state);
if ((state.card.dataset.tile || state.card.dataset.card !== undefined) && Number.isFinite(saved?.size?.[1])) {
this.setSize?.([this.size[0], saved.size[1]]);
}
if (state) renderText(state);
});
});
chainCallback(nodeType.prototype, "onDblClick", function () {
@@ -787,28 +565,12 @@ app.registerExtension({
chainCallback(nodeType.prototype, "getExtraMenuOptions", function (_canvas, options) {
const state = this.__ausbossCallout;
if (!state || !Array.isArray(options)) return;
for (const [style, label] of [["plain","Plain callout"],["card","Info card"],["title","Title tile"],["youtube","Set YouTube link tile"],["discord","Set Discord link tile"]]) {
options.unshift({ content: label, callback: () => {
this.properties ??= {};
this.properties.ausbossCalloutTile = style;
const preset = LINK_TILES[style];
if (preset) commitWidgetValue(this, state.valueWidget, `[${preset.label}](${preset.url})`, app.canvas);
// An empty card starts with text that shows how one is written.
const starter = style === "card" && !String(state.valueWidget.value ?? "").trim();
if (starter) commitWidgetValue(this, state.valueWidget, CARD_TEMPLATE, app.canvas);
renderText(state);
if (starter) this.setSize?.([Math.max(this.size[0], CARD_SIZE[0]), CARD_SIZE[1]]);
else if (style !== "plain" && style !== "card") this.setSize?.([this.size[0], style === "title" ? 86 : 78]);
markChanged();
}});
}
options.unshift({ content: "Edit callout text", callback: () => startEdit(state) }, null);
});
chainCallback(nodeType.prototype, "onRemoved", function () {
const state = this.__ausbossCallout;
if (!state) return;
state.observer?.disconnect();
state.editor?.close?.();
cancelAnimationFrame(state.frame);
this.__ausbossCallout = null;
});
+4 -13
View File
@@ -5,16 +5,16 @@
// zooming stopped over Compare, the crop previews, the video viewers and every
// control on a card. One listener here hands those gestures back, the same way
// ComfyUI does for its own text boxes. A panel that wants the wheel for itself
// (a scrolling list, a long text box) keeps it while it can still scroll.
// (a scrolling list, a focused text field, an editor) still keeps it.
//
// A file dragged in from the desktop, or a picture's card from the Assets
// panel, has the same problem in the classic renderer: dropped on a node's
// title it loads into the node, dropped on the node's panel (the picture, the
// controls) it missed the node. The drop listeners here hand it to the node
// under the pointer.
import { app } from "../../../scripts/app.js";
import { app } from "/scripts/app.js";
import {
dragCarriesFiles, graphDragStarts, panelHost, panelKeepsWheel, panelNeedsDropHelp, panelRoot, vueBoxKeepsWheel,
dragCarriesFiles, graphDragStarts, panelHost, panelKeepsWheel, panelNeedsDropHelp, panelRoot,
} from "../shared/canvas_passthrough.mjs";
import { showToast } from "../shared/index.mjs";
@@ -26,20 +26,12 @@ function canvas() {
return app.canvas ?? null;
}
// Nodes 2.0 hands every wheel turn over a node to the graph before the node
// sees it. This runs first, on the way down: a box of the pack's that can
// still scroll keeps the wheel, the event stops here, and the browser
// scrolls the box.
function onWheelFirst(event) {
if (vueBoxKeepsWheel(event.target, event, { styleOf: (el) => getComputedStyle(el) })) event.stopPropagation();
}
function onWheel(event) {
const target = event.target;
const root = panelRoot(target);
const lgCanvas = canvas();
if (!root || !lgCanvas || event.defaultPrevented) return;
if (panelKeepsWheel(target, event, { root, host: panelHost(target), styleOf: (el) => getComputedStyle(el) })) return;
if (panelKeepsWheel(target, event, { root, host: panelHost(target), styleOf: (el) => getComputedStyle(el), activeElement: document.activeElement })) return;
event.preventDefault();
lgCanvas.processMouseWheel(event);
}
@@ -136,7 +128,6 @@ app.registerExtension({
// The wheel listener sits in the bubble phase so a panel's own handler
// (stopPropagation / preventDefault) always gets the first say.
window.addEventListener("wheel", onWheel, { passive: false });
window.addEventListener("wheel", onWheelFirst, { capture: true, passive: true });
window.addEventListener("pointerdown", onPointerDown, true);
window.addEventListener("pointermove", onPointerMove, true);
window.addEventListener("pointerup", onPointerEnd, true);
+2 -2
View File
@@ -1,5 +1,5 @@
import { app } from "../../../scripts/app.js";
import { api } from "../../../scripts/api.js";
import { app } from "/scripts/app.js";
import { api } from "/scripts/api.js";
import { AUSBOSS_JS_VERSION, BRAND, BRAND_BODY, chainCallback } from "../shared/index.mjs";
import { nodeByExecutionId } from "../shared/graph_ids.mjs";
import { isOwnRun, ownRuns } from "../shared/prompt_scope.mjs";
-53
View File
@@ -1,53 +0,0 @@
// Clear VRAM 🆎 — a right-click entry on the empty canvas that unloads every
// model and frees memory on the ComfyUI server this page is connected to.
//
// It sends the same request as ComfyUI's own "Unload Models and Execution
// Cache" command (top menu, Edit): POST /free with unload_models and
// free_memory. That command is not on the right-click menu, so this entry
// puts it one click away. A setting hides the entry; a ComfyUI that turns
// manual unloading off (Comfy.Memory.AllowManualUnload) hides it too.
import { api } from "../../../scripts/api.js";
import { app } from "../../../scripts/app.js";
import { showToast } from "../shared/index.mjs";
const SETTING_ID = "AusBoss.Memory.ClearVramMenu";
const MENU_LABEL = "Clear VRAM 🆎";
function setting(id) {
return app.ui?.settings?.getSettingValue?.(id);
}
async function clearVram() {
try {
const response = await api.fetchApi("/free", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ unload_models: true, free_memory: true }),
});
if (!response.ok) throw new Error(`the server answered ${response.status}`);
showToast({ severity: "success", summary: MENU_LABEL, detail: "Models unloaded and memory freed.", life: 3000 });
} catch (error) {
showToast({ severity: "error", summary: MENU_LABEL, detail: `Could not clear VRAM: ${error?.message ?? error}` });
}
}
app.registerExtension({
name: "ausboss.clear.vram",
settings: [
{
id: SETTING_ID,
name: "Clear VRAM on the right-click menu",
type: "boolean",
defaultValue: true,
category: ["🆎 AusBoss", "Memory", "Clear VRAM menu"],
tooltip:
"Right-click the empty canvas for Clear VRAM: it unloads every model and frees "
+ "memory on the ComfyUI server. Off hides the entry.",
},
],
getCanvasMenuItems() {
if (setting(SETTING_ID) === false) return [];
if (setting("Comfy.Memory.AllowManualUnload") === false) return [];
return [{ content: MENU_LABEL, callback: clearVram }];
},
});
+12 -64
View File
@@ -1,5 +1,5 @@
import { api } from "../../../scripts/api.js";
import { app } from "../../../scripts/app.js";
import { api } from "/scripts/api.js";
import { app } from "/scripts/app.js";
import { isForeignRun, outputKey } from "../shared/prompt_scope.mjs";
import { BRAND, chainCallback, keepDomWidgetWidthAuto, notifyAusbossChange } from "../shared/index.mjs";
import { lookupLink } from "../shared/graph_links.mjs";
@@ -14,10 +14,6 @@ import {
compareBadges,
compareClip,
compareResultSide,
REST_PROPERTY,
savedRestSide,
SWITCH_CONTROL_INPUTS,
SWITCH_NODE_TYPES,
compareSizeLabel,
compareSwitchValue,
findComparePairs,
@@ -186,15 +182,9 @@ function linkView(graph) {
const link = lookupLink(graph, linkId);
return link ? { id: String(link.origin_id), slot: link.origin_slot } : null;
};
const inputs = (id) => graph?.getNodeById?.(id)?.inputs ?? [];
return {
origin,
feeds: (id) => inputs(id).map((input) => origin(input?.link)?.id),
branches(id) {
const node = graph?.getNodeById?.(id);
if (!SWITCH_NODE_TYPES.has(node?.comfyClass ?? node?.type)) return null;
return inputs(id).filter((input) => !SWITCH_CONTROL_INPUTS.has(input?.name)).map((input) => origin(input?.link)?.id);
},
feeds: (id) => (graph?.getNodeById?.(id)?.inputs ?? []).map((input) => origin(input?.link)?.id),
inside(id) {
const subgraph = graph?.getNodeById?.(id)?.subgraph;
if (!subgraph) return null;
@@ -205,40 +195,18 @@ function linkView(graph) {
}
// Which input holds the result, read from the graph the panel sits in.
function guessResultSide(node) {
function resultSide(node) {
const view = linkView(node.graph);
const source = (name) => view.origin(node.inputs?.find((input) => input?.name === name)?.link);
return compareResultSide(source("image_a"), source("image_b"), view);
}
// The picture the panel rests on, saved with the node. A node from a
// workflow saved before the choice existed has none: its side is worked out
// from the links, as earlier versions did, and held in memory only. Writing
// it into the node would mark every older workflow as changed when it opens;
// it is written when someone picks a side in the menu.
function restSide(node) {
const saved = savedRestSide(node.properties?.[REST_PROPERTY]);
if (saved) return saved;
node.__ausbossRestGuess ??= guessResultSide(node);
return node.__ausbossRestGuess;
}
// Slide mode rests on its saved picture while the pointer is away.
// Slide mode rests on the result while the pointer is away.
function showResult(state) {
state.fraction = restSide(state.node) === "B" ? 0 : 1;
state.fraction = resultSide(state.node) === "B" ? 0 : 1;
applyClip(state);
}
// The right-click choice: rest on the other picture from now on.
function setRestSide(node, side) {
node.properties ??= {};
node.properties[REST_PROPERTY] = side;
const state = node.__ausbossCompare;
if (state && getMode(node) === "slide" && !state.stage.matches(":hover")) showResult(state);
node.setDirtyCanvas?.(true, true);
notifyAusbossChange();
}
// A click on the mode switch. The mode saves with the workflow; a flip
// between A and B within the lock does too, through the side it stores.
function pickMode(state, value) {
@@ -465,11 +433,10 @@ app.registerExtension({
defaultValue: true,
category: ["🆎 AusBoss", "Image Compare", "Rest on the result"],
tooltip:
"While the pointer is away, Image Compare A/B shows the picture it "
+ "rests on: B on a new node, or the one picked in the node's "
+ "right-click menu. It does after every run, and again each time "
+ "the pointer leaves the picture. Off: it stays on the picture "
+ "nearest to where the pointer left, and a new run does not change it.",
"While the pointer is away, Image Compare A/B shows the result: "
+ "after every run, and again each time the pointer leaves the "
+ "picture. Off: it stays on the picture nearest to where the "
+ "pointer left, and a new run does not change it.",
onChange(value) {
restOnResult = value !== false;
},
@@ -487,9 +454,6 @@ app.registerExtension({
beforeRegisterNodeDef(nodeType, nodeData) {
if (nodeData?.name !== NODE_NAME) return;
chainCallback(nodeType.prototype, "onNodeCreated", function () {
// A new node rests on B. A loaded one gets its saved side back in onConfigure.
this.properties ??= {};
this.properties[REST_PROPERTY] = "B";
buildPanel(this);
// Only for a genuinely new node: onConfigure restores a saved size after
// this runs, so a workflow's own dimensions still win.
@@ -498,14 +462,9 @@ app.registerExtension({
Math.max(DEFAULT_NODE_SIZE[1], this.size?.[1] ?? 0),
]);
});
chainCallback(nodeType.prototype, "onConfigure", function (info) {
const state = this.__ausbossCompare;
// Saved before the choice existed: drop the new node's B, so the side
// is worked out from the links.
if (!savedRestSide(info?.properties?.[REST_PROPERTY])) delete this.properties?.[REST_PROPERTY];
this.__ausbossRestGuess = undefined;
chainCallback(nodeType.prototype, "onConfigure", function () {
queueMicrotask(() => {
if (!state || this.__ausbossCompare !== state || state.abort.signal.aborted) return;
const state = buildPanel(this);
state.showingB = this.properties?.ausboss_compare_side === "B";
syncErase(state);
// The saved paint, if the pictures are already up.
@@ -522,19 +481,8 @@ app.registerExtension({
if (!pairs.length) setEmpty(state, "Execution finished without compare previews");
app.canvas?.setDirty?.(true, true);
});
// Which picture the panel rests on, kept with the workflow.
chainCallback(nodeType.prototype, "getExtraMenuOptions", function (_canvas, options) {
if (!Array.isArray(options)) return;
const side = restSide(this);
const other = side === "A" ? "B" : "A";
options.unshift(
{ content: `Show ${other} when the pointer is away (now ${side})`, callback: () => setRestSide(this, other) },
null,
);
});
// A link on the filename input decides whether the name is typed here.
chainCallback(nodeType.prototype, "onConnectionsChange", function () {
this.__ausbossRestGuess = undefined; // an older node's side follows its links
this.__ausbossCompare?.eraser?.refresh();
});
chainCallback(nodeType.prototype, "onRemoved", function () {
+2 -49
View File
@@ -7,48 +7,9 @@ to point at the part you are talking about.
Use it to explain a step in a workflow you share. It never runs and has no
wires.
## Tile presets
## Writing
Right-click the Callout and choose **Title tile** to give your existing text a black heading with a teal accent. **Set YouTube link tile** and **Set Discord link tile** fill in the AusBoss link and label. Click the label to open the link, or drag the tile to move it. Choose **Plain callout** to return to the standard style with the current text.
- Press **Edit** on a tile to open a larger editor. A link tile has separate **Button text** and **Link address** fields. Existing mixed text stays in a text box.
- Double-click a title to edit it. **Save** or `Ctrl+Enter` keeps the change; **Cancel** or `Esc` leaves the original text.
- Drag the visible bottom-right grip to resize. You can also focus the grip and use arrow keys; hold **Shift** for smaller changes. Resizing keeps the tile in place and supports Undo.
## Info card
A small card for facts people look up: run times, settings, what each choice
does. Right-click the Callout and choose **Info card**. An empty note starts
with sample text that shows each part.
Write it like this:
```text
⏱️ Too slow?
###### Redraw time on an RTX 5090. Smaller cards take longer.
2x, 18 steps | ~4 min
2x, 10 steps | ~3 min
1.5x, 18 steps | ~2.5 min
**1.5x, 10 steps (default) | ~2 min**
###### 1.5x is a 4608-wide sheet, 2x is 6144.
```
- The first line is the card's title. Start it with ⏱️ ℹ️ ⚠️ 💡 or ✅ and
that emoji is drawn as a small icon.
- A line with a `|` in it is a row: the words before the `|` on the left,
the rest on the right.
- Put the whole row in two stars, `**like this | value**`, and it is drawn
in teal. Use it for the default or the one to pick.
- Small print (the **Small** button) is a grey line, for a subtitle or a note
at the bottom.
- A blank line leaves a gap. Arrows and links work as in any callout.
- Double-click the card to edit it. Choose **Plain callout** to turn it back
into a note; the text stays.
- On a plain callout, double-click the note, or press **Edit**, to type. Click outside the box to
- Double-click the note, or press **Edit**, to type. Click outside the box to
keep the text. **Esc** drops what you typed.
- A blank line starts a new point. Each point gets a thin teal line beside it.
- Put two stars around a word to stress it: `**Resize is on.**`
@@ -121,13 +82,5 @@ In the text a link is written `[the words](https://example.com)`, or
it to read the address before you click.
- An older version of the pack shows a link as typed, brackets and address
included, so the address can still be read and copied there.
- An Info card is saved as an ordinary Callout with the text you typed.
The card look is a setting on the node, so an older version of the pack
shows the same text as a plain note, rows written out as `label | value`.
A plain callout never reads `|` as a row, so notes written before look
the same.
- A row splits at its first `|` that is not inside a link. A row pasted
from a Markdown table loses its outer pipes, and the table's `---` line
is skipped. An Info card's text grows with the card, up to 20 px.
- The font is IBM Plex Sans when the computer has it, otherwise the system
font. The node loads no fonts and makes no network requests.
-7
View File
@@ -1,7 +0,0 @@
# Callout Tile
A compact title or colored link button for a workflow. Choose **Title tile**, **Set YouTube link tile**, or **Set Discord link tile** from its menu. Press **Edit** to change its text or link; you can also double-click a title. Drag its visible corner to resize.
It uses the same text, arrows and links as [Callout](AUSBOSS_NODES_Callout.md). **Plain callout** returns to the ordinary note face. Nothing runs and it has no outputs.
Tiles save with their own node type. If ComfyUI reports this node missing, install or update **ComfyUI-AusBoss**, restart ComfyUI, and reload the workflow. An older pack cannot draw the tile correctly. Keep the missing node so its text and settings are preserved.
+3 -16
View File
@@ -2,9 +2,8 @@
Makes one picture's colors match another's. Use it when an inpainted or
stitched area comes back a little too warm, cool, dark or bright next to the
original. Four methods go from a gentle fix to an exact match. A fifth,
**kept**, is for edits whose new part looks too crisp and colourful next to
the rest of the picture. A first-frame mode matches every frame of a video to its first, which can
original. Four methods go from a gentle fix to an exact match, and a
first-frame mode matches every frame of a video to its first, which can
reduce color drift between frames.
## Controls
@@ -16,7 +15,7 @@ reduce color drift between frames.
inpaint, feed the original image here. A single reference broadcasts
across a batch; a matched batch pairs frame to frame. Required unless
**Reference** (`reference_mode`) is **first frame**.
- **Method** (`method`): How the colors move. A line under it says what the picked one does.
- **Method** (`method`): How the colors move.
- **lab** — per-channel mean/std shift in LAB. Perceptual and the safe
default: corrects overall casts and contrast without shifting
individual hues around.
@@ -25,13 +24,6 @@ reduce color drift between frames.
not just shifted.
- **hist** (`histogram`) — matches each channel's distribution exactly.
The strongest and least subtle.
- **kept** — for an edit, with the picture from before the edit as
**reference**. Edit models often hand back the parts they were asked
to keep a little darker, with more contrast and colour, so a new sign or
word looks pasted on. This method learns that shift from the parts the
model kept and undoes it everywhere. New things keep their own colours:
green apples that replaced oranges stay green. The reference must be the
same size as the image.
- **mask** (optional): Restricts the match to the white area — both the
statistics measured on the image and where the correction lands. Black
pixels pass through **bit-identical**. Reference statistics always come
@@ -51,11 +43,6 @@ reduce color drift between frames.
## Notes
- For an edit in a box, put **kept** between the model and **Stitch Inpaint
🆎**: the model's crop into **image**, Crop For Inpaint's crop into
**reference**, its mask into **mask**. The fix is learned and applied
inside the box only.
- The node takes a mask but outputs none on purpose: the mask only scopes
the fix and passes through your graph unchanged — wire your original
mask onward.
+14 -16
View File
@@ -20,9 +20,10 @@ middle of a graph without breaking anything downstream.
Run the workflow once to load the previews. The switch under the picture
picks what the panel does, and its marker slides to your choice:
- **Slide** (default): the panel shows B, the result. Move the pointer
across it to compare: A appears on the left of the line and B on the
right. Move the pointer away and B is back. Every new run shows it too.
- **Slide** (default): the panel shows the result. Move the pointer across
it to compare: A appears on the left of the line and B on the right. Move
the pointer away and the result is back. Every new run shows its result
too.
- **A** / **B**: show that picture and hold it, whatever the pointer does.
- **Erase**: mix the two pictures by hand. One picture is on top; paint on
it and it rubs away, so the other one shows through. Then save the mix.
@@ -63,7 +64,6 @@ Pick **Erase** on the switch. A row of tools opens above the picture:
away. Restore paints it back. Holding **Ctrl**, or using the right
mouse button, does the other one for as long as you hold it.
- **Size** is the brush's width, in pixels of the picture.
- The dot beside **Size** previews one brush dab. It grows with Size and its edge fades as you increase Soft.
- **Soft** is the brush's edge: 0 is a hard edge, 100 fades all the way
from the middle.
- Drag left and right on **Size** or **Soft**, on the word, the number or
@@ -131,12 +131,11 @@ Your paint is kept with the workflow. A new run keeps it while the picture
keeps its size, so you can change a seed and look again; press **CLEAR**
to start over. Pictures of another size start clean.
## Which picture shows when the pointer is away
## Which picture is the result
B, the "after" picture, on a new node. If your result is wired to A,
right-click the node and choose **Show A when the pointer is away**. The
choice is saved with the workflow. To keep one picture up whatever the
pointer does, use the **A** or **B** button.
B, the "after" picture. If your graph makes A out of B's picture (B is the
picture you loaded and A is the edited one), the result is A. To keep one
picture up whatever happens, use the **A** or **B** button.
## Outputs
@@ -152,13 +151,12 @@ network requests are made.
## Technical details
- While sliding, the outer 6% on either side snaps to a full image.
- The side is saved in the node's `ausboss_compare_rest` property. A
workflow saved by an earlier version has none, so its side is worked out
from the links, the way earlier versions did, until a side is picked in
the menu: when A is made from B's picture, A is the result. A switch
counts only when it cannot hand on the picture B started from. When both
pictures come out of one subgraph, the same check is made inside it. In
every other case it is B.
- The result is found from the links: when the node that feeds `image_b` is
somewhere upstream of the node that feeds `image_a`, A was made from B and
A is the result. When both pictures come out of one subgraph, the same
check is made inside it. In every other case it is B: two unrelated
pictures, both pictures out of one plain node, or a link the node cannot
follow (a Set and Get pair, for example).
- Settings → AusBoss → Image Compare → **Rest on the result** switches this
off. The panel then stays on the picture nearest to where the pointer
left, and a new run does not change it.
+1 -1
View File
@@ -110,7 +110,7 @@ parts back.
## Technical details
- Starting values: Context `1.2`, Blend `16` px, Multiple `32`; Grow, Blur,
- Starting values: Context `1.2`, Blend `16` px, Multiple `8`; Grow, Blur,
Extra context, the Target rows and the Extend rows start at `0`.
- With no Target size set, the crop is still rounded up to **Multiple**, so
with **Stay in picture** on it can still reach a few pixels (at most
-96
View File
@@ -1,96 +0,0 @@
# Cut Out
Turns a picture and a mask into a cut-out with a see-through background.
Use it to save a subject as a transparent PNG, or to lay it on a new
background. It goes after the node that makes the mask, such as Mask by
Name or Mask by Touch. In a Qwen Image cut-out workflow, where SAM 3 finds a
thing and Qwen paints it out of the picture, Cut Out turns the same mask and
the original picture into the transparent PNG.
**Clean edges** fixes the rim of old background colour that a cut-out
usually carries in hair and soft edges, so it sits cleanly on any new
background. Parts of the picture that are fully kept stay exactly as they
were.
Save Image keeps the transparency when it saves a PNG (or WebP). JPEG has no
transparency, so a JPEG shows the clear parts black.
The panel under the card shows the cut-out over a checkerboard once the
node has run (the first frame for a video). The small **preview** switch at
the right of the bar turns it off.
## Live preview
Once the node has a picture, the picture on the node redraws while you drag a
value, before you queue anything. Run the graph once to give the node its
picture (run once to get the picture and the mask); after that it changes as you drag. A small "not run yet" tag
shows while the picture is a preview and not a real result.
The **Fit | 100%** switch sits on the bar above the picture, left of Preview.
Fit shows the whole picture. 100% shows real pixels, and dragging on the
picture moves around it instead of moving the node. The cut-out shows over a checker, so see-through parts read as see-through.
## Controls
- **Keep** (`keep`): **white part** keeps what is under the white of the
mask, **black part** keeps what is under the black. Pick black part when
your mask covers the background rather than the subject.
- **Grow** (`grow`): grows the kept part by this many pixels, or shrinks it
with a negative number. Shrink by 1 or 2 when a thin line of old
background shows around the edge.
- **Feather** (`feather`): how soft the edge is, in pixels. `0` keeps the
mask's own edge. `1` takes the jagged steps off a hard mask.
- **Clean edges** (`clean_edges`): on by default. Works out the subject's
own colour where the edge is see-through (hair, fur, motion blur) and
puts it back, so the old background does not show as a halo. Turn it off
to keep the picture's colours everywhere.
### Behind **More**
- **Clear haze** (`clear_haze`): parts this see-through or more become fully
clear. Raise it a little (`0.05`) when a faint haze surrounds the cut-out.
- **Solid above** (`solid_above`): parts at least this solid become fully
solid. Lower it a little (`0.95`) to fill thin see-through spots inside
the subject.
- **Smooth video** (`smooth_frames`): for a video, blends each frame's edge
with this many frames before and after it, which calms an edge that
flickers from frame to frame. `0` is off. Keep it low (`1` or `2`) on
fast motion, or the edge lags behind the subject.
### Inputs and outputs
- **image**: the picture or video frames.
- **mask**: what to keep. One mask can cover every frame, or give one per
frame. A mask of another size is stretched to the picture.
- **image** (output): the cut-out as an RGBA picture with straight (not
premultiplied) alpha. If the input already had a transparent background,
both are kept.
- **alpha** (output): how solid each pixel is, as a mask: white is kept,
black is clear. Wire it to any node that wants the final mask.
## Technical details
- The alpha is made in a fixed order: pick the white or black part, grow or
shrink (whole pixels), feather (a Gaussian blur of that many pixels),
average over neighbouring frames, then the levels (Clear haze and Solid
above). Values within 0.0001 of solid or clear are made exactly solid or
clear.
- Clean edges uses blur-fusion foreground estimation (Forte and Pitie,
"Approximate Fast Foreground Colour Estimation", ICIP 2021), written in
torch for this pack and shared with Mask by Touch's fine edges: around
each pixel it averages the subject's colour and the background's from the
pixels nearby, corrects the subject's by what the pixel shows, and does
this once wide and once narrow. The widths follow the picture's size. It
needs no extra package. Pixels with an alpha of exactly 1 keep their
original colours to the bit.
- Frames are worked on eight at a time.
### Live preview
The preview runs the node's own maths in the browser: on a copy shrunk to the
size it is shown at in Fit, and on a real-pixel crop of the picture in 100%.
It is checked against the Python node on recorded values (`tests/test_live_parity.py`);
results agree to within 5e-5 on a 0 to 1 scale. The picture is the one the
last run kept, or a Load Image read through ComfyUI's own view route. When
the values match the last run, the real result is drawn instead.
-142
View File
@@ -1,142 +0,0 @@
# Edit Lock
Keeps every part of your picture that an edit did not change exactly where
it was, with the colors it had.
An edit model redraws the whole picture, also the parts you did not ask it
to change. Those parts often come back a little zoomed in, shifted or
tinted. Flip between the original and the edit and the whole picture
jumps. Edit Lock stops that: only the edit is new.
It needs no mask. It sees what the edit changes while the picture is being
made, and holds on to everything else.
## Quick start
1. Put **Edit Lock 🆎** between the model and the sampler: the model (after
any LoRA loader) goes in, and its `model` output goes to the sampler or
guider.
2. Wire the VAE into `vae` and the picture you are editing into `image`.
Use the same picture the edit model gets, at the size of the result.
3. After the VAE Decode, add **Edit Lock Restore 🆎**. Wire the decoded
picture into `image` and Edit Lock's `edit_lock` output into
`edit_lock`. This puts your own pixels back in the untouched parts.
4. Wire Restore's `report` into **Show Text 🆎** to read how much was kept.
Run your edit as usual. Prompt, steps and seed stay as they were.
## What it does with each kind of edit
- **A local edit** (add glasses, repaint the car, change the sign): the
edit happens, and the rest of the picture stays put.
- **An edit of the whole picture** (a new style, new light, fog):
there is nothing to keep, so Edit Lock steps aside and the edit runs as
if the node were not there. The report says so.
- **A soft effect over the whole picture** (rain, falling snow, haze):
it touches everything a little, so there is no untouched part to put
back. Edit Lock lets the effect through and only holds the picture in
place, so it does not come back zoomed or shifted. The report says so.
- **A soft effect and a clear change in one edit** (rain and an umbrella):
the node may lock on the umbrella and hold the rain back everywhere
else. If the effect is missing outside the changed part, set **Lock** to
`off`.
- **Something in between** (a new hair color on a close-up, a new
background behind a person): it may lock or step aside. The report says
which. These edits often change the light on the face too. `auto` steps
aside for most of them, so the new light comes with the new hair.
`always` keeps the old light on everything it keeps, which can look
wrong on a face. A mask settles it: paint the hair and the face, and
the rest is locked.
- **The model ignores your picture and draws a new one:** that reads as a
whole-picture edit, so `auto` steps aside. `always` holds the model to
your picture.
## Controls
- **model**: the edit model. Patch last, after any LoRAs.
- **vae**: the same VAE the workflow decodes with.
- **image**: the picture you are editing, at the size of the result. If
the sizes differ by more than a few percent the lock does nothing, and
the report says so.
- **Lock** (`lock`): `auto` (the default) locks the untouched parts and
steps aside when the whole picture changes. `always` locks even then.
`off` does nothing, which makes a quick before and after.
- **Tolerance** (`tolerance`): how big a change must be to count as part of
the edit. 1 is the default. Raise it if small unwanted changes get
through. Lower it if the lock holds back part of your edit.
- **mask** (optional): white marks where the edit may happen; everything
else is locked. With a mask the node does not look for the change
itself. A mask from **Mask by Touch 🆎** or **Mask by Name 🆎** works.
## Outputs
- **model**: the model with the lock on.
- **edit_lock**: what the lock kept, for Edit Lock Restore 🆎.
## Good to know
- The lock belongs to one picture. For an edit with two pictures, give it
the one the result should line up with.
- It works on single pictures, not video.
- The node watches the first steps of a run and locks for the rest, so
the model finishes the edit on top of your real picture. Shadows and
reflections the edit adds next to the changed part still come through.
- If your edit is missing and the report says nearly all of the picture
was kept, set **Lock** to `off`.
- Tested on MiniMax-H3-Image. The lock itself is not tied to one model, but
the line between "local edit" and "whole picture" was measured there.
## Technical details
At every step an edit model predicts the finished picture. Edit Lock
compares that prediction with your picture in latent space.
**Watching.** The first prediction of a run is a blur, and rain, snow or
the light a new hair color throws on a face only show a few steps in. So
the node watches until the noise is down to 0.8 of where it began: step 4
of a 6-step MiniMax-H3-Image run. A run that never gets that low decides
at its last step. While it watches, the model draws its own picture and
only one thing is corrected. The model often draws the whole picture about
one percent larger, or a little shifted. The node measures that zoom and
shift at every step, on the calmer half of the picture, and moves the
prediction back so it sits where your picture does.
**Deciding.** Change is measured against the quiet part of the picture:
the tenth where the prediction differs least. An even tint over the whole
picture is taken out first, so a color cast is not read as a change. A
spot counts as changed when it differs by 3 times the quiet level, or by 2
times while it touches a spot that does. So a faint change beside a clear
one belongs to the edit, and a faint change alone is redraw noise.
**Tolerance** multiplies both numbers.
**Locking.** From the decision on, wherever the picture did not change,
the original latent is put back before the sampler takes its next step. A
part once read as changed stays changed for the rest of the run. The last
step ends on the original there, so what was kept is the original itself,
not a redrawn copy.
**Stepping aside.** `auto` does not lock in three cases:
- At the first step the whole picture is already changing (a new style,
new light). The node reads the calmest fifth of a smoothed copy, where a
slightly larger redraw nearly vanishes and a new style does not. On
MiniMax-H3-Image, local edits at 1, 4 and 16 megapixels read 0.22 or
less there and whole-picture edits 0.27 or more; the line sits at 0.243.
The model then runs untouched.
- At the decision no place has changed clearly: the strongest spot of the
picture is under 4 times the quiet level. That is light rain or fog.
Local edits read 4.7 or more there, glasses and makeup included.
- At the decision the lock would hand a tenth of the picture or more to
the edit, yet the strongest hundredth of the picture is under 4 times
the quiet level. That is heavier rain or snow, and a lock would let it
through in patches. Local edits that wide read 4.4 or more; rain and
snow read 3.6 or less.
In the last two cases the node keeps undoing the zoom and shift to the end
of the run, and puts nothing back. An edit close to one of these lines (a
hair color change on a close-up, a new background, smoke) can fall on
either side. The report says which, and **Lock** overrides it.
This is the target the TailSteer paper trains a model toward (the source
where nothing changed, the model's own edit elsewhere), applied while
sampling. It needs no LoRA and no training.
-73
View File
@@ -1,73 +0,0 @@
# Edit Lock Restore
Puts your picture's own pixels back in every part the edit did not change,
and takes out the faint pink tint some edit models add to the whole picture.
**Edit Lock 🆎** keeps the untouched parts in place while the picture is
made. They still pass through the VAE, which softens fine detail a little.
This node swaps your original pixels in for those parts, so they match
your picture pixel for pixel. Only the edit is new.
## Quick start
1. Add it right after the VAE Decode, before any upscaler.
2. Wire the decoded picture into `image`.
3. Wire the `edit_lock` output of Edit Lock 🆎 into `edit_lock`.
4. Wire `report` into **Show Text 🆎** to read what was kept.
## Controls
- **image**: the edited picture, straight from the VAE Decode.
- **edit_lock**: from Edit Lock 🆎. It carries your original picture and
the map of what the edit changed, so there is nothing else to wire.
- **Feather** (`feather`): how softly your original fades into the edit,
in pixels. 16 is the default. The fade lies outside the edit, so the
edit itself is never mixed with the old picture.
- **Remove tint** (`remove_tint`): on by default. MiniMax H3 Image makes
every edit a little pinker and lighter all over. This reads that tint
from the part of the picture the edit left alone and takes it out of the
whole picture, the edit included. It matters most when Edit Lock stepped
aside, such as for a new hair color, a new background or rain, because
then nothing else removes it. Edits meant to recolor everything (golden
hour, red light, a new art style) are left alone. Turn it off if a color
change you asked for comes out weaker.
## Outputs
- **image**: the edit, with your original pixels in the untouched parts.
- **edit_mask**: white where the edit changed the picture. Use it to see
what the lock decided, or for a later step that should only touch the
edit.
- **report**: one line, such as "Edit Lock kept 82% of your picture as it
was and left 18% to the edit". When the tint was taken out it adds a
sentence that says so.
## When nothing was locked
Your original pixels are not pasted back, the mask is all white, and the
report says why: the edit changed the whole picture, the lock was off, or
the picture and the result were different sizes. Remove tint still works
here, so the picture can come out with the tint taken out.
## Technical details
The map of what changed is made while sampling, on the latent grid. Here
it is enlarged to the picture's size, widened by the feather and blurred
by the same amount, and used to blend the decoded picture with your
original. If the decoded picture is not the size of your original (after
an upscale), the original is resized to fit first, which costs it some
sharpness. That is why this node goes before an upscaler.
**Remove tint.** The edit is lined up with your original (edits often come
back about one percent larger or a little shifted), both are averaged
into coarse cells of about 8 px at 1 megapixel, and their difference is
taken in Lab color. The tint is the even shift most cells share: it starts
at the median and keeps only cells within 4 Lab units of it, five times
over, so a new background or new hair drops out of the count. It is taken
out only when it looks like the model's own tint: a between +0.5 and +10,
b between -8 and 0, L between -1 and +6, read on at least 15% of the
picture. On 21 test edits at 16 megapixels it took out the tint on the 5
it should (a +2.6 to +6.5 down to +0.4 or less) and left the other 16
alone, golden hour, red light and an anime restyle included. It cannot
tell this tint from an edit that asks for a slightly pinker, lighter look
over the whole picture; turn it off for one of those.
-171
View File
@@ -1,171 +0,0 @@
# Film Grain
Adds film grain to a picture or a video. Use it at the end of a workflow to
give a clean render the texture of a photo shot on film, or to make a fake
look less smooth and plastic.
The grain is strongest in the midtones and gentler in deep shadows and bright
highlights, the way it is on film. On a video it moves from frame to frame
like real film grain, or stays put if you want a still texture. An optional
mask puts grain only where it is white.
The panel under the card shows the result once the node has run (the first
frame for a video). The small **preview** switch at the right of the bar
turns it off, which also skips writing the preview file.
## Auto
Switch **Auto** on and the node picks the grain for the picture. The grain
looks the same on a small picture and on a big one, and it matches the grain
the picture already has. A clean render, with no grain of its own, starts at
the normal amount of `0.25`.
With Auto on, **Amount** and **Size** become multipliers. `1 ×` is Auto's
pick, `1.5 ×` is half as much again, `2 ×` is twice as big. The small number
beside each box is what you get ("= 0.27", "= 1.0 px"). It shows once the
node knows the picture: right away from a Load Image, or after one run when
the picture comes from another node. Until then it shows a dash.
Auto on and Auto off each keep their own numbers, so switching back loses
nothing. Auto starts off, so workflows saved before it behave as they did.
## Copy the grain of another picture
Wire a picture whose grain you like into **grain_from** and switch Auto on.
Its switch now reads **match**: the node reads how strong, how big and how
colourful that picture's grain is, and adds grain like it. A film scan, a
still from a film or a photo you like all work.
- **Amount**, **Size** and **Color** count from the match, the same way as
Auto's pick: `1 ×` is the match, and the small number beside each box is
what you get. **Roughness** stays yours; the match does not read it.
- Grain is matched at the same viewing size. The picture to copy from is
scaled to your picture's size first, so grain from a big photo comes out
finer on a small picture, as it would look side by side on screen.
- Only the plainest patches are read: a sky, a wall, skin. A picture that is
all busy texture (gravel, leaves, a tiled floor) reads stronger grain than
it has; turn **Amount** down, or copy from a plainer picture.
- Grain your picture already has counts. A grainy picture gets only the
grain it is missing, and a reference with less grain than yours adds none.
- The match is worked out when the node runs. Until the first run the
numbers show a dash and the picture asks for a run; after it, the live
preview uses the match while you drag. A video is read from its first
frame, and so is a video wired in to copy from.
- The node remembers the match for each pair of pictures it ran, and saves
it with the workflow. A reopened workflow shows it at once, and so does a
run ComfyUI skips because nothing changed.
- Without a picture on grain_from, Auto picks the grain as above. Auto off
ignores grain_from.
## Live preview
Once the node has a picture, the picture on the node redraws while you drag a
value, before you queue anything. Run the graph once to give the node its
picture (an image connected is enough once it has run; a Load Image shows at once); after that it changes as you drag. A small "not run yet" tag
shows while the picture is a preview and not a real result.
The **Fit | 100%** switch sits on the bar above the picture, left of Preview.
Fit shows the whole picture. 100% shows real pixels, and dragging on the
picture moves around it instead of moving the node. At 100% you see the grain at the size it will have in the saved picture.
## Controls
- **Auto** (`auto`): off uses the Amount and Size you set. On, the node
picks them for the picture, or reads **match** and copies the grain of the
picture on grain_from.
- **Amount** (`amount`): how strong the grain is. `0` adds none, `0.25` is a
clearly visible film look, `1` is very heavy.
- **Size** (`size`): how big each grain is, in pixels of this picture. `1` is
fine 35 mm grain on a picture of about 1 megapixel. Raise it on a big
picture, or for a coarse, fast-film look. Below `1` the grain is smaller
than a pixel, so it also gets quieter.
- **Roughness** (`roughness`): `0` is soft, even grain. Higher mixes in finer
grain that bunches up in some places and thins out in others, like real
film.
- **Color** while matching (`auto_color`): a multiplier of the matched
colour. `0` turns the copied grain black-and-white.
- **Color** (`color`): `0` is black-and-white grain, the same in red, green
and blue. Higher gives each colour its own grain, like the dye clouds of
colour film. A little (`0.2` to `0.4`) looks most natural on colour
pictures.
- **Video grain** (`moving`): **moving** gives every frame of a video new
grain, so it moves like film. **still** puts the same grain on every
frame, which looks like a texture on the lens. A single picture looks the
same either way.
### Behind **More**
- **Seed** (`seed`): picks the grain pattern. The same seed always gives
the same grain, so a re-run gives the same picture. Change it for another
pattern.
### Inputs and output
- **image**: the picture or video frames.
- **grain_from** (optional): a picture whose grain to copy while Auto is
on. It can be any size and shape.
- **mask** (optional): grain goes only where the mask is white, and fades
in with a soft mask. One mask can cover every frame, or give one per
frame. A mask of another size is stretched to the picture.
- **image** (output): the picture or frames with grain, at the same size. A
picture with a transparent background keeps its transparency.
## Technical details
- Auto's size is `1` pixel at 1 megapixel and follows the square root of the
picture's megapixels, so a 4 MP picture gets `2` px (kept between 0.5 and
16 px). Its amount is `0.25` plus the picture's own grain divided by
`0.15`, kept between `0.05` and `1`.
- The picture's own grain is measured in its flat areas: a Laplacian-
difference filter (Immerkaer, 1996) removes shapes and leaves fine noise,
and the median of what is left, read from a histogram, gives the noise as
one standard deviation. Edges and texture are a small part of a picture, so
the median ignores them. Below `0.0015` (what 8-bit rounding alone
measures) counts as no grain. A clip is measured on up to four frames.
The browser measures a Load Image's picture with the same filter, so the
note beside the boxes agrees with the node's result.
- `auto_amount` and `auto_size` are separate inputs from `amount` and
`size`, which is why each mode keeps its own numbers.
- The grain match (`nodes/_grain_match_helpers.py`) scales the picture to
copy from to the target's megapixels, its shape kept, and reads both
pictures' first frames. Each is shrunk by 1 to 12 times; at each size the
fine detail (mean absolute Laplacian, as a standard deviation) of the
plainest fifth of the mid-tone 16 px blocks gives the brightness grain, and
the same blocks of two colour-difference channels give the colour grain.
The target's own grain at each size is taken off (in quadrature). How the
grain falls off over the sizes is fitted, in log space, to a stored table
of Film Grain's own grain at sizes 1 to 16 px and colours 0 to 1
(`nodes/_grain_match_table.py`), with a mild pull toward size 1; grain
smaller than a pixel reads as size 1 and a lower amount, which looks the
same. The colour comes from the colour grain against the brightness grain,
and the amount is checked twice by adding the grain to the target and
correcting it. On Film Grain's own grain the match reads back its settings
(0.40 / 2.0 px / 0.3 reads 0.41 / 2.0 px / 0.3); a 1 MP pair takes about
a third of a second on the CPU.
- Grain is random noise drawn on a grid `size` pixels apart and smoothed up
to the picture with a bicubic filter, then scaled back to the same
strength. Below 1 pixel it is drawn finer and averaged down to the
picture, so its strength falls with its size.
- Roughness adds a second layer at half the size whose strength is varied by
a slow noise four grains wide, mixed so the total strength stays the same.
Extreme values are rounded off softly at three standard deviations, so no
lone white or black speck appears.
- At **Amount** `1` one standard deviation of the grain is `0.15` (on a
`0` to `1` scale) at mid grey, falling to a fifth of that at black and
white. The weight follows the picture's own brightness, `4 L (1 - L)`.
- Every frame's grain has its own seed, worked out from the node's seed and
the frame number, so a frame's grain does not depend on how long the clip
is. Frames are worked on eight at a time: 81 frames at 1920 x 1080 take
about 12 seconds on a desktop CPU, with only a few frames' worth of extra
memory.
### Live preview
The preview runs the node's own maths in the browser: on a copy shrunk to the
size it is shown at in Fit, and on a real-pixel crop of the picture in 100%.
It is checked against the Python node on recorded values (`tests/test_live_parity.py`);
results agree to within 5e-5 on a 0 to 1 scale. The picture is the one the
last run kept, or a Load Image read through ComfyUI's own view route. When
the values match the last run, the real result is drawn instead.
-69
View File
@@ -1,69 +0,0 @@
# FlashVSR Upscale
Makes a video larger and sharper. Give it the frames of a clip, set how much
larger, and it returns the same clip with more detail. Use it as the last
step before Save Video, for a generated clip or one you loaded.
It needs one model file and no other pack.
## The model file
Download `flashvsr_v1.1_fp16.safetensors` (3.5 GB) from
[ausboss/FlashVSR-v1.1-ComfyUI](https://huggingface.co/ausboss/FlashVSR-v1.1-ComfyUI)
and put it in `ComfyUI/models/diffusion_models`. Then refresh the page, or
press `R`, and pick it under **Model**.
The file holds the official FlashVSR v1.1 weights in one piece. Another
FlashVSR file will not load here: the node stops and says which part is
missing.
## Controls
- **frames**: The clip, as a batch of frames. Load Video's frames output
goes here.
- **Model** (`model`): The model file above. The list shows the files in
`diffusion_models` that have FlashVSR in their name.
- **Scale** (`scale`, starts at `2`): How many times larger each side gets,
from 1 to 4. At `1` the clip keeps its size and is only sharpened.
- **Keep colors** (`color_match`, starts on): Brings each frame's colours
back to those of your clip. Leave it on unless you want the model's own
colours.
- **vae** (optional): Connect the Wan 2.1 VAE for a slower, finer finish.
With nothing connected, the fast decoder inside the model file makes the
picture.
## Outputs
- **frames**: The larger frames, as many as went in, in the same order.
The frame rate and the sound are not touched, so wire those from Load
Video to Save Video as before.
## What to expect
FlashVSR redraws fine detail: skin, hair, cloth and edges come back
sharper than the clip had them. It keeps the scene, the motion and the
timing.
A long clip needs no more graphics memory than a short one. The node reads
the clip a few frames at a time and keeps only the last few in memory.
## Technical details
- **Size.** The result is exactly your size times **Scale**, rounded to
even numbers. Inside, the model works at a multiple of 128 pixels each
way; the node pads the picture for that and cuts the padding off again,
so nothing of your picture is cropped.
- **Graphics memory.** About 10 GB for a 576 x 1024 result. A result too
large for the free memory is made in overlapping tiles and blended, and
the tile size is chosen from the memory that is free when the node runs.
1152 x 2048 ran in two tiles at about 16 GB. On an 8 GB card (RTX 3070
Laptop) the same result ran in smaller tiles at about 6.5 GB, at about 3
seconds a frame.
- **Speed.** On an RTX 5090: about 7 frames a second for a 576 x 1024
result and about 2 frames a second for 1152 x 2048.
- **One step.** The model runs once per group of frames. There are no
steps, sampler, prompt or seed to set.
- **The model.** FlashVSR v1.1 by Junhao Zhuang and the OpenImagingLab
team, released under Apache-2.0. It is built on the Wan 2.1 1.3B video
model. This node is the pack's own code in plain PyTorch.
- The node makes no network requests and writes no files.
+8 -44
View File
@@ -24,16 +24,12 @@ frame are copied untouched, and only the true in-betweens are synthesized.
## Scene cuts
Making in-betweens across a hard cut mixes two shots into each other for a
frame or two. The node finds each cut and holds the last frame before it
instead.
A cut is a change between two frames that jumps out from the frames around
it. That works even when both shots show the same place in the same light,
where the change at a cut can be smaller than fast movement inside one
shot. Any change above **Scene cut** (`scene_cut_threshold`) also counts as
a cut, as it always has. Set it to `0` to turn cut finding off and make
in-betweens everywhere.
Interpolating across a hard cut produces morph artifacts: two unrelated
shots smeared into each other for a frame or two. When the mean absolute
difference between adjacent source frames rises above **Scene cut**
(`scene_cut_threshold`), the node treats that pair as a cut and holds the
last frame before it instead of morphing. Set the threshold to `0` to
disable detection and interpolate everything.
## Controls
@@ -44,10 +40,8 @@ in-betweens everywhere.
source rate passes the batch through unchanged. A new node starts at
24 → 30.
- **Method** (`method`): `blend` or **optical flow (RAFT)**, as described above.
- **Scene cut** (`scene_cut_threshold`): A change above this always counts
as a cut; `0.35` suits most footage, and `0` turns cut finding off. Cuts
that jump out from the frames around them are found at any setting above
`0`.
- **Scene cut** (`scene_cut_threshold`): Cut sensitivity from 0 to 1; `0.35`
suits most footage, `0` disables.
- **Batch** (`batch_size`, starts at `8`): In-between frames computed per batch. Higher is
faster but uses more VRAM; results land in system memory as each batch
finishes.
@@ -61,33 +55,3 @@ in-betweens everywhere.
Neither method performs network requests or writes files. The optical-flow
method reads an existing checkpoint from the local torch hub cache.
## Technical details
### How cuts are found
The node makes a small copy of every frame, 64 px on its long side. Each
4 px block of a frame looks for its best match in the frame before it,
moved up to 3 px each way. Movement inside a shot finds its match, so what
is left is small; after a cut the picture is new and the change stays
large, even with the same colors on both sides.
That leftover change is compared with the median of the 4 frame pairs on
each side. A pair is a cut when it is at least 3 times that median and
above 0.02 (on a 0 to 1 scale), so grain in a still shot never counts.
Repeated frames, as in footage drawn on twos or threes, are left out of the
median. A pair is also a cut when its plain mean difference over the full
frame is above **Scene cut**, the rule earlier versions used on its own, so
no cut those versions found is lost.
Measured on seven MiniMax H3 clips with 29 cuts, among them a rooftop clip
whose three cuts scored 0.14 to 0.17 on the plain difference and a street
clip that moved 0.15 inside one shot: every cut stood out at least 4.1
times from its neighbours, and movement inside a shot at most 1.9 times.
All 29 were held and nothing inside a shot was. The plain rule alone,
at `0.35`, held 2 of them.
A cut straight into very fast movement, more than about a twentieth of the
frame from one frame to the next, can stand out less from the shot after
it. A clip of two frames has nothing to compare with; there only the
plain rule applies.
+20 -163
View File
@@ -7,28 +7,6 @@ Use it with MiniMax H3 or Pika H3 Flex. Connect up to four pictures and give eac
one a job. Copy the moves from a video, keep a clip going, or add a voice or a
song.
## Sockets appear as you use them
The node shows only the sockets you are using, so its face stays small.
- A new node has one picture socket. Connect a picture and the next one
appears, up to four.
- **video_sound** appears once a video is connected.
- An output appears once its input is connected: connect two pictures and
two picture outputs show. **song_under** needs a voice and a song, and
**keeps_clip_sound** a video. **prompt**, **frames**, **width** and
**height** are always there.
- A socket with a wire on it always shows.
- The picture chips under the words work the same way: a chip shows for each
picture or video you plugged in. If its loader is turned off, the chip
turns faint and says **off**.
Nothing changes in a workflow you already saved: every wire stays where it
was and the node sends the same things. To see every socket and chip all the
time, pick **all** under **Sockets** in the gear menu (the gear at the top
right of the node), or turn on **Settings → 🆎 AusBoss → H3 Prompt Writer →
Show every socket**. Both are the same setting.
## How to write it
Every line is a moment, and the lines play in order in one shot. The bar under
@@ -45,11 +23,10 @@ the box shows the second each one starts, before you spend a run.
That is two shots in two places. `@1` is Picture 1. With one person you can
write `She` or `He` instead.
Your words go into the prompt as you typed them. To hear something at a
moment, say it in that line: `Thunder cracks overhead.` For a sound under the
whole clip, add a `sound:` line, such as `sound: rain on the windows`. When
something should stay the way it changed, say so in the later lines too:
`The lights are still off.`
The node also fills in two things H3 misses by itself. A moment gets its own
sound when it names something that makes one, like rain, footsteps or thunder.
And what changes stays changed: when the lights go out, the next moments in that
place say they are still out.
## The words box and the bar
@@ -107,59 +84,19 @@ from.
Connect a video, then pick what it is for:
- **copy its moves**: someone does the moves in the video. With a picture of
your person, your person does them. Say where in your lines:
`@1 dances on a rooftop at sunset.` With no person picture, the person in
the video keeps their own moves and goes somewhere new: give a picture the
job **place** and type `He dances in @1.` The clothes can come from words or
from an outfit picture. It doesn't have to be a person: give a cartoon hand,
a toy or a mascot the job **thing** and type `@1 waves.` It does the moves in
its own look, and nothing of the video's subject is kept.
- **copy its moves**: your person does the moves in the video. It needs a
picture of your person. Say where in your lines:
`@1 dances on a rooftop at sunset.` The clothes can come from words or from an
outfit picture.
- **swap the person**: your person takes over from the one in the video. The
place, the moves and the camera stay. With two person pictures, the first
replaces the person on the left and the second replaces the person on the
right. To choose who goes, type one line per picture, for example
`@1 replaces the man in the hat`. Put spoken words in quotes and name
the speaker. If a voice comes from off screen, say so in the line.
A line like `@1 dances.` is not read as who goes; only a description such
as `the man in the hat` is. With two people, name who speaks.
- **change something**: keep the video and describe the change, for example
`She wears a red raincoat`. Be specific about what should change. To change
the whole look, connect a picture with the job **style** (or **place**, for
the same room looking different) and type `It looks like @1.` A clip with
nobody in it, such as an empty hallway, stays empty.
place, the moves and the camera stay. You can leave the box empty.
- **keep going**: more of the same clip, from where it ends. Say what happens
next, or leave the box empty and it just carries on. Connect the whole clip:
the node sends H3 only the last 2 seconds.
- **new voice**: the same clip with a new voice. Connect the voice, and type
what they say in quotes.
This keeps the person in the clip, so a person picture is not allowed here;
use **swap the person** to change who is in it.
If your swap keeps the video's audio, connect it to **video_sound** (it shows
once a video is connected) and turn on
**More → Clip's own sound**. The writer uses the clip to estimate when each
line is spoken and keeps only the incoming people's words in the swap prompt.
Type a time such as `3.2s:` to set it yourself. This switch starts off.
With an active video, **copy its moves**, **swap the person**, **change
something** and **new voice** use the incoming clip to set the frame count. **Length** says **From the clip**;
set the clip's length upstream. The bar does not show a guessed duration or offer
retiming controls for these jobs. H3 rounds the frame count to a supported length.
Other video jobs, or turning the video off, use the editable **Length** again.
For a swap, you can optionally describe the replacement on its own line:
```
the woman with black hair walking toward the camera
@1 looks like a woman with blonde hair and a black hoodie.
```
The first line chooses who goes; the `@1 looks like` line describes the connected
replacement person in Picture 1. Use the number of that picture, with its job set
to **person** or **character sheet**. This helps describe the intended appearance;
it does not guarantee an exact identity match. The line is optional: existing
workflows and scripts keep their previous behavior when it is absent.
Swap and new voice ignore **Length** and keep the video's own length.
## What you can type
@@ -167,17 +104,11 @@ workflows and scripts keep their previous behavior when it is absent.
- **A cut in the same place**: start the line with a kind of shot, like
`a close-up of her hand`. Any other line after a blank line goes to a new
place.
- **A cut back**: `Cut back to the hallway.` returns to a place you have
already shown.
- **One long take**: type `no cuts` and blank lines stop being cuts.
- **An ending**: start a line with `ends on`, wherever it sits:
`ends on her sitting by the window`.
- **Speech**: put the words in quotes: `She says "we are late."` With two or
more people, your sentence goes to H3 as you typed it, so write it the way
you would tell a person: `@1 listens as @2 says "we are late."`
- **Talking over a cut**: end the words with `...` and the line keeps going
into the next shot, said once. On the last line, `...` means the clip ends
mid-sentence.
- **Speech**: put the words in quotes: `@1 says "we are late."` Each person
keeps their own voice.
- **Words on a sign**: name the sign: `a neon sign reads "OPEN"`.
- **Sound and music**: use the **Sound** and **Music** boxes, or type
`sound: rain on a tin roof` and `music: slow sad piano`. With no music you get
@@ -191,35 +122,20 @@ own, with blank lines around it, it is for the whole clip.
Already wrote H3's six parts yourself? Paste them in and they go through as
they are.
## See and change the full prompt
The **Full prompt** tab at the top of the node shows the prompt the node wrote
on its last run. To change one thing, such as taking out "A slow push in.",
edit it there and run again: H3 gets your text exactly as it is in the box. An
amber dot on the tab shows that an edit is being sent. **Reset to written**
throws the edit away and goes back to what the **Simple** tab writes.
While an edit is in place, changes on the Simple tab do nothing, because your
text is sent instead.
## What you can plug in
- **picture_1** to **picture_4**: your pictures.
- **video** and **video_sound**: the frames and the sound of a video. **keep
going** sends the last part of the sound to H3. A swap uses the sound to find
speech timing when **Clip's own sound** is on. To keep source audio in a swap
or **change something**, route the original loader's audio to the save node.
- **video** and **video_sound**: the frames and the sound of a video. Only keep
going uses the sound.
- **voice**: a clip of someone talking, about 10 seconds, plus words in quotes
in your script. It goes to whoever speaks first. With two or more people,
put the speaker right before the words: `@2 says "hello."` It works with your own voice,
in your script. It goes to whoever speaks first. It works with your own voice,
or one you have permission to use. Put the spoken line last: with time left
after it, H3 tends to keep talking.
- **song**: your music. It is cut to the length of the clip and plays as it is,
and each moment moves onto its beat.
- **clip**: a small text model such as Qwen3-VL 8B. Type one line and it adds
what happens next, and it names the sound of the place. Your line always stays
first. Turn on **More → Tidy up my lines** and it also cleans up what you
typed before the node reads it (see the controls below).
first.
A voice and a song work together. H3 can't keep a song while someone speaks, so
the node keeps the song out of H3's way and hands it on as **song_under**, turned
@@ -234,12 +150,6 @@ H3's width and height: the clip takes the shape of your video, or else of your
first picture. **song_under** goes into `audio2` of Audio Merge, with the clip's
sound in `audio1`.
**keeps_clip_sound** is on when a video is connected and **Clip's own sound** is
on, or the video job is **change something**. Use it to select the source audio
for the finished clip. It is the last output; the existing outputs keep their
positions. Keeping source audio still needs the workflow to pass that audio to
its save node.
Nothing plugged in means nothing is added. So a page can turn each one on and off
with [Workflow Switches](#AUSBOSS_NODES_WorkflowSwitches): a bypassed loader reads
as not plugged in.
@@ -249,47 +159,19 @@ as not plugged in.
- **Sound** (`sound`): what the clip sounds like, for the whole clip. Same as a
`sound:` line.
- **Music** (`music`): the music for the whole clip. Same as a `music:` line.
- **Length** (`seconds`): how long the clip is, 4 to 15.
- **Camera** (`camera`): how the camera moves the whole way through. The first
choice adds no camera words. With a video wired it reads **from the video**:
the camera does what it does in the video. Pick a move only to change it.
- **Length** (`seconds`): how long the clip is, 5 to 15.
- **Camera** (`camera`): how the camera moves the whole way through.
- **Look** (`look`): from the picture keeps your photo's look. The others redraw
the clip. Clay and 3D don't work from words, so change your picture first with
an edit model.
- **Picture 1** to **Picture 4** (`job_1` to `job_4`): what each picture is
for, on the picture chips under the bar. A chip shows once its picture is plugged in.
for, on the picture chips under the bar. An empty slot shows as a faint `+ @3`.
- **Video** (`video_job`): what the video is for, on the video chip.
- **Song starts at** (`song_start`, under **More**): the second of the song to
start from, so the clip gets the good part.
- **Moments on the beat** (`cut_on_beat`, under **More**): moves each moment onto
the nearest beat of the song. Off keeps your own seconds.
- **Language** (`language`, under **More**): the language of the words in quotes.
- **Tidy up my lines** (`tidy`, under **More**): the model on **clip** rewrites
your lines first. It fixes spelling, breaks long lines into short sentences,
and puts each spoken line right after whoever says it, so
`@1 stares at @2 who goes "No way."` becomes `@1 stares at @2. @2 says "No way."`
Your words in quotes are never rewritten: they are held out while it tidies
and come back exactly as typed. Each line is tidied on its own, so blank
lines and timed lines stay where you put them, and `camera:`, `sound:` and
`music:` lines are left alone. If a tidied line would change who says what,
that line is used as typed. A one-line idea is left as it is, for the model to fill out. With nothing on
**clip** it does nothing, so a workflow can leave it on. Starts off.
- **Full prompt** (`full_prompt`, on the Full prompt tab): your own edit of the
finished prompt. Empty means the node's own prompt is sent.
- **What the model is asked** (`model_asks`, in the gear menu): the four things
the model on **clip** is asked, each with an **Edit** button. **Describe a new
person** writes how a new person in a swap looks from their picture. **Fill in
the next moments** writes what happens after a single typed line. **Hear the
place** writes the steady sound of the place. **Tidy up my lines** holds the
instructions for Tidy up. Change the words to steer the model; `{seconds}`,
`{first}`, `{count}` and `{lines}` are filled in by the node. Your wording is
saved in this node, so a shared workflow asks the same. **Back to built-in**
puts the node's own wording back. They only matter with a text model plugged
into **clip**. If your wording loses `{lines}` or another filled-in name,
**Save** first says what the model will miss; press it again to keep it.
**Esc** over typing you have not saved asks once before it closes.
**Reset** at the bottom of the menu puts the sockets and all four wordings
back at once; Ctrl+Z brings yours back.
## Tips
@@ -311,7 +193,7 @@ as not plugged in.
| --- | --- | --- | --- |
| `script` | input | STRING | What happens, one line for each moment. |
| `seconds` | input | INT | How long the clip is. |
| `clip` | input, optional | CLIP | A small text model that fills in a one-line idea, and tidies your lines when Tidy up is on. |
| `clip` | input, optional | CLIP | A small text model that fills in a one-line idea. |
| `picture_1` to `picture_4` | input, optional | IMAGE | Your pictures. |
| `video` | input, optional | IMAGE | The frames of a video. |
| `video_sound` | input, optional | AUDIO | The video's own sound. |
@@ -326,7 +208,6 @@ as not plugged in.
| `song_under` | output | AUDIO | With a voice and a song, the song to mix under the finished clip. |
| `frames` | output | INT | The clip's length in frames. |
| `width`, `height` | output | INT | The shape of your video, or else of your first picture. |
| `keeps_clip_sound` | output | BOOLEAN | Whether the finished clip should use the video's own sound. |
## Technical details
@@ -346,29 +227,5 @@ that sentence the picture's street came back halfway through on 2 of 2. With no
place in your lines H3 has nothing else to use, so it stayed in the picture's
place on 2 of 2.
Tidy up sends the model one call per typed line, with its own instructions, no
picture, and no randomness, so the same lines tidy the same way every run. Blank
lines, `camera:`/`sound:`/`music:`/`look:` lines and the order of lines never pass
through the model. Each quote is swapped for a marker (`SPOKEN`, or `SPOKEN1`,
`SPOKEN2`) before anything else touches the line, so the model never sees the
quoted words. A line's answer is used only when it is one line, every marker comes
back once, the same `@` numbers are in it, it is not much longer than what you
typed, each typed `@N says "..."` keeps the same person, a quote on a sign or a
shirt stays on it, and the writer reads the whole script the same way with the
tidied line in it: the same words said in the same order, shot and second, and the
same cuts and timed seconds.
Any other line is used as typed. If the writer still turns the tidied lines down,
it uses your lines as typed. On Qwen3-VL 8B the instructions put the right speaker
before the words on 38 of 38 lines they were not written for, took about 0.3
seconds a call once the model was loaded, and passed every check on 77 of 79
lines. What it still changes: "as" and "while" can become two sentences, and a
leading `Voiceover:` label is left as typed.
The Full prompt tab is filled from the node's run, so it shows nothing until
the workflow has run once. The node still writes its own prompt on every run, a
model on `clip` included, so the tab can show it next to your edit and Reset can
go back to it. The last written prompt is kept with the node in a saved
workflow.
H3's own rewriter runs only on paid services, and the open model reads a prompt as
it is. This node does that job on your machine, with no model needed.
+32 -41
View File
@@ -10,7 +10,7 @@ original back over the result.
## Quick start
1. Choose a file above the preview, or click **Load**. Dropping a
1. Pick a picture under **Image source**, or click **Upload**. Dropping a
picture onto the node works too.
2. Drag the handles on the picture. Cyan squares crop. Orange diamonds add space
on one side. Orange corners make the whole canvas bigger or smaller. The
@@ -24,38 +24,26 @@ pan. **Save & close** keeps your edits. **Cancel** or Escape puts everything
back, and asks first if anything changed. You do not need the editor: a run
uses what the node shows.
Right-click the picture and choose **Copy image** to copy the original picture,
without added padding, rotation, crop, resize, handles or guides. To include
your edits, open the gear and turn on **Copy with crop, rotation and padding**.
That also includes resize, and is remembered for this browser. **Open image**
follows the same choice. This works on the node and in the editor.
Direct copying needs localhost or HTTPS. On a plain HTTP address, choose
**Open image**, then right-click that
picture and use the browser's **Copy image**.
## On the node
From top to bottom:
- **File picker**: choose **Inputs** for uploaded pictures or **Outputs** for renders, newest first. The list shows the
picture under the pointer and filters as you type. **Load** adds one. A
- **Image source**: the pictures in ComfyUI's input folder. The list shows the
picture under the pointer and filters as you type. **Upload** adds one. A
picture ComfyUI made, named like `photo.png [output]`, loads too, as it does
in core Load Image. The gear holds the node's display options.
- **The picture**, with its handles.
- **The size line**: each step that sets the output size, ending with the size
the run gives you.
- **Crop, pad & resize**: a collapsible group (closed to start, with the fill
swatch and a short summary on its bar) holding:
- **Aspect ratio** and **Fit to ratio** (Crop or Pad), above the orientation button, the ratios (1:1, 4:3, 3:2, 16:9,
21:9) and the padlock.
- **Align** and the two **Center** buttons.
- **Fill** and **Feather**.
- **Resize**, with **Megapixels** and **Step** alongside it when Resize is on.
- **The ratio row**: the orientation button, the ratios (1:1, 4:3, 3:2, 16:9,
21:9) and the padlock.
- **Fit** (crop | pad) and **Divisible by**.
- **Fill**, **Feather**, **Resize** and the two **Center** buttons.
- **Open editor**, **Reset crop** and **Reset**.
Crop and padding have no number boxes. You set them by dragging, and the size
line shows the result. Picking another picture starts the framing over
(rotation, crop and padding); Fill, Feather, Align, Resize and a lit
(rotation, crop and padding); Fill, Feather, Divisible by, Resize and a lit
ratio stay.
### Ratios, Fit and the padlock
@@ -63,7 +51,8 @@ ratio stay.
Tap a ratio under the picture to pad the picture to it: every pixel stays and
fill bands are added around it, centred. Set **Fit** to crop and the ratio trims
the picture instead. Tap the lit ratio again to go back to the whole picture.
You can set **Fit to ratio** before picking a ratio. If a ratio is already lit, switching between Crop and Pad applies it immediately.
**Fit** only acts on a lit ratio, so it is dimmed and says "pick a ratio first"
until you tap one.
- **A lit ratio is the shape the canvas has now.** Drag a handle to another
shape and the ratio goes dark; the row says **Custom** and the size line under
@@ -96,11 +85,11 @@ sides at once, so the picture keeps its place in the middle. You can press or le
go of Alt during the drag. A corner stops when one of its two sides has no padding
left to take away.
**Center** moves the crop to the middle of the rotated source, side to side or
top to bottom. If there is padding on that axis, the same click also balances
the bands around the crop. The crop and output keep their sizes, and the
generated mask follows the new placement. Each button dims when its axis is
as centered as the pixels allow.
The two **Center** buttons next to Fill, Feather and Resize put the picture in
the middle of the canvas: one side to side, one top to bottom. They move padding from
one side to the other, so the canvas keeps its size and a lit ratio stays lit. A
button is dimmed when the picture is already in the middle or that way has no
padding to move. On a narrow node they sit on a line of their own.
The orange diamonds move one side at a time, and the padlock works on them as
described above. The corners keep the shape with or without the padlock. The
@@ -123,9 +112,9 @@ green rotate knob moves aside when a corner handle sits where it usually goes.
**Method** (`resize_method`) is in the editor, under **Resize output**.
The edge between your picture and the fill stays one clean line at any size.
### Align
### Divisible by
**Align** (`canvas_multiple`) makes the width and height divide evenly by
**Divisible by** (`canvas_multiple`) makes the width and height divide evenly by
the number you pick. Some models need sizes divisible by 8, 16 or 32. At 1 it is
off. Its arrows go 1, 8, 16, 24 and so on; hold Shift to step by 1.
@@ -141,23 +130,24 @@ or bottom.
The line under the picture names every step that sets the output size, in the
order the run applies them, with the size the run emits last and brightest:
`crop 2080×1170 → pad 2208×1298 → round to 64 2240×1344 → resize 1344×768`. A step
that changes nothing is left out, and "round to" is **Align** at work. An
that changes nothing is left out, and "round to" is **Divisible by** at work. An
amber line warns when rounding each side to the Step stretches the picture by
more than 1% (`Resize makes the picture 1.5% taller`); its tooltip names a
Step that avoids it, and with Fit on pad, **Pad to keep shape** adds a few pixels of
padding so nothing stretches. It also warns when the resize undoes **Align**. Hover the line for the same breakdown line by line; the editor's right
more than 1% (`1.5% taller: each side rounds to 32 px`); its tooltip names a
Step that avoids it, and with Fit on pad, **Even out** adds a few pixels of
padding so nothing stretches. It also warns when the resize undoes **Divisible
by**. Hover the line for the same breakdown line by line; the editor's right
panel shows it too.
The amber line keeps still while you drag a handle or a number. If the drag
makes it untrue it goes away, and the line for the new size comes back a
moment after you let go. The space for the warning stays under the dimensions. On a narrow node, hover
over shortened text to read it in full.
moment after you let go. With Resize on its row is always on the node, with
text or empty, so the controls under it stay where they are.
### Reset crop and Reset
**Reset crop** shows the whole picture again without changing rotation or
padding. **Reset** clears rotation, crop and padding and turns the padlock off;
Fill, Feather and **Align** stay.
Fill, Feather and **Divisible by** stay.
## Drawing a mask
@@ -177,7 +167,8 @@ your picture stays under them in **image**, **original** and
the teal.
See-through parts of a PNG show in teal the same way, because the node paints
them too. To hide the teal, click the gear next to **Load** and turn off **Show the mask on the picture**. The choice applies
them too. To hide the teal, click the gear at the top right of the image
source box and turn off **Show the mask on the picture**. The choice applies
to every Image Crop + Rotate + Pad in this browser.
## Outputs
@@ -241,18 +232,18 @@ for fine steps). The editor adds a few things the node does not show:
- **Rotate → Degrees** (`rotation_degrees`): type an exact turn, clockwise.
Each step is 1°, or 0.1° with Shift. **Reset rotation** sets it back to 0.
- **Padding & mask → Reset padding** removes all padding. The same section has
Fill, Feather, Align and a **Center** row.
Fill, Feather, Divisible by and a **Center** row.
- **Resize output → Method** (`resize_method`): how the resize samples the
picture. `lanczos`, the default, is the sharp one.
- **More**: ratios you added in `ausboss_presets.json` that no button shows.
The list only appears when you have some.
- **Reset view** undoes zoom and pan. **Reset transform**
clears rotation, crop, padding, fill, feather and Align; the picture,
clears rotation, crop, padding, fill, feather and Divisible by; the picture,
resize and stitch settings stay.
- **Preview**: a small picture of the finished output while you work.
A ratio replaces the existing crop and padding and keeps rotation, fill and
resize settings. **Align** and the resize **Step** can slightly change
resize settings. **Divisible by** and the resize **Step** can slightly change
the fitted shape. The size box on the stage sits clear of the handles.
### Handles and gestures
@@ -289,8 +280,8 @@ The editor's right side holds the stitcher's settings, the same as on the clip n
- `fill_color`: `#RGB` or `#RRGGBB`, three numbers (`R, G, B`), one gray
number, or a colour name. Anything it cannot read becomes mid-gray.
- **Corners.** A corner follows the pointer along the canvas diagonal, and the
shape it keeps is the canvas before **Align** rounds it. With
Align on, **Center** counts the fill it adds, so the bands you see
shape it keeps is the canvas before **Divisible by** rounds it. With
Divisible by on, **Center** counts the fill it adds, so the bands you see
come out even.
- **Resize.** It works like core's *Scale Image to Total Pixels*: the budget is
`megapixels × 1024 × 1024`, the shape is kept, and each side rounds to a
-76
View File
@@ -1,76 +0,0 @@
# Image Toolbox
Small picture jobs in one node. Pick the job from the **Job** list (`job`);
the rows under it change to what that job needs.
## Jobs
### split sheet at gaps
Cuts a row of pictures that sit side by side, such as the four views of a
character sheet, into separate pictures.
- **Pieces** (`pieces`): how many pictures are on the sheet. 4 for a
four-view character sheet.
Each cut goes to the gap between two pictures, not to an equal share of the
width. An image model rarely puts each view exactly on its quarter of a
sheet, so cutting into equal parts can leave part of a neighbour's sleeve in
one piece and cut another's off. Here every piece holds one picture.
The pieces come out as one batch, from left to right, all the same size.
Narrower pieces are padded with the sheet's backdrop colour. The first and
last pieces keep the sheet's own left and right edges at their outer edge,
so a person drawn up to the edge of the sheet does not look cut off by a
band of padding. Wire the batch into Save Image to save each piece as its
own file.
A batch of sheets is cut sheet by sheet: the first sheet's pieces, then the
next sheet's.
### cut a piece
Cuts one piece out of the picture, at the size and place you set. Use it when
the parts you need are not the same size, or when you know exactly where a
part is.
- **Width** and **Height** (`width`, `height`): the piece's size in pixels.
0 takes the picture's full width or height.
- **Position** (`position`): where the piece sits, from **top left** to
**bottom right**. **center** puts it in the middle.
- **Move right** and **Move down** (`move_right`, `move_down`): move the
piece from that position by this many pixels. Below 0 moves it left or up.
The piece never leaves the picture. A size larger than the picture is cut to
the picture's size, and a move that would push the piece past an edge stops
at that edge.
The piece comes out of **images**. The second output, **rest**, is what is
left of the picture:
- When the piece is as tall as the picture and sits against its left or
right edge, **rest** is the strip beside it. The same goes for a piece as
wide as the picture at the top or bottom. So to split a picture into two
parts of different sizes, set the first part's width, Height 0, and
Position **left**: **images** is the first part and **rest** the second.
- Any other piece leaves a hole, and **rest** is the whole picture with the
hole filled with the picture's backdrop colour.
A batch is cut at the same place in every picture. Other jobs pass the
picture through **rest** unchanged.
## Technical details
- The backdrop colour is the median colour of the picture's border.
- A pixel counts as part of a picture when any channel differs from the
backdrop by more than 0.1 (on a 0-1 scale).
- Each cut looks for the column with the fewest such pixels, up to 40% of
one piece's width either side of the equal-share line, and takes the
middle of the longest run of those columns.
- When two pictures overlap on the sheet, no column is clean. The cut then
goes where the least of them is lost, and a small part of one can remain
in the other's piece.
- cut a piece fills its hole with the same backdrop colour.
- Pieces set to 1 returns the picture unchanged.
- Pieces higher than the picture's width in pixels gives one piece per
pixel column, so fewer pieces than asked for.
-99
View File
@@ -1,99 +0,0 @@
# Keep Detail
Puts the fine detail of your original picture back on an edited version of
it. Use it when an edit, a relight or an upscale made skin, fabric or wood
look too smooth: the edit keeps its shapes, light and colour, and the pores,
weave and grain come from the original.
The two pictures must line up, pixel for pixel. Wire the edit to **image**
and the original to **detail_from**. If an edit drifted (Qwen Image often
draws an edit a little bigger or shifted), run it through Realign to Source
first, or the detail lands in the wrong place and doubles up.
If **detail_from** is a different size from the edit, it is resized to the
edit's size first. That only helps when it is the same picture at another
size; the pictures still have to line up.
The panel under the card shows the result once the node has run. The small
**preview** switch at the right of the bar turns it off.
## Live preview
Once the node has a picture, the picture on the node redraws while you drag a
value, before you queue anything. Run the graph once to give the node its
picture (run once to get the picture); after that it changes as you drag. A small "not run yet" tag
shows while the picture is a preview and not a real result.
The **Fit | 100%** switch sits on the bar above the picture, left of Preview.
Fit shows the whole picture. 100% shows real pixels, and dragging on the
picture moves around it instead of moving the node. Fine detail is easiest to judge at 100%.
## Controls
- **Detail size** (`detail_size`): detail smaller than this many pixels
comes from the original; anything bigger stays the edit's. `2` to `6` suits
skin and fabric. Larger brings back more of the original, until it starts
to bring back the old picture's light and shapes too.
- **Strength** (`strength`): `0` leaves the edit as it is, `1` puts the
original's detail on it in place of the edit's own, above `1` makes the
original's detail stronger.
- **Detail** (`color_detail`): **light only** brings back only how bright
or dark the detail is, so the edit's colours never shift. **color +
light** brings back the detail's colour too, such as freckles, stains or
a coloured weave. Use it when the edit kept the original's colours.
### Behind **More**
- **Edge safe** (`edge_safe`): on by default. Strong edges, such as a
jaw against a bright wall, are left as the edit has them, so no light or
dark rim appears along them. Turn it off when the edit also blurred
strong edges and you want those back from the original as well.
### Inputs and output
- **image**: the edited picture.
- **detail_from**: the original picture, lined up with the edit.
- **mask** (optional): detail goes back only where the mask is white, such
as on skin alone.
- **image** (output): the edit with the original's detail, at the edit's
size.
Both pictures can be videos. One picture on either side goes with every
frame of the other.
## Technical details
- Each picture is split into a base and detail. The base is the picture
smoothed over `detail_size` pixels; the detail is what the smoothing took
away. The result is the edit's base with the original's detail.
- The split is a ratio in linear light, not a difference. Detail is how much
brighter or darker each pixel is than its base, as a factor: pores that
are 8 % darker than the skin around them stay 8 % darker on a darker,
relit face. A difference would carry a bright original's texture too
strong into a dark edit and too weak into a bright one. Linear light is
the picture with the sRGB curve taken off, where light adds up
physically, so a factor means the same in shadows and highlights.
- With **light only** the factor comes from the luminance (Rec. 709 weights)
and multiplies red, green and blue alike, so the colour of every pixel
stays the edit's. With **color + light** each channel has its own factor.
- The base is a Gaussian blur with a radius of `detail_size`, or with
**Edge safe** a guided filter (He, Sun and Tang, 2010) of the picture by
itself over a box of the same spread: it smooths texture but follows a
strong edge, so the detail at that edge stays near nothing. A step that
varies the values around it by more than about `0.15` counts as an edge;
skin, fabric and wood grain vary them less. The smoothing runs on the
sRGB-curved values, where an edge's size matches how strong it looks.
- Strength `s` mixes the two details: the edit's own to the power `1 - s`
(for `s` up to `1`) times the original's to the power `s`. At `0` the
result is the edit, unchanged.
- Frames are worked on four at a time.
### Live preview
The preview runs the node's own maths in the browser: on a copy shrunk to the
size it is shown at in Fit, and on a real-pixel crop of the picture in 100%.
It is checked against the Python node on recorded values (`tests/test_live_parity.py`);
results agree to within 5e-5 on a 0 to 1 scale. The picture is the one the
last run kept, or a Load Image read through ComfyUI's own view route. When
the values match the last run, the real result is drawn instead.
-25
View File
@@ -39,11 +39,6 @@ come back with the new area still gray, like a gray frame or a gray corner.
Pad 🆎 or Load Image + Pad 🆎, or the painted mask of an inpaint. Wire it
for AnyPaint. The reference then shows that area in your picture's own
colour instead of the gray fill, and the model paints it.
- **reference_curve**: How strongly the picture follows the references over
the run, from Strength Curve 🆎. 1 is the normal strength and 0 ignores
them. Hold the layout early and let go late (a fade out), or let the
model find its own shapes first and pull the reference in for the details
(a fade in). Leave it unwired for today's behaviour.
## Outputs
@@ -74,23 +69,3 @@ above 0.5) is refilled with the median colour of everything else before the
reference goes to the VAE and to the vision tower. The canvas the rest of
the graph uses keeps its gray, so the prompt writer and the stitch are
unchanged. Only `reference` is refilled; `extra_image` is left as it is.
## Technical details: the reference curve
The references reach Krea 2 as extra tokens that the prompt and the canvas
attend to. At each step the curve's value `s` is added as `log(s)` to
the attention scores of the reference keys, which multiplies the attention
weight they get by `s` before the weights are shared out again. At 1
nothing changes, at 0 the reference gets no attention at all and the result
is the same as without a reference, and values in between fade it. The
reference's own tokens see the same scale. It works the same with Krea 2
Outpaint Model Patch 🆎, which scales its cached reference keys.
The curve travels on the positive output as a ComfyUI hook, read at each
step by ComfyUI's own hook keyframes (see Strength Curve 🆎 for how "where
in the run" is measured). Two costs come with ComfyUI's hooks: a run with a
hooked prompt turns dynamic VRAM loading off (the first one loads the model
a second time), and at a CFG above 1 the positive and negative are run one
after the other instead of together. While the strength is not 1, attention
also runs with a mask, which some fast attention kernels hand to PyTorch's
own.
@@ -82,7 +82,7 @@ new region can break up; the node says so in the console when it sees it,
and the cure is two passes: pad one axis, run, load the result, pad the
other. **A thin strip counts.** More than 8 px of padding on the other
axis, such as a few pixels left over from a drag, means the source no
longer spans it. **Align** on the Crop + Rotate + Pad nodes and
longer spans it. **Divisible by** on the Crop + Rotate + Pad nodes and
Load Image + Pad's **Multiple** never add a strip on a side you did not
pad. The warning reports the spare pixels on each axis.
+1 -84
View File
@@ -26,60 +26,6 @@ Boxes only shows "Node 2.0 only".
Wire `preview` to a Preview Image to see the boxes with their numbers and words.
## Place people with MiniMax H3 Image
The `h3_prompt` output says the boxes in words for MiniMax H3 Image: who goes
where, what they do there, how big, and who stands beside whom. Use it to put the people from your
reference pictures into a scene, each one where you drew a box.
1. Wire your scene picture into `background` and into the first picture of
the H3 Image node: it is `<Picture 1>`, the picture that is changed.
2. Wire the people's pictures into the next ones: `<Picture 2>`,
`<Picture 3>` and so on.
3. Draw one **object** box for each person. In its **Description**, name
their picture and say what they do there, for example "the man from
`<Picture 2>`, sitting on the couch". That second part is what puts them
in the box: told only where to go, H3 Image keeps people standing as in
their own picture, often outside the box.
4. A box with no description still gets the next picture, `<Picture 2>`, then
`<Picture 3>`, in the order of the boxes, and keeps that person's face,
hair and clothes. It is a rough place only. A description without a
picture is a thing: a dog, a sofa. A **text** box writes its words at its
place.
5. Wire `h3_prompt` to the prompt of the H3 Image node. To add words of your
own, such as the light or the mood, join the two texts first, for example
with ComfyUI's Concatenate Text node.
Without a picture on `background` there is no scene picture, and the people
start at `<Picture 1>`.
The prompt says every place in words, never in numbers: H3 Image draws
numbers from a prompt onto the picture as text. Tried on three rooms and two
seeds: with a description like the one above, the man was in his box 6 times
of 6 and the woman 4 of 6, and the room stayed as it was; with empty boxes,
2 of 12. Keep `preview` out of H3
Image's pictures too, or the boxes' lines can stay in the picture.
## Words for a prompt
Some models make a picture from a prompt alone and have no input for boxes.
The `placement` output says your boxes as plain sentences: what goes in each
box and where it is in the picture. Add it to your prompt, for example with
ComfyUI's Concatenate Text node, and the model puts each thing where you drew
it.
For a text box with the word FRESH in the top left and an orange on the right,
it gives:
> The words "FRESH" in huge bold black sans-serif letters, placed top left,
> from 6% to 52% across and 6% to 25% down. One ripe orange with a green
> leaf, placed middle right, from 52% to 94% across and 35% to 85% down.
Write the **Description** of each box the way you would in a prompt. Tried on
SenseNova U1.6, which has no box input: these sentences put all the boxes in
place on two seeds of two, where `elements` as text put the words in the wrong
places.
## Change the words in a picture
The `mask` output is white inside every box. Use it to change only one part
@@ -203,13 +149,11 @@ removes it. The first color also colors the box on the canvas.
| `bboxes` | The boxes in pixels of the canvas (x, y, width, height), for nodes that take bounding boxes. A turned box gives the straight box around it. |
| `elements` | The boxes as prompt elements. Wire it to MOSS-Image Layout Prompt. A turned box gives the straight box around it, and a turned text box says its slant in its description. |
| `mask` | White inside every box, black elsewhere, to change only those places of a picture. A turned box is white inside its turned shape only. |
| `h3_prompt` | The boxes as a prompt for MiniMax H3 Image, in words: where each thing goes and how big it is. Name each person's picture and what they do in the box's description. See **Place people with MiniMax H3 Image**. |
| `placement` | The boxes as sentences for a prompt: what goes in each box and where, as parts of the picture. Add it to your prompt for a model that has no box input. See **Words for a prompt**. |
## In place of Create Bounding Boxes
Layout Boxes has the same inputs and the same outputs in the same order (and
`mask`, `h3_prompt` and `placement` after them), so the wires move straight over. For the same boxes it
`mask` after them), so the wires move straight over. For the same boxes it
gives the same `bboxes` and `elements`, and MOSS-Image Layout Prompt makes the
same prompt from them.
@@ -265,32 +209,5 @@ run once: they fill the canvas. Then remove the old node.
- Like Create Bounding Boxes, it is an output node: it runs with the workflow
even when nothing is wired to its outputs, so new boxes on the `bboxes` wire
reach the canvas.
- `h3_prompt` has an opening sentence (one photograph of the scene in
`<Picture 1>`, kept as it is), one sentence per box in box order, and a
closing one (the same ground and light for everything). Across, a box is at
the far left, left, middle, right or far right by its centre; it is "high"
or "low" when its centre is in the top or bottom third and it is less than
0.6 of the frame tall. Its height and width are said as a tenth, a quarter,
a third, half, two thirds, three quarters or all of the frame. Each object
is placed against the object on its left when the two share some height:
right beside it (a gap under 5% of the frame), a little to the right (under
15%), well to the right, or partly in front of or behind it when they
overlap (the later box is in front). Text boxes are placed by the frame
only. A turned box is placed by the straight box around it. A text box with
no text and no description is left out. No boxes give an empty text.
- `placement` has one sentence per box, in box order, joined by spaces. A
text box with words gives `The words "TEXT" in DESCRIPTION, placed WHERE.`
(`The words "TEXT", placed WHERE.` without a description); any other box
gives its description, first letter in upper case, then `, placed WHERE.`
A box with no words and no description is left out. The description is
the one `elements` carries, so a turned text box says its slant. WHERE is
a rough place and then the box's edges in whole percents of the canvas,
cut to it: `top left, from 6% to 52% across and 6% to 25% down`. The box
is "top" when its bottom edge is above 40%, "bottom" when its top edge is
below 60%, else "middle"; "left" when its right edge is left of 55%,
"right" when its left edge is right of 45%, else "center"; and the middle
of both is said as "center" alone. A turned box is placed by the straight
box around it. A box with colors gets ` Colors: #FF3399, #00AABB.` after
its sentence. No boxes give an empty text.
- The background is saved, shrunk, in ComfyUI's temp folder for the node's
face. Nothing else is written.
-71
View File
@@ -1,71 +0,0 @@
# Load Audio
Loads a sound file and hands on only the part you pick. Use it for a voice
clip, a song or any sound a video model or a save node takes, when you want
one part of the file and not the whole thing.
The node shows the whole file as a wave, so you can see where the loud parts
are. The part that comes out is bright. Under the wave are three boxes:
**Start**, **Duration** and **Ends at**, in seconds. Drag the left handle to
move the start, drag the right handle or type a Duration to change how long
the sound is, or drag the bright part to slide it. Click somewhere else on
the wave to move it there. Typing **Ends at** sets the Duration for you.
Press **▶** to hear only the part that comes out. **LOOP** plays it again and
again.
Set the Duration to the length the next step needs, such as the length of
the video you are making. An empty Duration runs to the end of the file.
A box set by another node, such as Float 🆎, shows a **linked** button that
jumps to that node, and the wave shows the part that number picks.
## Clean up
Turn **Clean up** on for a voice recording you want a video model to say,
such as a line recorded on a phone. The sound that comes out:
- is one channel,
- has the quiet bits at the start and end cut off, so the voice starts right
away,
- has less hum, rumble and hiss,
- is at an even volume, never so loud that it clips.
A model that copies the sound it is given copies its noise too, so a clean
recording gives a cleaner result. Clean up works on the part you picked, so
the sound can come out a little shorter than the length shown under the wave;
`seconds` always gives the real length. Leave it off for music.
## Controls
- **Source** (`audio`): a sound file in ComfyUI's input folder. **Upload**
adds one. Videos are listed as well, for their sound.
- **Start** (`start_seconds`): where the sound starts.
- **Duration** (`max_seconds`): how long the sound is, in seconds. Empty, or
`0`, runs to the end of the file.
- **Ends at**: where the sound stops. Typing it sets the Duration.
A workflow saved with an end time (`end_seconds`) keeps it and runs the
same.
- **Clean up** (`clean_up`): on cleans up a voice recording, as above. Off
hands on the sound as it is.
## Outputs
- `audio`: the part you picked, for any node that takes `AUDIO`.
- `seconds`: how long that sound is.
## Technical details
- Only the picked part is decoded: decoding stops once the window is full,
so a short pick from a long recording stays quick.
- The sound keeps its own sample rate and channels.
- A start past the end of the file stops the run with a message that says so.
- The wave is drawn in the browser from the file itself; nothing extra is
stored with the workflow besides the node's own values.
- Clean up runs in this order: the channels are averaged into one; a
high-pass at 80 Hz takes out rumble and mains hum; a noise print is
taken from the quietest moments and whatever sits close to it is turned
down by up to 12 dB (hiss, fans, room tone); quiet ends are cut, keeping
0.1 s before the first sound and 0.2 s after the last; then the volume is
set to -18 LUFS (the loudness broadcast meters read) with a limiter that
keeps every peak under -1 dBFS. The sample rate stays the file's own.
-108
View File
@@ -1,108 +0,0 @@
# Load Image
Loads a picture and sets its size in the same node, so a workflow does not
need a resize node and a size node after its loader.
Pick a file in **Source**, press **Load** to upload one, or use the arrows
under it to step through the pictures in ComfyUI's input folder. The line
beside the arrows shows the size of the file and, when the size changes, the
size that comes out:
`912 × 1632 → 1144 × 2048`
That is the real output size, worked out before you run.
Under that line are two small pictures: the file as it goes in, and the
picture as it comes out. On the first one the part that is kept is lit and
the part that is cut off is dark. Between them the node says the shape
(`3:4 → 1:1`) and what happens (`77% size`, `cuts 449 px of height`).
## Size
**Size** (`size`) picks how the picture is resized. Each choice shows only
the numbers it uses.
| Choice | What it does | Its number |
|---|---|---|
| **off** | The picture comes out exactly as the file has it. | none |
| **megapixels** | Brings the whole picture to a total size and keeps its shape. | **Megapixels** (`megapixels`): 1.0 is about 1024 × 1024 |
| **longest side** | Sets the longer edge; the other edge follows. | **Longest side** (`longest_side`), in pixels |
| **scale** | Multiplies both edges. | **Scale** (`scale`): 0.5 is half, 2 is double |
| **fit inside** | Makes the picture as big as it can be inside a box, with nothing cut off. | **Width** and **Height** (`width`, `height`) |
| **crop to fill** | Covers the box completely and cuts off what sticks out. | **Width** and **Height** |
| **crop** | Cuts a piece of that size out of the picture. Nothing is resized. | **Width** and **Height** |
| **crop to ratio** | Cuts the largest piece of a shape, such as 16:9, out of the picture. Nothing is resized. | **Ratio** (`ratio`) |
**Round to** (`multiple`) rounds the new width and height to a multiple of
that number. Most models want 8 or 16. Set it to 1 to keep the numbers as
they are. It does nothing while Size is off.
## Which part is kept
The three crop choices show **Keep** (`crop_from`). It picks the part of the
picture that stays: `center` cuts evenly from both sides, `top` keeps the top
and cuts from the bottom, `bottom left` keeps that corner, and so on.
You can also click the first small picture: click its top to keep the top,
a corner to keep that corner. The lit part moves so you see what you get.
In **Ratio**, `width : height` takes the shape from the Width and Height
boxes, for a shape that is not in the list (1600 and 900 give 16:9).
## More
- **Method** (`method`): how pixels are resampled. `lanczos` is the sharpest
for photos. `nearest` keeps pixel art crisp.
- **Enlarge** (`enlarge`): on, a small picture is made bigger to reach the
size you asked for. Off, a picture is only ever made smaller: one that is
already below the target comes out at its own size, and crop to fill cuts
the box's shape out of it without growing it.
## The picture on the node
The picture under the settings is ComfyUI's own preview, the same one the
stock Load Image shows. Drop a file on the node or paste one to upload it,
and right-click the node for the mask editor and for copy and paste.
## Outputs
- `image`: the picture at its new size.
- `mask`: white where the picture is see-through and black where it is
solid, as the stock loader gives it. A picture with no transparency gives
an all black mask. It is always the same size as `image`.
- `width`, `height`: the size that comes out.
- `filename`: the file's name without its folder or its ending
(`shots/hero.png` gives `hero`), ready for a save node's prefix.
- `original_width`, `original_height`: the size of the file before any
resize. Use them to bring a result back to the size you started from.
## Which loader to use
- **Load Image** (this node): load a picture and set its size.
- **Load Image + Pad**: add empty space around a picture for outpainting.
- **Image Crop + Rotate + Pad**: turn, crop and pad a picture by hand.
## Technical details
- Every frame of an animated file comes through as a batch, all at the same
new size. A phone photo is turned the way its EXIF data says.
- With Size off the pixels are the file's own, bit for bit, and Round to is
not applied.
- Rounding moves each edge to the nearest multiple, so the shape can change
by up to half a step. Fit inside rounds down instead, so the result never
leaves its box.
- Crop to fill resizes the picture until it covers the box, then cuts the
box out at the side Keep names. The mask goes through the same resize and
the same cut.
- Crop and crop to ratio only cut. A box larger than the picture is cut down
to the picture, and Round to rounds down so the piece stays inside it.
Enlarge does not apply to them.
- The small pictures are drawn on one scale, so a picture made half as large
is drawn half as large.
- With Enlarge off, a rounded size is rounded down so it never passes the
file's own size.
- The size line on the node uses the same arithmetic as the run. The pack's
tests hold the two to the same answers over a table of cases.
- Files are read only from ComfyUI's input, output and temp folders. A name
such as `photo.png [output]` loads a picture ComfyUI made.
- The node runs again when the file changes on disk or a setting changes.
+43 -39
View File
@@ -1,33 +1,37 @@
# Load Video
Loads a video from ComfyUI's input folder as an `IMAGE` frame batch plus its
audio. The player shows the video; the timing card under it picks the part
that comes out.
audio. One responsive player shows the source and previews the selected trim.
Drag the high-contrast **IN** and **OUT** handles below it, drag the selected
range to move the whole window, or type a time into the two fields, in seconds
(`95.5`) or as a timecode (`1:35.5`). Click the strip outside the selection to
move the window to that spot.
The playhead follows each edit, so the frame at either boundary is visible
while trimming. In **Source**, the list plays the clip under the pointer, muted, and filters as you type.
The timing card has three boxes: **Start**, **Duration** and **Ends at**.
Drag the left handle on the bar to move the start, drag the right handle or
type a Duration to change how long the clip is, or drag the middle of the
clip to slide it. **s | fr** switches every box between seconds and frames;
it only changes what you see, never a saved value. **Use as start** starts
the clip at the frame in the picture, and **Whole video** puts the clip back
to the full file. In **Source**, the list plays the clip under the pointer,
muted, and filters as you type.
Playback is constrained to the selected window. **LOOP** repeats it; turn loop
off and playback pauses at OUT. The reload button refreshes the source without
creating a second preview. The player takes the height you give the node:
drag the node taller for a bigger picture. A tall video is shown whole, never
cropped.
The player takes the height you give the node: drag the node taller for a
bigger picture. A tall video is shown whole, never cropped. **LOOP** plays
the clip again and again; with it off, playback pauses at the clip's end.
The reload button refreshes the source.
**FRAME** switches the loader into a frame picker: the trim strip becomes a
single scrub rail, and only the frame at the marker loads — a one-image batch,
ready for image workflows without a separate frame-select node. Click or drag
anywhere on the rail to choose the frame, or type an exact time into the AT
field. Playback runs the whole source freely in this mode so you can hunt for
the right moment. Picking a frame moves IN to that time. When you toggle back,
OUT stays where it was, unless the frame is at or after OUT: then OUT moves to
the end of the video.
**FRAME** turns the loader into a frame picker: only the frame at the marker
loads, as a one-image batch, ready for image workflows without a separate
frame-select node. Drag the bar to choose the frame, or type it into the
**FRAME** box. Playback runs the whole video in this mode so you can hunt for
the right moment. Picking a frame moves the clip's start there.
The boxes count real frames: the frame rate and frame count come from the
file itself, so a 4.1 s clip at 60 fps reads 247 frames, the same number
the run loads. When a box is set by another node it shows a **linked**
button that jumps to that node.
The label between IN and OUT reports what one Run will actually load — e.g.
`0:04.0 of 0:10.0 · 48 frames @ 12 fps`, or `1 frame at 0:05.2` while FRAME
is on. The preview cannot re-render `every_nth` frame drops or a `max_frames`
cap, so it counts them instead: the frame total and playback rate come from
the source's real frame rate (probed from the file, since the browser's
player never exposes it) with `every_nth` and `max_frames` applied. When a
deciding value arrives over a link, or the rate cannot be probed, the count
drops out rather than guessing.
## Drop a video onto the node
@@ -44,21 +48,21 @@ embedded workflow replaces the whole graph.
- **Source** (`video`): A file in the input folder; **Upload** adds new ones.
A video ComfyUI made, named like `clip.mp4 [output]`, loads too.
- **Start** (`start_seconds`): Skip everything before this time.
- **Duration** (`max_frames`): How many frames the clip keeps. **Whole
video** removes the limit, so the clip runs to the end (the widget holds
`0`). The decode stops early, so a short clip from a long video stays
quick.
- **Ends at**: Where the clip stops. Typing it sets the Duration. A
workflow saved with an end time (`end_seconds`) keeps it and runs the same.
- **Every nth** (`every_nth`): Keep one frame in this many; `2` halves the
frame count. The `fps` output divides to match, so the clip still plays at
real speed downstream.
- **LOOP**: Repeat the clip during preview. It starts on and is saved with
the workflow.
- **FRAME** (`single_frame`): Load only the frame at the marker as a
one-image batch; the Duration and Every nth are ignored while it is on.
- **↻**: Reload the source preview.
- **IN** (`start_seconds`): Skip everything before this time.
- **OUT** (`end_seconds`): Stop at this time; `0` means the source end until a
handle is moved.
- **Every nth** (`every_nth`): Keep one frame in this many — `2` halves the frame count.
The `fps` output divides to match, so the clip still plays at real speed
downstream.
- **Limit** (`max_frames`): Stop after this many kept frames; `0` loads the
whole trim window. Caps memory on long clips — the decode ends early
instead of loading and discarding.
- **LOOP**: Repeat the selected window during preview. It starts on and is
saved with the workflow.
- **FRAME** (`single_frame`): Load only the frame at the IN time (the field
reads **AT** while FRAME is on) as a one-image batch; `end_seconds`,
`every_nth`, and `max_frames` are ignored while it is on.
- **↻**: Reload the selected source preview.
- **Width** / **Height** (`custom_width` / `custom_height`): `0` keeps the
source size. Set one side only and the other follows the aspect ratio,
rounded to an even number.
+8 -95
View File
@@ -35,6 +35,7 @@ all. **Remove this LoRA** is red. **Delete all LoRAs…** is a separate red, tra
with confirmation; it clears this node's rows and keeps all files on disk.
Cancel or Escape keeps the stack. Inserting keeps the existing rows and their settings in order;
the new slot uses the gear menu's default strength (initially 1).
The stack holds up to 64 rows.
One strength drives both
model and CLIP by default; the gear menu's **Separate model / CLIP
strength** switch shows a second box per row. The switch is per-node — new
@@ -134,64 +135,6 @@ A group that a switch turns on and off shows the lock on its header
instead. The LoRAs in it keep plain grips, so each one is still yours to
turn on or off. Click the header's lock to take the group over.
## A strength set by a wire
To set one LoRA's strength from somewhere else, such as a slider, a Float
node or a sweep, drag that number's wire onto the row and let go. The row
under the pointer lights up teal while you aim; anywhere across the row
works. The wire runs to that row and its strength box turns dashed teal,
showing the number coming in. The bar behind the name follows it.
- **Click the dashed box** to jump to the node the number comes from.
- **Right-click the row → Unlink strength** to take the wire off. The row
goes back to the strength it had.
- The wire sets the model strength. The CLIP strength keeps the same ratio
to it, so a row at 1.0 / 0.5 fed 0.6 runs at 0.6 / 0.3.
- Gear menu → **Linked strength wires** shows the wire (the default), shows
it only while the pointer is on the loader or the number's node, or hides
it.
### Technical details
Each linked row has its own input, `strength_<row id>`, which exists only
while something is linked to that row. It takes FLOAT or INT. In an API
prompt, give a row's input the row's `id` from the `loras` text, for example
`"strength_ra1": 0.6`. A name that matches no row is ignored.
## Strength over the run
A row can change strength while the picture is made: strong at the start
and gone by the end, say, so a style LoRA sets the look and the fine detail
at the end comes out clean.
1. Wire a Strength Curve 🆎 into the loader's `curve` input.
2. Each row now shows a small curve mark beside its strength. The first
curve you wire marks every row (teal). Click a mark, or right-click the
row and pick **Keep a steady strength**, for a row that should stay as
it is; its mark turns gray. **Follow the strength curve** in the same
menu turns it back on.
A row that follows the curve runs at its own strength times the curve: a row
at 0.8 with a fade out goes from 0.8 down to 0. It works with every model
file: full size, fp8, fp8 scaled and int8.
### Technical details
The CLIP half of a row is applied as always, since a prompt is encoded once.
The model half is loaded in ComfyUI's bypass mode: the LoRA is added to each
layer's result as the layer runs, and the model's weights are never
rewritten. Before every step the loader sets each following row to its
strength times the curve at that step. "Where in the run" is read by the
step's noise level, the way ComfyUI reads hook keyframes, so it lines up
with Krea 2 Encode's `reference_curve`. In the `loras` text a following row
has `"curve": true`; in an API prompt, link `curve` and set that on the rows.
A moving curve costs a little speed and no memory: on Krea 2 each step ran
3 to 8% slower, the same on every model file we tried. A flat curve
skips all of this: the rows just run at their strength times its value. The
rare parts of a LoRA that are not low-rank (a plain weight or bias
difference) cannot change from step to step and stay at the row's strength.
## Strength bars
Every named row paints a center-zero bar behind its name: teal grows right
@@ -234,15 +177,8 @@ last one you ticked and the one you click. Ticks stay while you search, so you c
gather files from several searches; **Clear** unticks them all. Files that
are already in the stack say **in stack** and have no box. With the
keyboard, **Ctrl+Enter** ticks the highlighted file and **Shift+Enter**
ticks the run up to it. The list opens with every folder folded. Use the
arrow beside a folder to open or fold it without adding anything.
**Open all** beside the search box opens every folder at once (it then
reads **Fold all**), and **Alt**- or **Shift**-click on a folder's arrow
opens or folds that folder and every folder inside it. With the keyboard,
**Right** opens the highlighted folder and **Left** folds it; **Left** on a
file folds the folder it is in and moves up to it. To have the list open
the way you left it instead, set **Settings → 🆎 AusBoss → LoRA Loader →
Picker folders** to **Remember my folds**. Search
ticks the run up to it. Use the arrow beside a folder to collapse or expand it without
adding anything. Folded folders are remembered in this browser. Search
reveals matching files; clearing it brings back your folded view. You can
also fold folders while searching.
@@ -253,7 +189,9 @@ their order, strengths and switches. The same filename in different folders
counts as separate LoRAs.
The choice is one undo step. Closing the picker without choosing changes
nothing. Typing a filename and pressing Enter picks one file; use the arrow
nothing. If a folder would take the stack past 64 rows, nothing is added
and a message says how much room is needed. Remove rows or pick a smaller
folder. Typing a filename and pressing Enter picks one file; use the arrow
keys to highlight a folder before Enter if you want the whole folder.
Pointing at a folder with the mouse does not choose it for Enter.
Left and Right collapse and expand a highlighted folder.
@@ -318,7 +256,7 @@ Details that keep the absorb faithful:
rows from a loader without a connected CLIP import with CLIP strength 0
- connected auxiliary outputs, such as trigger words, block absorption because
bypassing their source would break those connections
- linked LoRA settings leave the sources active
- linked LoRA settings and stacks beyond the row limit leave the sources active
- already-bypassed or muted loaders contribute no rows
- a toast summarizes what was imported, bypassed, remapped, and skipped
@@ -331,14 +269,6 @@ red with advice to re-pick. Thumbnails, the info card, and range lookups
all use the resolved name, so a moved file keeps its previews and Civitai
data.
A missing LoRA is also listed in ComfyUI's own missing-models list (the
Issues panel, and the "Download all" button) next to the other models the
workflow needs, with a Download button when the workflow saved where the
file comes from. Rows that are switched off, at zero strength, or whose
file moved folders are left off that list, because the run does not need
them or finds them anyway. Rows that come into the node over a link are
listed by the node that sets them, not here.
The run side matches: a stale saved path resolves by name at load time
(exact → unique case-insensitive path → unique basename, with a one-line
console note when it remaps). A LoRA that is genuinely missing **stops the
@@ -381,16 +311,6 @@ show it right away. Gear menu → **Civitai picture** picks which pictures:
takes the first picture whatever its rating, and **off** saves none. It never
replaces a picture you already have.
**All of them at once:** click **Fetch all LoRAs** beside that button (or gear
menu → **Civitai info for every LoRA**). It looks up every LoRA in the stack that
has no Civitai info yet, one after another with a short pause, so Civitai
is not asked too fast. The bottom of the node shows how far it is
(`Civitai 12 / 44 · Stop`); click it to stop after the LoRA being fetched.
A message at the end says how many were found, how many Civitai does not
know, and how many already had their info. LoRAs with info are skipped, so
running it again only fetches the new ones. It follows the same
**Civitai picture** setting and never replaces a picture.
## Trigger words
The info card gathers words from three places: the LoRA file's own metadata,
@@ -411,17 +331,10 @@ switched on for the old one.
(see "Get the pictures from Civitai" above). After that the button reads **Refresh Civitai
info** and the card gets a **View on Civitai** link. A LoRA Civitai does
not know (unpublished or hidden) reads **Not found on Civitai**. Gear
menu → **Civitai lookup button** removes the button, and **Fetch all LoRAs**
with it. When a lookup fails,
menu → **Civitai lookup button** removes the button. When a lookup fails,
a message says why. If it always says it could not reach civitai.com,
check whether ComfyUI was started with `--disable-api-nodes`: that setting
stops the browser from reaching any other site, Civitai included.
- **Fetch all LoRAs** runs that same lookup for each LoRA in the stack that has no
Civitai info yet, one at a time, about one and a half seconds apart. If
Civitai answers "too many requests", it waits 20 seconds and tries that
LoRA once more; a second time, it stops and says so. It also stops when
civitai.com cannot be reached, or after three failures in a row. Only one
Fetch all LoRAs runs at a time on the page.
- **Suggested strength**: a lowest and a highest value at the bottom of the
card (leave one empty for "any"). It is only a reminder: a row set outside
it shows its number in orange, and the tooltip gives the range. Saved per
+11 -88
View File
@@ -19,8 +19,8 @@ What is lit in teal is what the mask will be. When it is right, press Run
for the whole workflow.
The first time the pointer rests on a picture, the node looks at it. A
button under the picture shows how far along it is, **❚❚ Pause · looking
40/104**, filling up as it goes. The first things light up after a few seconds, and
small button under the picture shows how far along it is, **❚❚ 40/104**,
filling up as it goes. The first things light up after a few seconds, and
it has seen the whole picture after about 20.
You do not have to wait for that. Whatever is lit under the pointer can be
@@ -28,7 +28,7 @@ picked: a click takes it at once, also while the node is still looking.
Click that button to pause the looking when what you need is already lit:
what is lit stays, and you go on picking and painting. It turns into
**▶ Look on**; click it to look on from where it stopped. A click on a spot where
**▶**; click it to look on from where it stopped. A click on a spot where
nothing is lit yet looks on as well.
A click on a spot where nothing is lit yet is not lost: a dot marks it, the
@@ -50,9 +50,6 @@ at that spot.
A stroke across two things, like both shoes, takes both.
- Did the thing not light up at all? Type its name into the field under the
picture, like "screen" or "earring", and press Enter.
- Is something in the mask that should not be, like the face or the hair of
a person you picked? Click the **+** in front of that field so it shows
**−**, type "face" and press Enter. Or hold Ctrl and click the face.
- When nothing fits, switch to **Paint** and paint the area yourself.
## The whole subject, or the background
@@ -62,10 +59,6 @@ click: the person, the animal, the product. **Background** picks everything
else. They are picks like any other: click more things to add them, or
Ctrl-click a thing to take it away again.
Ctrl-click takes away the thing under the pointer, where it is in the mask.
On a spot where nothing is picked it changes nothing, and the picture says
so.
Both need ComfyUI's background-removal model, see "The model for Fine
edges" below.
@@ -122,16 +115,11 @@ or an area you painted.
it.
- **all 3** on a chip takes every thing of that name instead of the one you
clicked: all five birds, both shoes.
- The field at the end picks every thing of the name you type. The sign in
front of it says what happens to the name: **+** adds it, **−** takes it
away. Click the sign to change it. A name typed with a minus in front,
like "-face", is taken away whatever the sign shows. With Erase chosen the
sign starts on **−**.
- The field at the end, **+ type a name**, picks every thing of the name
you type. With Erase chosen it takes them away.
## The tools on the node
- **Reload** (the round arrow) shows the picture coming in now: see
**Which picture the picks belong to**, below.
- **Undo** takes back the last change, or a Clear. Ctrl+Z works as well: it
is ComfyUI's own undo, and every change counts.
- **Clear** picks nothing.
@@ -164,15 +152,11 @@ or an area you painted.
- **More → Smooth** (`smooth`): rounds off a ragged outline by this many
pixels.
- **More → Fill small holes** (`fill_holes`): closes pinholes inside the
picked area. Larger openings stay open, like a mug's handle. Off by
default, so a hole you pick stays a hole.
picked area. Larger openings stay open, like a mug's handle.
- **More → Invert** (`invert`): turns the mask round. On, the mask is
everything except what you picked.
- **More → If nothing** (`if_nothing`): **stop the run** or **empty mask**,
see below.
- **More → New picture** (`new_picture`): **keep picks** or **start over**,
for when a different picture comes in. See "Which picture the picks belong
to" below.
- **More → Free VRAM** (`free_vram`): takes SAM 3 out of the graphics card's
memory right after the search, so the next model has the room. Turn it on
in a workflow that loads a big model after this node.
@@ -195,35 +179,6 @@ used ComfyUI's Remove Background template, you already have it.
A workflow that already has Fine edges on tells ComfyUI which file it needs,
so ComfyUI lists it under **Missing Models** with a download button.
### RMBG-3.0: softer hair, bigger and slower
Bria's RMBG-3.0 keeps loose strands, fur and lace that BiRefNet cuts into a
hard edge. Once its files are in place, **Fine edges** offers **RMBG-3.0**
next to **BiRefNet**, and **Subject** and **Background** use the one you pick.
Fine edges still starts at **off**, and while it is off, Subject and
Background use BiRefNet.
It costs more: about 14 GB of files, up to about 17 GB of graphics memory (a
24 GB card), and
about 2 seconds a picture once it is loaded, where BiRefNet takes under one.
The first picture also waits while it loads. Its licence
is non-commercial (CC BY-NC 4.0): for paid work, Bria sells a licence. Keep
BiRefNet for that.
From the Hugging Face page `briaai/RMBG-3.0-Comfy`:
1. `diffusion_models/rmbg3_int8_convrot.safetensors` into
`ComfyUI/models/diffusion_models`.
2. `text_encoders/qwen3vl_4b_int8_convrot.safetensors` into
`ComfyUI/models/text_encoders`.
3. `vae/flux2-vae.safetensors` into `ComfyUI/models/vae`.
4. Press **R**, then set **Fine edges** to **RMBG-3.0**.
It needs ComfyUI 0.43 or newer. Keep the model's file name starting with
`rmbg3`: that is how the node knows it. After moving a file into a
subfolder, pick it again under Fine edges. With both of Bria's copies (int8
and bf16), Fine edges says which is which.
Good to know:
- Fine edges works on the outline of the main subject: a person's hair
@@ -251,21 +206,10 @@ nothing instead.
## Which picture the picks belong to
Picks belong to the picture they were made on. When a different picture
comes in, **New picture** (under More) decides what happens to them:
- **Keep picks** (the default): your clicks and paint move onto the new
picture, in the same places. On a picture of another size they are
scaled to fit it. A click finds whatever is at that spot now; paint stays
exactly as painted. Press **Clear** to start over.
- **Start over**: the node shows the new picture with nothing picked. If the
workflow runs before you pick again, the run stops and says the picks
were made on another picture. The new picture shows on the node then,
ready to pick from.
- **The reload button** (the round arrow beside Undo) shows the picture
coming in now. Use it after you change the picture before this node, for
example with an edit. It runs only this node and what comes before it.
Picks belong to the picture they were made on. Load another picture and the
node shows it with nothing picked, and says the old picks are not used.
If the workflow runs before the node has shown the new picture, the run
stops and says the picks were made on another picture.
- With a Load Image wired straight in, or through Reroute nodes, the
picture shows as soon as you choose a file.
@@ -312,15 +256,6 @@ then.
### How SAM 3 is asked
- A picture whose long side is over 2048 pixels is asked about on a copy
with its long side at 2048. SAM 3 reads every picture at 1008 pixels
anyway, and returns each answer at the size it was given, on the graphics
card: at 8192 pixels one word with many matches needed over 27 GB. The
answer is brought back to the picture's own size, so the mask, the cut-out
and your touches stay in pixels of the picture. Paint is never scaled.
Measured on a 3840 pixel picture, five words: the new masks share 95 to
99.6 % of their area with the old ones, the edge sits a median 0 to 2
pixels differently, and a look takes 31 seconds in place of 53.
- The search is ComfyUI's own SAM 3: SAM3 Detect, asked about points, or
about a word that CLIP Text Encode has read. Both use ComfyUI's own
settings (threshold 0.5, two edge passes). The node needs ComfyUI 0.20 or
@@ -381,10 +316,7 @@ no browser:
used.
- **`paint`**: exactly the stroke's own area. SAM 3 is not asked.
- **`key`** names the picture the picks were made on: its size and a
fingerprint of every pixel. Picks made on another picture are moved onto
the one that came in, scaled from the size in their key to its size, and
the face is sent the moved touches. With `new_picture` set to `start
over` they are ignored instead.
fingerprint of every pixel. Picks made on another picture are ignored.
Leave `key` out when you write `touches` by hand.
### How an area is tidied
@@ -454,15 +386,6 @@ no browser:
node, the plain edge is shown instead, with the same line.
- **Free VRAM** unloads this model as well.
With RMBG-3.0 the subject comes from ComfyUI's own nodes, run the way Comfy's
RMBG-3.0 template runs them: its fixed matting instruction, 4 steps, cfg 1,
euler, simple, seed 42. The picture is stretched (never cropped) to about one
megapixel in steps of 16 pixels, and the red channel of what it paints is
scaled back to the picture's size, so the matte lines up pixel for pixel. Its
model, text reader and VAE are loaded once and kept, and Free VRAM unloads all
three. One copy is held at a time, and it is unloaded before BiRefNet runs.
Each picture of a batch is worked out once per run, however long the batch.
### The things that light up
- The node asks SAM 3 about a picture in this order: the place under the
-78
View File
@@ -1,78 +0,0 @@
# Pause for Shot 🆎
Stops the run right after the 3D viewer so you can frame your shot on the
model it just made. Turn the camera, zoom, spin the model, then press
**Continue**, on this node or on the bar over the viewer. The run goes on with
the shot exactly as the viewer shows it, and nothing before this node runs
again. **Stop** ends the run here.
## How to wire it
Put it between a **Preview 3D (Advanced)** viewer and the node that renders
the shot (such as Render Mesh): the viewer's `model_3d_info`, `camera_info`,
`width` and `height` go in, and the same four come out.
## A 360 behind the model
Wire a 360 picture (twice as wide as tall) into `panorama`. While the run
waits, the viewer shows it behind the model, and `backdrop` gives the part of
it the camera sees, at the shot's size. Put the shot on top of `backdrop` and
the model and its background can be treated apart, such as blurring one and
not the other.
**Shadow** on the viewer's Backdrop tab puts a soft shadow on the floor under
the model, so it stands on the 360 instead of floating in front of it. The
viewer shows it while you frame, and `backdrop` carries the same shadow.
Take the 360 out of the viewer while the run waits, and `backdrop` comes out
plain grey, the same as with no 360 wired in. What you see in the viewer is
what you get.
## Cut the front or back off the model
**Cut front** and **Cut back** on the viewer's Model tab take away part of
the model as the camera sees it: Back the far side, Front the near side, each
as a share of the model's depth. Use Back to hide what should sit behind
something in the picture, such as the inside of a hat behind the head. The
viewer shows the cut as you drag.
For the shot to be cut too, wire the model's mesh into `mesh` and take `mesh`
from this node to Render Mesh. A run that goes straight through uses the cut
saved on the viewer.
## Settings
- **Pause**: *wait for me* stops every run here. *run through* lets runs go
straight on with the camera as it was when you pressed Run, for runs nobody
is watching. The viewer's 360 settings and Cut go along as they were then
too, and changing one makes the next run redo the shot.
## Technical details
- Why it is needed: a run takes the camera from the moment Run is pressed. A
camera moved after that never reaches it, so without a pause you would press
Run a second time.
- Continue sends the viewer's camera, the model's turn and the size as
numbers to the pack's own route. Only a node that is waiting accepts it.
- A run that goes straight through takes the viewer's 360 settings and Cut
from the hidden `view` input, which the page fills from the viewer as Run
is pressed. ComfyUI only runs a node again when one of its inputs changes,
so they ride in an input rather than in the saved workflow. A prompt sent
without the page can fill `view` with the same JSON (`{"sky": {...},
"cut": {...}}`) or leave it empty for the defaults.
- Cancel in ComfyUI's queue ends a pause too. A page reloaded during a pause
shows the Continue bar again.
- Every open page gets the model to frame, not only the one that pressed Run:
ComfyUI sends a viewer's result only to that page, so the pause sends it
again to all of them.
- The floor grid and shadow sit at the lowest point the viewer finds. On
large models it checks a sample of points. The shadow covers the bottom
tenth of the model. Continue sends that patch with
the camera, and the backdrop is darkened along the same rays Render Mesh
casts, so the shadow lands where the model's feet are drawn.
- The cut planes face the camera. The model's depth is how far the box around
its own points reaches along the view, measured the same way in the viewer
and on the run's mesh. The viewer cuts at the exact plane; the mesh keeps
the triangles whose middle lies between the planes, so the edges agree to
within a triangle. While a cut is on, the viewer draws both sides of the
model, so through the cut you see its inside, the way Render Mesh draws it.
-54
View File
@@ -1,54 +0,0 @@
# Photo Camera 🆎
Works out the camera your photo was taken with, so a 3D model of the person
lines up with the photo. With it, the 3D viewer opens on your photo's own
view: same height, same lens, the person where they stand in the photo. Move
the camera from there and the shot starts from something real instead of a
guess.
It is made for **Pixal3D**, the TRELLIS 2 model in ComfyUI that builds the
model lined up with the photo.
## How to wire it
- `image`: your photo, the one **Crop to Mask** cuts the person from.
- `mask`: the person's mask, the same one Crop to Mask uses.
- `fov`: how wide the photo is, in degrees. Wire **Get FoV from MoGe**
(horizontal, degrees) here, run on the same photo. Without MoGe, 55 suits
most phone photos.
Then:
- `crop_fov` goes into **Pixal3D Conditioning**'s `fov`.
- `camera_info` goes into the 3D viewer's `camera_info`
(**Preview 3D (Advanced)**). The viewer opens on the photo's view.
- `strip_width`, `strip_x` and `strip_y` say where the photo goes on the 360
canvas: its width (into an Image Scale) and its left and top edges (into
the Image Composite that lays it on the canvas). The 360 then lines up
with the camera. Turn the 360 by 90 on the viewer's Angle tab so its middle
sits behind the model.
## Settings
- **Lens**: the photo's field of view across, in degrees.
- **Crop margin** (under **More**): the margin Crop to Mask adds around the person.
Keep it the same as Crop to Mask's `pad_factor`.
- **360 width** (under **More**): the width of the 360 canvas.
## Technical details
- Pixal3D builds from a square crop around the person and the crop's field of
view. Its model comes out with +Y up, and with the crop's camera on +Z
looking at the middle from 0.5 / tan(crop_fov / 2) away.
- The whole photo was taken from the same point. Its centre is off the crop's
middle, so the photo's camera is the crop's camera turned towards the
photo's centre, with no roll. Render Mesh and the viewer can show a turn
but not a shifted sensor, which is what a crop really is. A person near the
middle lands to the pixel. A fifth of the frame off centre, the model's far
edges move by up to 3% of the frame's width; up in a corner with a wide
lens, up to 8%.
- The crop box is the one Crop to Mask cuts: the node asks ComfyUI's own crop
helper for it, and measures it the same way itself on a ComfyUI without
that helper.
- The photo is laid on the 360 canvas flat, at its own width in degrees, with
its centre where the camera's axis meets the canvas.
-54
View File
@@ -1,54 +0,0 @@
# Prompt Variations
A prompt box that changes on every run. Write choices in curly brackets and
the node picks one from each set:
```text
A woman in a {plain|striped|patterned} {tank top|sweater|button-up shirt}
and {jeans|a pleated skirt|cargo shorts}, {standing|sitting on a stool|leaning on the wall}.
```
One run might give "A woman in a striped sweater and jeans, sitting on a
stool." The next gives another mix.
Use it to make many different pictures in one go. Wire in the seed, set the
Seed node to **randomize**, and set the number of runs next to the Run
button to 50. Each run gets a new seed, so each picture gets new choices.
## Controls
- The text box (`text`): your prompt. Put each set of choices in curly
brackets and split the choices with `|`. Write as many sets as you like,
each with as many choices as you like.
- `seed` (a socket): the seed your sampler uses. A new seed picks new
choices. The same seed picks the same ones again, so a picture you like
can be made again from its seed.
## Output
- **prompt**: your text with one choice picked from each set. Wire it to
Show Text to see what was picked.
## Tips
- An empty choice lets a part come and go: `a {|striped} shirt` gives "a
shirt" or "a striped shirt".
- Sets can go inside sets: `{a {red|blue} hat|a scarf}`.
- Text without curly brackets comes out exactly as typed.
- To make one choice come up more often, write it more than once:
`{jeans|jeans|skirt}`.
## Technical details
Only brackets that hold a `|` are choices. Brackets without one are left as
they are, so a JSON prompt such as `{"light": "soft"}` passes through
unchanged. A `|` inside JSON brackets still counts as a choice.
The innermost sets are picked first, from left to right, with Python's
`random.Random(seed)`. The same text and seed always give the same prompt,
on any machine. Spaces around each choice are trimmed, and an empty pick
also drops the one space in front of it.
The picks happen when the prompt runs, on the server, not in the browser.
ComfyUI's own `{a|b}` choices in some text boxes are picked by the browser
when you queue, with no seed; this node does not use them.
+4 -10
View File
@@ -31,8 +31,8 @@ names from here on; how it measures may still improve.
moved a boat keeps the boat where it drew it, so the result lines up
closely, not pixel for pixel.
- **Leaves alone:** a picture it can't measure, or a zoom bigger than
**Max zoom** after allowing for padded reframing. That picture only
comes out resized, and the report says why.
**Max zoom**. That picture only comes out resized, and the report says
why.
## Controls
@@ -50,10 +50,8 @@ names from here on; how it measures may still improve.
with nothing in it. `edge` (the default) stretches the nearest pixels
into it, `source` fills it from the original, `gray` fills it flat gray
for inpainting. With a big enough margin there is no strip.
- **Max zoom**: the zoom limit in percent (20 by default). For a padded
picture, zooming in to fill the padding gets an extra allowance; the
setting limits zoom beyond that. Zooming out still uses the stated limit.
Anything beyond those limits is treated as a change you meant and left alone.
- **Max zoom**: the biggest zoom it will undo, in percent (20 by default).
Anything bigger is treated as a change you meant and left alone.
## Outputs
@@ -123,10 +121,6 @@ new cloud, are left out. It trusts the fit when at least 10 blocks, and at
least a quarter of them, agree. With a stitcher, the blocks tile the
picture's area only.
For padded reframing, the extra zoom-in allowance on each axis is the
canvas size divided by the source picture's size, minus one. It is added
to **Max zoom**; zooming out gets no extra allowance.
It runs on the CPU in a fraction of a second per 1 MP frame. No new
dependencies, and no model.
+6 -16
View File
@@ -6,9 +6,6 @@ quick brush before the mask goes to an inpainter. It can also snap the edge
to a guide image and adjust the mask's levels. Both the refined mask and its
inverse are returned, so no separate invert node is needed.
You can run it on its own, with nothing wired after it, to check the mask
before the rest of the graph runs.
The panel shows the refined mask itself once the node has run, so the effect
of a setting is visible without wiring a preview node beside it. With a batch
or a video it shows the first mask. The small
@@ -61,19 +58,12 @@ run the workflow again. The switch is the node's optional `preview` input.
- **Edge** (`edge_refine`): `off`, **guided** (`guided filter`), or
`matting`. Both refinements snap the mask edge to the connected
**guide_image** and run per frame, so video batches stay interruptible:
- `guided filter` — fast. Pulls the mask's edge onto the edges in the
guide image, which picks up thin parts and loose strands a rough mask
missed. **Detail range** sets how far it looks.
- `matting` — slower and finer. Softens the mask's edge over a wide band
and works out the real edge inside it from the guide image. Pair it
with the levels remap to tidy the result.
- **Detail range** (`detail_range`): How far from the mask's edge to look
for the real edge, `12` by default. Raise it for hair or a loose mask,
lower it for a small subject. Used only while **Edge** is on.
- **Fix threshold** (`fix_threshold`): How much of the softened edge
matting may rework. The default, `0.01`, lets it fix the whole edge;
higher values trim the mask inward. Used only while **Edge** is
`matting`.
- `guided filter` — fast edge-aware filtering of the soft mask against the
guide image. The filter radius scales with **Expand**.
- `matting` — closed-form alpha matting: the binarized mask eroded by the
edge radius counts as definite foreground, the dilation marks where
definite background begins, and the band between is solved against the
guide image. Pair it with the levels remap to tidy the solved alpha.
- **guide_image** (optional input): RGB frames the mask belongs to, matching
the mask's size; one frame is broadcast across a mask batch. Required when
`edge_refine` is not `off`.
+2 -11
View File
@@ -2,21 +2,12 @@
Pick a picture size by shape and megapixels, or by dragging. Use it in place of an Empty Latent node: it gives you the width, the height and a blank latent of that size.
- **Shape:** the left button selects landscape or portrait. Ratio chips follow that choice; square retains it for the next selection. Clicking a chip changes the shape and keeps your current megapixels. To have a chip jump to its size near one megapixel instead, turn off **Chips keep current budget** in the gear.
- **Shape:** the left button selects landscape or portrait. Ratio chips follow that choice; square retains it for the next selection. Clicking a chip uses its generated size near one megapixel. Enable **Chips keep current budget** in the gear to retain the current area.
- **Canvas:** drag a side to change one dimension; drag the corner to scale both. Shift frees the corner ratio, Alt removes snapping, and Escape cancels the drag. The bright readout shows the size, megapixels and ratio; an amber dot means the size is off the snap grid, which a typed size can be. Arrow keys nudge the focused canvas by the snap step, or by 8 px with Shift.
- **Size & budget:** scrub or type W, H, or MP. Typed dimensions are preserved exactly. The swap button exchanges dimensions. The **Sizes** chips are ready-made sizes for the current ratio, small to large. They show while the shape is one of the ratio chips; any other shape shows one greyed-out "custom" chip.
- **Gear:** set the **Snap step**, edit the **Ratio chips**, choose the **Latent family** (`latent`) and **Batch size** (`batch_size`), and hide the **Dot grid** or **MP cost curves**. **Snap step** (8, 16, 32 or 64; starts at 32) is the grid that drags, arrow keys and chips land on. The display options apply to every Latent Size node in this browser; latent family and batch size (1 to 64) belong to this node.
- **Ratio chips:** in the gear, **Ratio chips → Edit list** shows every ratio with its size near one megapixel. Tick a ratio to show it as a chip, untick it to hide it, × removes it, and the box at the bottom adds your own, such as `21:9`. 5:4 and 21:9 come in the list switched off. **Reset to defaults** brings back the shipped list. Add a ratio once: the flip button turns it portrait.
- **Gear:** set the **Snap step**, edit the **Ratio rail**, choose the **Latent family** (`latent`) and **Batch size** (`batch_size`), and hide the **Dot grid** or **MP cost curves**. **Snap step** (8, 16, 32 or 64; starts at 32) is the grid that drags, arrow keys and chips land on. The **Ratio rail** is the list of ratio chips, typed as `1:1, 21:9`. The display options apply to every Latent Size node in this browser; latent family and batch size (1 to 64) belong to this node.
- **Node size:** drag the node's corner to make it wider or taller, so it lines up with the nodes around it. The controls stretch with it, and the canvas preview takes any extra height. It can be as narrow as 320 pixels.
## Workflow resolutions
In the gear, choose **This workflow → Workflow resolutions → Edit list**. Enter one exact width × height per line, up to 24. The list belongs to this node and travels with the saved workflow. An empty list leaves the normal editor unchanged.
- **Recommendations:** leave **Limit choices to this list** off. The Sizes row shows your quick picks, and users can still type, drag or choose another shape.
- **Strict model sizes:** turn the limit on. The Shape row shows only the exact ratios in the list. Select a ratio to see its allowed sizes. For example, 576×1024 and 720×1280 share 9:16; 480×864 is a separate 5:9 option. Landscape is available only if you list a landscape size. The canvas stays visible, but it cannot be stretched. The swap button works only if the exact reverse size is listed.
- On enabling the limit, an unlinked size stays selected if allowed; otherwise the first listed size is selected. A linked width or height is checked at run time, before the latent is allocated. An unsupported pair produces an error naming the allowed sizes. For video workflows, connect these width and height outputs to the video latent node.
## Outputs and links
Outputs are **width**, **height**, and **latent**, in that order. The node has four input sockets above the panel: width, height, latent and batch_size. Linking width or height locks the controls that would change both dimensions; the other dimension remains editable. Linking latent or batch_size sets the latent family or batch size from another node, and the gear then shows that setting as linked. A linked value is read when the workflow runs, so the preview keeps showing the size stored on the node.
+5 -65
View File
@@ -41,40 +41,18 @@ file's name. A caption on the `caption_text` input writes the paired `.txt`.
workflow in EXIF. **JXL** (`jxl lossless`, lossless JPEG XL) is the most
compact; it needs the optional `pillow-jxl-plugin` in ComfyUI's python
(also the pack's `jxl` extra) and few browsers preview it.
- **Embed** (`save_metadata`, `civitai_info`): **On** stores the prompt and
- **Embed workflow** (`save_metadata`): **yes** stores the prompt and
workflow in the file (PNG text chunks, EXIF in webp and jxl) so it drags
back into ComfyUI; **Off** writes a clean file for sharing or datasets.
back into ComfyUI; **no** writes a clean file for sharing or datasets.
`--disable-metadata` on the server wins.
- **Civitai** (the Embed switch's third choice, `civitai_info` on): stores
the workflow and also the prompt, the sampler settings and the
fingerprints of the model and LoRAs in the form civitai.com reads, so an
upload shows its prompt and lists its resources. Not the default: Civitai
then shows these settings instead of the ComfyUI workflow, though the
workflow stays in the file and still drags back into ComfyUI. The first save with a new model
takes a moment while its file is fingerprinted; after that it is
remembered. See "Uploading to Civitai" below.
- **Preview** (`preview`): the small switch under the card shows the saved
image on the node. Off, the picture's box goes away and the node is
shorter; on again, the node returns to its height with the last saved
image. It is display only: the file is saved either way and the queue
still lists it. When a run saves more than one image (a batch, or a list
such as a folder of images), they all show side by side. The arrows
beside the switch (‹ all 5 ›) go on to each one by itself (‹ 2 / 5 ›) and
back round to all of them. A run of more than 48 shows one at a time.
The node shows a small copy of each picture (up to 2048 pixels on the
long side), so a big file shows at once on a slow connection too. The
saved file is always full size. The copies are in ComfyUI's temp folder.
- **Auto save** (`autosave`, on by default): on, every run saves its
pictures. Off, a run only shows them here and saves nothing. A row over
the picture then says **Not saved yet**, with a **Save picture** button.
With several pictures it reads **Save all 4**, and with the arrows on one
picture, **Save this one**. After a save the row says what is saved.
Use it to make a batch, look, and keep only the good ones. The pictures
are saved under the name and folder set above, in the format picked,
with the workflow inside if **Embed workflow** is on. They wait in
ComfyUI's temp folder, which is emptied when ComfyUI restarts, so save
what you want before that. The Save button works for the last 256 runs.
- **Preview steps** (`step_preview`, off by default): the switch left of
such as a folder of images), arrows beside the switch (‹ 2 / 5 ›) step
through them.
- **Steps** (`step_preview`, off by default): the switch left of
**preview** shows the picture while it is being made, one step at a time,
where the saved image goes, with a **STOP** button on the bar. Stop a run
that is going wrong after the first steps instead of waiting for the end;
@@ -123,44 +101,6 @@ be, apart from the size, which only a run knows.
and is not read for tokens.
- Other text between percent signs stays as typed.
## Uploading to Civitai
civitai.com reads a ComfyUI picture's prompt from the embedded graph, but
only from nodes it knows. A prompt typed into Krea 2 Encode 🆎, core's Qwen
Image 2.1 encoder or a node inside a subgraph reads as no prompt, and the
upload is flagged "Unable to Verify AI Generation". Civitai also finds a
picture's models only by their file fingerprints, which a ComfyUI graph does
not hold, so a plain ComfyUI picture always says no resources were found.
Pick **Civitai** in the Embed switch before saving pictures you mean to
upload.
### Technical details
- The line is the one A1111 writes (`parameters` text in PNG, EXIF
UserComment in WebP and JPEG XL): prompt, `Negative prompt:`, then
`Steps`, `Sampler`, `Schedule type`, `CFG scale`, `Seed`, `Size`,
`Model hash`, `Model`, `Lora hashes` and a `Hashes` JSON block. Civitai
reads it before the ComfyUI graph.
- It ends with `engine: ComfyUI`, which tags the post with the ComfyUI tool,
and `process: txt2img` or `img2img`, which picks its technique. A sampler
that starts from an encoded picture, an inpaint node, or a denoise under 1
counts as img2img.
- Civitai does not keep the ComfyUI graph from a picture that carries this
line, so its page shows no workflow to copy. The workflow is still in the
file for anyone who downloads it.
- It is built from the run's own graph, walking up from this node to the
nearest sampler (KSampler, KSamplerAdvanced, SamplerCustom and
SamplerCustomAdvanced), its prompt encoder, and the checkpoint or
diffusion model and LoRAs on its model input. LoRA Loader 🆎 rows that are
off or at strength 0 are left out. A graph with no sampler gets no line.
- Fingerprints are AutoV2 hashes (the first ten hex digits of the file's
SHA256), cached in `user/ausboss/` by file size and date. Text encoders and
VAEs are not listed; Civitai does not credit a picture to them.
- A prompt made while the graph runs (Prompt Variations 🆎) is written as
the text typed into its node.
- Videos cannot carry it: Civitai reads only the `prompt` and `workflow`
tags of an mp4 or webm.
## Outputs
- **file_path**: absolute path of the first file saved this run (empty when
+7 -9
View File
@@ -9,10 +9,9 @@ duration, shows a tall video whole, and has a **LOOP** control. `gif` and
`webp` are shown as pictures with just the file name, since a video player
cannot play either.
**Preview steps** above the player (`step_preview`, off by default) shows the clip in
the player while it is being made: after each step, about one frame per
second of the clip plays in a loop, with a **STOP** button on the player.
You see the motion take shape, not only the first frame. Stop a clip that is going wrong after the first steps
**STEPS** (`step_preview`, off by default) shows the clip's first frame in
the player while it is being made, one step at a time, with a **STOP**
button beside it. Stop a clip that is going wrong after the first steps
instead of waiting for the end; a stopped run saves nothing. The saved
video replaces the steps. The [Step Preview](AUSBOSS_NODES_StepPreview.md)
page has the details.
@@ -38,7 +37,7 @@ page has the details.
- **Ping-pong** (`pingpong`): Plays the clip forward then backward so it loops seamlessly.
Roughly doubles the frame count and the encode time. The first and last
frames are not repeated at the turnaround, so the loop does not hitch.
- **Embed workflow** (`save_metadata`): On by default. Turn it off to share a file
- **Metadata** (`save_metadata`): On by default. Turn it off to share a file
without your prompt and node graph embedded in it. If ComfyUI was started
with `--disable-metadata`, nothing is embedded whatever this says.
- **audio** (optional): A track to mux into the file, e.g. Load Video's
@@ -78,14 +77,13 @@ a software format to use instead rather than failing with a driver stack
trace.
`gif` and `webp` have no streaming encoder, so every frame is held in memory
before the first byte is written — keep those to short clips. `webp` carries
the embedded workflow the same way ComfyUI's own animated WebP does; `gif` has
no place for it.
before the first byte is written — keep those to short clips. Neither carries
metadata, so an embedded workflow is not available for them.
The node's face follows the table: widgets the chosen format ignores are
hidden rather than left to look meaningful. The CRF field leaves the
**FPS · CRF** row for `mov prores`, `mkv ffv1` and `gif` (their rows read
*ignored* above), and the **Embed workflow** row disappears for `gif`,
*ignored* above), and the **Metadata** row disappears for `gif` and `webp`,
which cannot carry it. Hidden is not removed:
the widget keeps its position and its value, saved workflows store and restore
it exactly as before, and switching the format back brings it back with the
-9
View File
@@ -27,15 +27,6 @@ needs.
- The line underneath shows the last run's seed. The history saves with the
workflow.
## Compact look
The **gear** beside the number picks the look. **Compact** is one short
row: the number, a mode chip and a dice. Tap the chip to go Random → Fixed →
+1 → −1. The dice rolls a new seed and pins it. A long seed shrinks to fit.
Hover the number to see the last run's seed. The look is saved on the node,
and new Seed nodes start in the look you picked last. **Full** brings back
the whole card, with the seeds it ran with.
## Output
- **seed**: The seed, unchanged.
+1 -18
View File
@@ -9,10 +9,6 @@ Put it anywhere on the canvas. It needs no wires: it shows whichever sampler
in the workflow is making a picture right now, and the caption under the
picture says how far it is ("step 3 of 8").
For a video, the picture moves: after each step a few frames of the clip,
about one per second, play in a loop, so you can see the motion form and
stop a clip that is going wrong.
## The buttons
- **STOP**: stops this run now. Nothing after the sampler runs, so nothing
@@ -69,17 +65,4 @@ ComfyUI uses it.
it does whenever previews are turned on in ComfyUI. The node grows to
hold the picture and keeps the last step after the run.
- Runs queued from another workflow tab are not shown here.
- With a video model (H3, Wan, LTX and others), the step picture moves:
after each step the pack also sends about one frame per second of the
clip (16 at most), and they play in a loop at the clip's own pace. Each
frame is made by the same preview ComfyUI uses for the first frame, one
frame at a time, so it needs no extra memory and no extra files.
- Measured with MiniMax H3 (Pika, 6 steps, a 5 second clip) on one
desktop: 6.22 s a step with no step pictures, 6.35 s with the moving
ones; 53.6 s and 53.8 s for the whole run. With the quick preview the 7
frames of a step take about 1 ms to make, and each step sends about 20 KB.
- With the tiny video decoder (TAESD chosen and `taeh3` in
`models/vae_approx`) the frames are sharper and take longer, about 60 ms
each at 720p on that desktop. The frames never take more than a tenth of
the run's time: on a slower card some steps keep the frames they have
instead of making new ones.
- With video models the step picture is the clip's first frame.
+6 -61
View File
@@ -7,43 +7,6 @@ from **Crop For Inpaint 🆎**, **Load Image + Pad 🆎** or any
result, it is resized to fit first, then joined to your picture the way
**Seam** says.
## Follow changes
Turn on **Follow changes** when the model draws past your box and the paste
cuts it off: a boot that ends at the box's edge, half a plate rim, a collar
sliced flat. Edit models that redraw the whole crop they are given, such as
MiniMax H3 Image, do this often.
With it on, the paste is no longer just the box. It takes the box plus every
change the model made that touches the box, and fades out before the edge
of the crop that went to the model. Before that, it undoes the small zoom or
shift such a model can draw, so the wall, tiles or table around the edit line
up with your picture again.
When the model changed nearly everything around the box, there is no single
new thing to follow, and the paste stays the box. The console says what was
done on each run. Follow changes works on a Crop For Inpaint stitcher with
the classic seam; an outpaint has no picture under its new area to compare
against, so it pastes as before.
### Technical details
- The model's crop is lined up with the picture's own crop by the zoom and
shift Realign to Source measures (up to 20% zoom). An unreliable
measurement leaves the crop as it came back.
- A pixel counts as changed when the lined-up crop differs from your
picture by more than 0.10 (on 0 to 1, averaged over red, green and blue,
after a 4 px blur). Changes are joined to the box when they come within
8 px of it, then closed by 6 px, filled, widened by 10 px and softened by
10 px.
- The paste fades to nothing over 24 px before each crop edge that lies
inside your picture, and runs to the picture's own edge where the crop
reaches it.
- When the changes outside the box cover more than half of the crop outside
the box, the paste stays the box.
- The work runs at most 768 px on the long side and takes under a second
on a 4 MP crop.
## Paste onto: crop or original
**Paste onto** picks what you get back. It lives in the gear menu, next to
@@ -104,11 +67,9 @@ are in the model's own picture.
Tone match 0 the new area is bit-identical to what the model painted, and
the whole stitch is the 2.4.0 blend in, pixel for pixel.
- With the classic seam, feeding the crop back unchanged reproduces the
original image exactly only when there is no resizing in either direction,
with Tone match at 0 and `fix_edge_halo` off. Resizing can lose detail even
when the crop comes back unchanged; the halo fix rewrites the feathered
band on purpose. Blend in does not promise this: it keeps the model's
version of the thin strip at your picture's edge.
original image exactly (with `fix_edge_halo` off; the fix rewrites the
feathered band on purpose). Blend in does not promise this: it keeps the
model's version of the thin strip at your picture's edge.
- A stitcher built from one image broadcasts over any number of inpainted
frames. A stitcher built from **more** frames than came back is trimmed to
the leading ones with a console note - video models keep 8n+1 (LTX) or
@@ -192,25 +153,9 @@ correction turns the corner without a crease.
The shift is subtracted from the pasted region before the blend. In the
padding that is the whole shift; inside the feathered band the paste
alpha scales it, which is exactly the share of each band pixel the
sampler painted. Source pixels stay bit-identical.
A Crop For Inpaint crop has no source rectangle, so it gets one shift for
the whole painted area. That shift is read inside the painted area, in the
32 pixels next to its edge: the same pixels before and after, taking the
middle value. Those 32 pixels are counted at the size the model painted, so
a large picture is read the same way and takes no longer. Most inpaint workflows let the model paint a little wider
than the paste, so the soft edge itself comes back close to your picture
and shows only a fraction of the drift. When the painted area holds
something new (less than half of that rim agrees, or the change is larger
than 20 LAB units, such as a black jacket over skin), it is not drift: the
old pixels in that place show something else. The new part is then
compared with your untouched picture right beside it, each side averaged
within 48 pixels of the seam. Where the two sides look alike (within 20
LAB units, on at least a quarter of the seam, such as new skin next to
skin), the gap between them is taken off. Where they do not, such as a
jacket next to skin, Tone match leaves that picture as painted. Before,
the soft edge was read there instead, and a model that repaints the edge
too could tint the whole patch: a yellow swimsuit over skin came back blue.
sampler painted. Source pixels stay bit-identical. A crop stitcher, which
has no source rectangle, gets a single global shift measured in its
blend band instead.
On a Crop + Rotate + Pad canvas the source rectangle is the crop, so it
can also hold the rotation's empty corners and any transparency. The
-61
View File
@@ -1,61 +0,0 @@
# Strength Curve
Draw how strong something should be over a run, from the first step to the
last, and wire the curve into a node that follows it step by step.
- **LoRA Loader 🆎**: wire the curve into its `curve` input and click the
curve mark on each row that should follow it. Fade a style LoRA out so
the fine detail at the end comes out clean, or bring a detail LoRA in
late.
- **Krea 2 Encode 🆎**: wire the curve into `reference_curve`. The picture
follows your reference as strongly as the curve says: hold the layout
early and let go late, or the other way round.
## Using it
1. Pick a preset (flat, fade out, fade in, ease out, ease in) or drag the
points. Double-click the curve box to add a point, right-click a point to
remove it.
2. Click a point to pick it, then type or scrub **Point at** (where in the
run, in %) and **value** for exact numbers.
3. Set **Top** (`high`) and **Bottom** (`low`): the strength at the top and
the bottom of the curve box. A fade from 1 to 0.3 is a fade out with
Bottom at 0.3.
Left is the start of the run, where the picture is still noise; right is
the end, where only fine detail changes. Hover the curve to read the value at
any point.
## Outputs
- **curve**: the strength over the run, as a list of numbers from start to
end (ComfyUI's `FLOATS` type).
## Tips
- On a LoRA row, the curve multiplies the row's own strength. A row at 0.8
with a fade out goes from 0.8 to 0.
- It works with every model file: full size, fp8, fp8 scaled and int8.
- A curve that moves makes each step a little slower (about 5% on Krea 2)
and needs no extra memory. A flat line costs nothing.
## Technical details
- The points are saved in the hidden `points` input as `[where, value]`
pairs from 0 to 1, so a workflow run through the API gives the same
curve with no editor open. The line between points is a monotone cubic
(Fritsch and Carlson), so it never swings past a point.
- The output is 101 values spread evenly from start to end, Bottom to Top.
It is the same reading ComfyUI's own **Create Hook Keyframes From
Floats** gives a list, so the curve also feeds ComfyUI's hook nodes, and a
list of numbers from another node feeds our inputs.
- Both nodes read "where in the run" the way ComfyUI's hook keyframes do:
ComfyUI's percent of the run, measured by noise level. With
the `simple` and `normal` schedulers that matches the step count; other
schedulers spend more steps at some noise levels. A second sampler that
carries on from the first (a refiner pass, a denoise below 1) reads only
the part of the curve it covers.
- LoRA Loader adds a following row to each layer's result as the layer
runs (ComfyUI's bypass mode), so the model's weights are never rewritten
and no second copy of them is kept. Krea 2 Encode scales the reference
inside attention.
-60
View File
@@ -1,60 +0,0 @@
# Text Lines
Runs what comes after once for each line of your text. Type five prompts,
one on each line, press Run once, and you get five pictures.
Use it for a list of prompts you typed, or for a list another node wrote,
such as a text model asked for "five different poses".
## How to use it
1. Type your lines in the box, or wire text into **text**.
2. Wire **line** to where one prompt would go, such as a text encoder's
prompt.
3. Run. Every node after it runs once for each line, and a Save Image at the
end saves one picture for each.
Empty lines are skipped. Models and pictures that do not depend on the line
are loaded once, not once for each line.
## Controls
- The text box (`text`): One line for each run.
- **Split at** (`split`): **each line** makes every line its own run.
**blank line** keeps lines together and starts the next run at an empty
line. Pick it when one prompt is several lines long.
- **Numbering** (`remove_numbering`): **remove** takes a number or bullet
off the start of each line, such as `1.`, `2)`, `-` or `[prompt 3]`.
Lists a text model writes usually have them. **keep** leaves every line
as written.
- **Limit** (`limit`): The most lines to run. 0 runs them all. Set it when
a text model might write more lines than you asked for.
## Outputs
- **line**: Each line, one at a time.
- **number**: The line's place in the list, starting at 1. Add it to a seed
with Math Expression (`a + b`) to give each line its own seed.
- **count**: How many lines run.
## Notes
- With no lines at all, the run stops at this node and says so.
- Every run uses the same seed unless you add **number** to it. Different
prompts still give different pictures.
- A line such as "2 women on a beach" or "1.5x zoom" keeps its number: only
a number followed by a period, bracket or colon counts as numbering.
## Technical details
**line** and **number** are ComfyUI lists (`OUTPUT_IS_LIST`), the same way
Image Folder hands out pictures. ComfyUI runs each later node once for each
item and keeps the results in order. A node that takes a whole list at once,
such as core Rebatch Images, gets all of them together.
Numbering that is removed: a number in square, round or CJK brackets with an
optional word before it (`[prompt 1]`, `(2)`), a word and a number followed by
a colon, period, bracket or dash (`Shot 3:`), a bare number followed by a
period, bracket or colon that has no digit right after it, and the bullets
`-`, `*` and `•` followed by a space. Only one marker is removed from each
line.
+9 -10
View File
@@ -11,22 +11,21 @@ generated-area `mask`, a `stitcher` for Stitch Inpaint, the selected
## Source and frame
- **Inputs**: Pick an input video (the list plays the clip under the pointer, muted, and filters as you type), click **Load** in the compact source card, or
- **Uploads**: Pick an input video (the list plays the clip under the pointer, muted, and filters as you type), click **Upload** in the compact source card, or
drop a video file onto the node. Picking another video keeps Fill, Feather,
**Align**, the Resize settings and the lit ratio button (the new frame is
**Divisible by**, the Resize settings and the lit ratio button (the new frame is
fitted to it the way **Fit** is set); rotation, crop, padding and the playhead
start over.
- **Load** streams to the input folder, so videos larger than the buffered image-upload limit can be selected here or dropped onto the node.
- **Inputs** / **Outputs** (`source_mode`: `input folder` / `local path`): the source card's switch. Inputs lists ComfyUI's input folder. Outputs lists the videos in ComfyUI's output folder, newest first, so a video you just rendered can be picked without uploading it again. Both lists preview the video under the pointer.
- **Canvas row** under the Fit row: fill swatch, feather amount and the Resize off | on switch on the node face; turning Resize on opens the megapixel budget and its Step. The line under the picture names each step that sets the output size, as on the image node.
- **Upload** streams to the input folder, so videos larger than the buffered image-upload limit can be selected here or dropped onto the node.
- **Uploads** / **Outputs** (`source_mode`: `input folder` / `local path`): the source card's switch. Uploads lists ComfyUI's input folder. Outputs lists the videos in ComfyUI's output folder, newest first, so a video you just rendered can be picked without uploading it again. Both lists preview the video under the pointer.
- **local_path**: The video picked in the Outputs list, named the way ComfyUI names a file
in its output folder: `clip.mp4 [output]`, `video/take 3.mov [output]`. It is read in
place, without an upload copy. A whole path such as `/home/me/ComfyUI/output/clip.mp4`
is not read, for queued runs and the editor's live preview alike.
- **Play / Pause** beside the scrubber previews the video. Pause on the frame you want to output.
- **Playhead**: The rail directly under the node's preview is the timeline: press or drag it to
- **Playhead**: The rail under the node's preview is the timeline: press or drag it to
scrub, or type a frame in the **FRAME** box; the frame on the stage is the frame the
node outputs (`frame_index`, with `frame_time` kept in step).
- **Crop, pad & resize** (collapsible group under the timeline): folds the ratio buttons, **Fit to ratio**, **Align** and **Center**, **Fill** and **Feather**, and the **Resize** off | on switch, megapixel budget and **Step** into one drawer, showing the fill swatch and a live summary on its header when closed. The line under the picture names each step that sets the output size, as on the image node.
- **seek_mode / frame_time**: Time-based seeking for graphs that drive the position by
link; the editor itself always works in frames.
@@ -34,19 +33,19 @@ The editor has the same rail full width, plus first/last, ±1, ±25, ±50, ±100
## Transform and outputs
Rotation, crop, padding, feathering, fill, **Align**, the megapixel resize, gestures, `image`, and `mask` match the image node. The output batch contains one frame.
Rotation, crop, padding, feathering, fill, **Divisible by**, the megapixel resize, gestures, `image`, and `mask` match the image node. The output batch contains one frame.
The handles work on both the node and the editor. Drag an orange corner to make
the canvas bigger or smaller in its own shape (hold **Alt**, Option on a Mac, to
change all four sides at once), and press **Center** next to Fill and Feather to
center the crop and balance any padding, side to side or top to bottom. Both work as on the
put the frame in the middle, side to side or top to bottom. Both work as on the
image node. The ratio buttons, **Fit**,
the padlock and the orientation button work as on the image node: a tap pads (or,
with Fit on crop, crops) the frame to a ratio, a lit ratio is the shape the canvas
has now, and the padlock keeps that shape while you drag (the row says **Held**).
**Reset crop** restores the full crop while keeping rotation and padding. **Reset**
clears rotation, crop and padding and turns the padlock off; fill, feather,
**Align** and the playhead stay. **Align** makes the width and
**Divisible by** and the playhead stay. **Divisible by** makes the width and
height divide evenly by the number you pick: padding grows by a few pixels, and
a side with no padding is trimmed by a few instead. Some models need sizes
divisible by 8, 16 or 32; 1 turns it off.
+59 -99
View File
@@ -9,105 +9,66 @@ fill-color bands around it for a **video outpaint**: the `mask` output marks the
bands (and rotation corners), ready for Crop For Inpaint or an in-context video
model that paints black regions.
## Clip window for App mode
In an App-mode form, this node can show a **clip window** instead of its whole
editor: the video, playing only the part that gets used on a loop, over a strip
of pictures from the video with a box over that part. Click the video to pause it. Drag
the box to pick where the clip starts; drag one of its edges to make it shorter
or longer. A line under it says what you picked, such as "8.0 s used, starting at
0:03". To put it in a form, list the field `clip_window` of this node, next to
its `video` field. On the graph the node looks the same as before: the clip
window only shows inside the form.
**Min seconds** and **max seconds** (`min_seconds`, `max_seconds`) keep the clip
inside a range, for example 5 to 8 seconds for a model that is only reliable
there. The edges stop at those lengths, in the form and on the node's own
timeline, and a run keeps to them too:
- a longer pick, or the whole video, is cut to the max;
- a shorter pick grows to the min, and where the video ends first the start
moves back instead;
- a video shorter than the min is used whole, with no error.
Set them in the **Clip length limits** fold, under Crop, pad & resize. It starts
closed; its header shows the limits (`5 – 8 s`, `from 5 s`, `up to 8 s`, or `off`).
Open it for **Shortest** and **Longest**. 0 means no limit, and both are 0 by
default, so older workflows run as before. Typing a Shortest above the Longest
moves the Longest up with it, and the other way round. An exact **Fixed frames**
count wins over them.
## Source and window
- **Inputs**: Pick an existing input video (the list plays the clip under the pointer, muted, and filters as you type), click **Load**, or drop a video file
- **Uploads**: Pick an existing input video (the list plays the clip under the pointer, muted, and filters as you type), click **Upload**, or drop a video file
onto the node. The old source widgets remain compatible with saved workflows, but
are now driven by this compact card. Choosing another video keeps the canvas
settings - Fill, Feather, **Align**, Resize, Every nth, Frames for, Duration - and
settings - Fill, Feather, **Divisible by**, Resize, Every nth, Frames for, Length - and
fits the new clip to the lit ratio button, the way **Fit** is set. Rotation, crop,
padding, the clip's timing and the playhead start over.
padding, IN/OUT and the playhead start over.
- **Canvas row** (under the Fit row): the fill swatch, the feather amount and
the Resize off | on switch, right on the node; turning Resize on opens the megapixel
budget and its **Step**. These are what a video outpaint model keys on - the LTX IC-LoRA paints
**pure black** at sizes rounded to 32 - so a wrong value shows here before a
render is wasted. Feather only softens the mask and the stitch; the frames always
meet the fill with a hard edge. The line under the picture names each step that
sets the size (`576×1024 → pad 1821×1024 → resize 1280×704`) and warns in amber
when the Step stretches the picture by more than 1% (`2.2% wider: each side rounds
to 32 px`); the tooltip names a Step that avoids it, and in pad mode **Even out**
adds a few pixels of padding so nothing stretches. While you drag, that amber
line keeps still and comes back for the new size when you let go. The bands are drawn in the real
fill colour with a faint hatch, so black bands show on the black stage. A fresh clip node starts
with black and feather 0 and the editor's **Reset transform** returns to them;
the image nodes keep their grey fill and feathered mask.
- **Outputs** (`source_mode` / `local_path`): Pick a video from ComfyUI's output folder,
such as one you just rendered. The list shows the newest first and previews the video
under the pointer. The video is read in place, without an upload copy. In an API prompt
it is named the way ComfyUI names a file there: `clip.mp4 [output]`. A whole path such
as `/home/me/ComfyUI/output/clip.mp4` is not read, for queued runs and the editor's live
preview alike.
- **Play / Pause** beside the timeline plays the clip from its start and stops at its end. Pause and Play again to carry on from where you stopped.
- **Timeline** (right under the picture): Press or drag anywhere on it to look at
another frame; the picture shows it. Point at the bar to see where you are, the
clip in words and the source's frame rate. Drag the **start** handle to move the
clip (its Duration stays), and the **end** handle to change the Duration. The
start stops where the whole Duration still fits, and a short note says so.
**Use as start** starts the clip at the frame on the picture.
- **Start / Duration / Ends at**: the clip in three boxes. Start and Ends at are
places in the source video; Duration is how long the clip is. Type any of them,
or drag over a box to scrub it. The small **s | fr** switch shows them in seconds
or frames: Start and Ends at count source frames, Duration counts the frames the
clip sends on, at the output rate. Point at a box for the other unit and what it
covers. Typing a Start that leaves too little video is allowed: an amber note says
how many frames still fit and offers to shorten the clip or move the start.
- **Linked timing**: when another node feeds `start_frame`, `end_frame`,
`frame_load_cap` or `fixed_frames`, that box is locked and its label shows a small
**linked** button that jumps to the node. `fixed_frames` is an exact count;
`frame_load_cap` is only a limit, so when the video ends first the note says how
many frames you get. A count only worked out when the graph runs (a Math
Expression, say) shows as **at run time**, and the timeline shows striped room
after the start instead of a clip. A rate typed inside a subgraph counts as known.
- **Technical details**: `start_seconds` / `end_seconds` are derived from the frames
(the end is exclusive, 0 means the end of the source), and the Duration is stored
as `max_frames`. Arrow keys on a handle move one second, Shift one frame. With
Every nth or Frames for the end steps to the frames the run keeps, and a dim tail
marks frames the window holds but the run drops.
In the editor, **Set IN** / **Set OUT** (or the **I** / **O** keys) put a
trim point at the playhead, and **Whole video** resets the clip. The editor also
- **Timeline**: The rail on the node and in the editor is one timeline. Press or
drag anywhere on it to scrub the **playhead**, with Length on or off; the stage shows
that frame. Drag the **IN** or **OUT** handle to trim: the playhead rides on the handle, so what you see
is the first (IN) or last (OUT) frame the run keeps, and it stays there when you let
go. IN and OUT are frames, snapped to the source's frame grid; the boxes under the
rail take a frame number, and `start_seconds` / `end_seconds` are derived from them
(OUT is exclusive, 0 means the end of the source). Arrow keys on a handle move one
second, Shift one frame. **OUT always sits on the last frame the run outputs**, so
the handle and the bright bar end together; with Every nth or Frames for it steps to the
frames the run keeps, and a dim tail marks frames the window holds but the run
drops. In the editor, **Set IN** / **Set OUT** (or the **I** / **O** keys) put a
trim point at the playhead, and **Full clip** resets the window. The editor also
has buttons for the first and last frame, steps of 1, 25, 50 and 100 frames, and
**Play**. Arrow keys step one frame (10 with Shift), Home and End jump to the
ends, and Space plays or pauses. **Save & close** keeps your edits; **Cancel** or
Escape puts everything back, and asks first if anything changed.
- **Crop, pad & resize** (collapsible group under the timeline): folds the ratio
buttons, **Fit to ratio**, **Align** and **Center**, **Fill** and **Feather**, and
the **Resize** switch, megapixel budget and **Step** into one drawer. While closed,
its header bar shows the fill colour swatch and a live summary of the active
ratio, feather, alignment and resize settings. These are what a video outpaint model keys on - the LTX IC-LoRA paints
**pure black** at sizes rounded to 32 - so a wrong value shows here before a
render is wasted. Feather only softens the mask and the stitch; the frames always
meet the fill with a hard edge. The line under the picture names each step that
sets the size (`576×1024 → pad 1821×1024 → resize 1280×704`) and warns in amber
when the Step stretches the picture by more than 1% (`Resize makes the picture 2.2% wider`); the tooltip names a Step that avoids it, and in pad mode **Pad to keep shape**
adds a few pixels of padding so nothing stretches. While you drag, that amber
line keeps still and comes back for the new size when you let go. The bands are drawn in the real
fill colour with a faint hatch, so black bands show on the black stage. A fresh clip node starts
with black and feather 0 and the editor's **Reset transform** returns to them;
the image nodes keep their grey fill and feathered mask.
- **Whole video / To start** (bottom right of the timing card): **Whole video**
uses the whole source, with no Duration limit. When the length is linked, the
button reads **To start** and moves the start to the beginning instead. The
Duration stays when you swap the video, so a workflow built for 97 frames keeps
taking 97.
- **Length** (`max_frames`): the one other way to set how long the clip is. **Off**
(the default): OUT ends the clip. **On**: a number of output frames from IN; OUT
sits that many frames after IN and follows it when you drag IN, and dragging OUT or
typing the number changes the Length. To move the whole clip, drag IN or the small
grip in the middle of the kept part (the grip also slides a trimmed window with
Length off). When the Length is the whole clip there is nowhere to move it, and the
row says so: "= the whole clip. Shorten it to move IN." The Length stays when you
swap the video, so a workflow built for 97 frames keeps taking 97. Turning it on or
off never moves anything: the count becomes the OUT, or the OUT the count. If the
source ends first, the footer says how many frames are left. **To start** moves IN
to the start of the source.
- **Every nth** (`every_nth`): Thin the batch. The `fps` output divides to match
every_nth, so the clip keeps real-time downstream; a Duration counts the frames kept.
every_nth, so the clip keeps real-time downstream; a Length counts the frames kept.
- **Frames for** (`frame_snap`): Keep a frame count a video model takes:
**LTX (8n+1)** (49, 97, 121) or **Wan (4n+1)**. **any** keeps every frame in the window.
Dragging the end and typing a Duration step through those counts.
OUT drags and the Length step through those counts.
With it on, `frame_count`, `duration`, the audio window and the stitcher all match the
clip the sampler hands back, so wiring `frame_count` into the empty latent's length
never leaves the stitch with more source frames than generated ones.
@@ -119,8 +80,8 @@ Crop squares, padding diamonds, the orange corners and the rotation handle also
work directly on the node preview. A corner makes the canvas bigger or smaller in
its own shape, for example to zoom out evenly before a video outpaint; hold **Alt**
(Option on a Mac) to change all four sides at once. **Center**, next to Fill and
Feather, centers the crop on the source and balances any padding on the selected axis.
The generated mask follows the crop and padding. The graph still owns wheel zoom and middle-button
Feather, puts the clip in the middle of the canvas side to side or top to bottom
without changing the canvas size. The graph still owns wheel zoom and middle-button
pan. Tap a ratio
to pad the clip to it (or crop it, with **Fit** on crop); tap the lit ratio again to
go back to the whole frame. A lit ratio is the shape the canvas has now: drag a
@@ -131,31 +92,31 @@ ratio or turn it"); otherwise it names the lit ratio where it acted (`pad to 16:
1821×1024`). The padlock keeps the shape while
you drag, with new bands split evenly, and the row says **Held**; Reset and tapping
the lit ratio turn it off, and it does nothing on the untouched clip. **Fit** is
ready to set before picking a ratio. The orientation button turns the shape on its side
dimmed until a ratio is lit. The orientation button turns the shape on its side
(16:9 to 9:16), and dragging the picture itself moves it inside its padding: the
cursor and small arrows show which ways it can go.
**Reset crop** restores the full crop without changing rotation, padding or trim;
with the padlock on it also takes away the bands the lock added.
**Reset** on the node clears rotation, crop and padding and turns the padlock off;
fill, feather, **Align** and the timeline stay.
fill, feather, **Divisible by** and the timeline stay.
**Reset transform** in the editor resets rotation, crop, padding, fill, feather and
**Align**; it keeps the source, current frame, trim, Duration, resize and stitch
settings. **Align** makes the width and height divide evenly by the number
**Divisible by**; it keeps the source, current frame, trim, Length, resize and stitch
settings. **Divisible by** makes the width and height divide evenly by the number
you pick: padding grows by a few pixels, and a side with no padding is trimmed by
a few instead. Some models need sizes divisible by 8, 16 or 32; 1 turns it off.
The **Load** button and file drop use a streaming route into ComfyUI's input folder,
Video Upload and file drop use a streaming route into ComfyUI's input folder,
so the buffered image-upload size limit does not prevent long-video uploads.
The editor's sidebar uses the node's own ratio row, padlock and **Fit** switch, and
the rotation is a number box (Shift for 0.1°). A ratio replaces the old crop and
padding, keeping rotation and resize settings.
Pixel rounding can differ by one pixel between opposite bands. **Align** and
Pixel rounding can differ by one pixel between opposite bands. **Divisible by** and
the resize **Step** can slightly change the final aspect ratio.
## Transform and outputs
Rotation, crop, padding, feathering, fill, **Align**, and the editor's handles
Rotation, crop, padding, feathering, fill, **Divisible by**, and the editor's handles
match the image node. **Resize output** in the editor scales the finished frames to a
megapixel budget with a resolution step (32 keeps LTX and Wan sizes), the same trio as
the core Scale Image to Total Pixels node. The frames are resized by themselves and the
@@ -192,17 +153,16 @@ The node performs no remote network requests and does not rewrite the source vid
## Connected timing inputs
Optional timing inputs:
Five optional sockets sit on the left, above the editor:
| Input | Meaning |
| --- | --- |
| `force_rate` | Sample at this fps before Every nth. 0 keeps the source rate. Drops or repeats frames to keep playback speed. Accepts FLOAT or INT. |
| `start_frame` | Zero-based source start frame. Overrides timeline IN. |
| `end_frame` | Exclusive source end frame. 0 means the end of the source. Overrides timeline OUT. |
| `fixed_frames` | Exact output frames from IN; the source must be long enough. Connected, it sets the length: Duration, Ends at and Frames for step aside. |
| `frame_load_cap` | Maximum frames after rate conversion and Every nth, before Frames for. 0 means unlimited. Connected, it sets the length in place of Duration. When the count is known, dragging the start stops at the last start that fits the kept frames. |
| `fixed_frames` | Exact output frames from IN; the source must be long enough. Connected, it sets the length: OUT, Length and Frames for step aside. |
| `frame_load_cap` | Maximum frames after rate conversion and Every nth, before Frames for. 0 means unlimited. Connected, it sets the length in place of Length. |
| `last_seconds` | Load only this many seconds from the end of the clip, or of the part before OUT. 0 loads all of it. Use it to carry on from a clip: a long clip then costs no more memory than a short one. |
| `min_seconds` / `max_seconds` | The shortest and longest the clip may be, in seconds; 0 is no limit. Applied after the window is worked out, so the start, Duration and the other inputs set the clip and these keep its length in range (see Clip window for App mode). |
Frame bounds use the source's frame-rate grid, independent of `force_rate`.
The footer labels **Source fps** separately from **Output fps**. A direct
@@ -215,17 +175,17 @@ For example, start 24 and end 72 select two seconds from a 24 fps source.
A 12 fps forced rate returns 24 frames; a cap of 10 then keeps only the first
10 of those. Audio and duration follow the returned batch.
A connected start or end locks that handle and its box on both
A connected start or end locks that handle and its IN/OUT field on both
the node and fullscreen editor. Hover to see why. Disconnect to restore
local control. While timing inputs are connected, the preview shows the local
trim as a reference and avoids claiming an output count before the linked
values are evaluated at run time.
**A connected length input takes over the length.** Connect a count to
`fixed_frames` (exact) or `frame_load_cap` (at most) and the end handle goes
away, Duration and Ends at lock, and only Start is left to set: the clip starts
there and the input decides where it ends. Literal Integer/Float nodes (including
`fixed_frames` (exact) or `frame_load_cap` (at most) and the OUT handle goes
away, OUT and Length grey out, and only IN is left to set: the clip starts at
IN and the input decides where it ends. Literal Integer/Float nodes (including
AusBoss cards and reroutes) show the resulting frames on the rail before
running; calculated counts show "at run time". An older workflow that saved a
Fixed frames number without a connection reads as a Duration; the first change
Fixed frames number without a connection reads as a Length; the first change
here turns it into one.
+4 -35
View File
@@ -18,37 +18,14 @@ Nothing runs: the node has no outputs, so ComfyUI never executes it.
- **Title / Subtitle / Author** make the banner. **Layout → Banner** shows
only that top block (the title, plus the subtitle and author if you filled
them in), so the same node doubles as a label for a stage or column.
- **Layout → Info tile** puts a single button on the canvas. Click the tile to read the full note, including models and links. A book marks a guide and a download arrow marks a model list. Click its pencil to edit, or press **Edit** inside the opened note. Drag the visible bottom-right grip to resize the tile without moving it. Focus the grip and use arrow keys for keyboard resizing; **Shift** makes smaller changes.
- **Accent color** tints the banner bar, dots and buttons; empty keeps the
pack teal. It takes a six-digit hex such as `#00b4aa`.
- **How-to** is Markdown-lite: `#`/`##`/`###` headings, `**bold**`,
`*italic*`, `` `code` ``, `[links](https://…)`, `-` and `1.` lists, `---`
rules, fenced code. Only `http(s)` links become clickable.
## Formatting a how-to
Select a phrase in the How-to field and click **Teal**, **Green**, **Amber** or **Glow**. Click **Table** to insert an editable Markdown table. Open **Preview formatting** while you write. Use headings to break up steps and a pipe table for settings or file locations. Keep each row the same length. Use `\|` for a literal pipe inside a cell.
```markdown
## Choose a size
| Size | When to use it |
| --- | --- |
| 480 × 864 | [teal]First run[/teal] |
| 576 × 1024 | A larger portrait |
[green]Ready[/green] means the model was found.
[amber]Missing[/amber] means you still need the file.
```
For a short highlight, write `[glow]Preview the result[/glow]`. The glow is static. These four tags are AusBoss additions to Markdown. They style the enclosed plain text. Headings, lists, table cells and paragraphs can all contain them. Fenced code displays the original characters.
## Models
To give downloads their own button, choose **Layout → Info tile**, set the title to **Download models**, and add files under **Models**. To keep them with your instructions, add those same rows to the **How to use** note. Switching an existing card to an info tile keeps its model rows and links.
[Download the Krea 2 model tile example](https://raw.githubusercontent.com/ausboss/ComfyUI-AusBoss/main/js/docs/examples/model-download-tile.json) and open it as a workflow. Copy the tile into your graph and edit its rows.
Each row is a file, the model folder it belongs in, an optional size, a
download URL, and an optional note that shows in grey under the file name.
Rows group under a `📂 ComfyUI/models/<folder>` heading so the
@@ -60,20 +37,12 @@ answered on the same line as the button.
- A found file swaps its Download button for an **✓ installed** pill; hovering
the pill shows where it was found. A file that lives in a subfolder still
counts. When a loader in the workflow still asks for the bare file name,
which ComfyUI cannot find there (it marks that loader red), the note points
that loader at your copy by itself and says so in a short message. If you
have two copies in different subfolders, the row says where one is
(**in LTXV 2.3/**) and **Use it** picks it. To always choose yourself, turn
off Settings, 🆎 AusBoss, Models, **Pick found files**. The check only asks
the ComfyUI server for its own model lists.
which ComfyUI cannot find there (it marks that loader red), the row says
where the file is instead (**in LTXV 2.3/**) and **Use it** points those
loaders at the copy it found. The check only asks the ComfyUI server for its
own model lists.
- **↻ check files** re-runs the check after you move files in. ComfyUI's own
**R** refresh triggers it as well.
- Launchers such as Stability Matrix keep models in shared folders of their
own, for example `Data/Models/Lora`. Files there count, and the card names
such a folder under the usual heading ("also read from ..."), so you can
see where your files are found and put new ones there. The old folder
names `clip` and `unet` are checked as `text_encoders` and
`diffusion_models`, the names ComfyUI uses for them.
- Folder `input` is for a sample image or clip shipped with the workflow: it
is looked for in `ComfyUI/input`.
- Clicking a file name copies it — handy for searching a loader's picker.
@@ -1,7 +0,0 @@
# Workflow Note Tile
A compact help button that opens a full note. Click to read the instructions and model links; click the pencil to edit. Drag its visible corner to resize.
It uses the same note content as [Workflow Note](AUSBOSS_NODES_WorkflowNote.md). Choose **Card** or **Banner** in the editor to show the note directly on the canvas. Nothing runs and it has no outputs.
Tiles save with their own node type. If ComfyUI reports this node missing, install or update **ComfyUI-AusBoss**, restart ComfyUI, and reload the workflow. An older pack cannot draw the tile correctly. Keep the missing node so its instructions and settings are preserved.
+4 -5
View File
@@ -14,8 +14,8 @@ an upscale at the end.
2. Press **+ Switch from 2 selected** on the card.
3. Type a name and press Enter.
Click **off** to skip every node you picked, or **on** to run them again.
Clicking the selected half leaves it selected.
One click on its pill now turns every node you picked off, and the next click
turns them on again.
Groups work too. Every group on the canvas gets a switch of its own, unless
you change that under **Settings**. A group can also be part of a switch you
@@ -160,9 +160,8 @@ the models only that part needs.
## The edit view
- **off | on**: click **off** to turn off every node of the row, or **on** to
set them all to run. Clicking the selected half leaves it selected. A change
is one undo step.
- **off | on**: click anywhere on the pill to flip the switch. Off turns off
every node of the row, on sets them all to run. It is one undo step.
- **Mixed**: when only some of a row's nodes run (one bypassed by hand, say)
the pill is striped and a count shows how many run, such as **1/2**. Click
the half you want, off or on, to set them all. A settings switch reads **changed** when one of
-28
View File
@@ -17,7 +17,6 @@ help panel.
| Pick a picture size by shape and megapixels, in place of Empty Latent | Latent Size (`AUSBOSS_NODES_Resolution`) |
| Resize a picture, or snap its size to a multiple | Image Resize (`AUSBOSS_NODES_ImageResize`), Align Image (`AUSBOSS_NODES_AlignImage`) |
| Read a picture's width and height | Image Size (`AUSBOSS_NODES_ImageSize`) |
| Load a picture and set its size or crop it (megapixels, longest side, a box, a ratio) in one node | Load Image (`AUSBOSS_NODES_LoadImage`) |
| Outpaint: load a picture and add empty space around it | Load Image + Pad (`AUSBOSS_NODES_LoadImagePad`) |
| Turn, crop and pad a picture in one node | Image Crop + Rotate + Pad (`AUSBOSS_NODES_ImageCropRotatePad`) |
| Inpaint only the masked part, then put it back | Crop For Inpaint (`AUSBOSS_NODES_CropForInpaint`) then Stitch Inpaint (`AUSBOSS_NODES_StitchInpaint`) |
@@ -25,38 +24,25 @@ help panel.
| Get a mask by typing what to find | Mask by Name (`AUSBOSS_NODES_MaskByName`) |
| Get a mask by clicking the thing | Mask by Touch (`AUSBOSS_NODES_MaskByTouch`) |
| Grow, shrink, fill or smooth a mask | Mask Refine (`AUSBOSS_NODES_RefineMask`) |
| Keep the untouched parts of a picture exactly as they were while an edit model edits it | Edit Lock (`AUSBOSS_NODES_EditLock`) then Edit Lock Restore (`AUSBOSS_NODES_EditLockRestore`) |
| Line an edited picture back up with the original | Realign to Source (`AUSBOSS_NODES_RealignToSource`, experimental) |
| Match one picture's colors to another | Color Match (`AUSBOSS_NODES_ColorMatch`) |
| Add film grain to a picture or a video, or copy another picture's grain | Film Grain (`AUSBOSS_NODES_FilmGrain`) |
| Turn a picture and a mask into a transparent cut-out with clean edges | Cut Out (`AUSBOSS_NODES_CutOut`) |
| Put the original's fine detail back on a smoothed edit | Keep Detail (`AUSBOSS_NODES_KeepDetail`) |
| Upscale big pictures in tiles | Tiled Upscale (`AUSBOSS_NODES_TiledUpscale`) then Tiled Upscale Stitch (`AUSBOSS_NODES_TiledUpscaleStitch`) |
| Compare two pictures | Image Compare A/B (`AUSBOSS_NODES_Compare`) |
| Save pictures (PNG, lossless WebP or JPEG XL) | Save Image (`AUSBOSS_NODES_SaveImage`) |
| Run a workflow on each picture in a folder | Image Folder (`AUSBOSS_NODES_ImageFolder`) |
| Apply a stack of LoRAs | LoRA Loader (`AUSBOSS_NODES_LoraLoader`) |
| Change a LoRA row's or a Krea 2 reference's strength over the steps of a run | Strength Curve (`AUSBOSS_NODES_StrengthCurve`) into LoRA Loader's `curve` or Krea 2 Encode's `reference_curve` |
| Write a MiniMax H3 or Pika H3 Flex prompt from plain words | H3 Prompt Writer (`AUSBOSS_NODES_H3PromptWriter`): [node help](../AUSBOSS_NODES_H3PromptWriter.md) |
| Krea 2 prompt, and Krea 2 outpainting | Krea 2 Encode (`AUSBOSS_NODES_Krea2Encode`), Krea 2 Outpaint Model Patch (`AUSBOSS_NODES_Krea2OutpaintModelPatch`) |
| Load or save a video | Load Video (`AUSBOSS_NODES_LoadVideo`), Save Video (`AUSBOSS_NODES_SaveVideo`) |
| Load a sound file and keep only part of it, up to a set length | Load Audio (`AUSBOSS_NODES_LoadAudio`) |
| Turn, crop and pad a video: one frame, or the whole clip | Video Crop + Rotate + Pad → Frame (`AUSBOSS_NODES_VideoCropRotatePad`), → Clip (`AUSBOSS_NODES_VideoCropRotatePadClip`) |
| Change a clip's frame rate | Frame Interpolate (`AUSBOSS_NODES_FrameInterpolate`) |
| Make a clip larger and sharper | FlashVSR Upscale (`AUSBOSS_NODES_FlashVSRUpscale`) |
| Work with frame batches | Select Frame, Select Every Nth, Split Batch, Merge Batches (`AUSBOSS_NODES_SelectFrame`, `_SelectEveryNth`, `_SplitBatch`, `_MergeBatches`) |
| Run a workflow once for each line of text, such as a list of prompts | Text Lines (`AUSBOSS_NODES_TextLines`) |
| One shared seed, number or text | Seed, Integer, Float, Text (`AUSBOSS_NODES_Seed`, `_Integer`, `_Float`, `_Text`) |
| A prompt that picks from `{a\|b\|c}` choices on each run, by seed | Prompt Variations (`AUSBOSS_NODES_PromptVariations`) |
| Do maths on numbers | Math Expression (`AUSBOSS_NODES_MathExpression`) |
| Show text on the node, or the picture while it is made | Show Text (`AUSBOSS_NODES_ShowText`), Step Preview (`AUSBOSS_NODES_StepPreview`) |
| Stop a run after the 3D viewer to frame the shot on the new model, with a 360 behind it | Pause for Shot (`AUSBOSS_NODES_PauseShot`): [node help](../AUSBOSS_NODES_PauseShot.md) |
| Line a 3D model (Pixal3D) up with the photo: the photo's camera for the viewer, the crop's lens, the photo's place on a 360 | Photo Camera (`AUSBOSS_NODES_PhotoCamera`): [node help](../AUSBOSS_NODES_PhotoCamera.md) |
| Free graphics memory between steps | Free Memory (`AUSBOSS_NODES_FreeMemory`) |
| Time the whole run | Run Timer (`AUSBOSS_NODES_RunTimer`) |
| Turn parts of a workflow off and on | Workflow Switches (`AUSBOSS_NODES_WorkflowSwitches`): [its own agent guide](workflow_switches.md) |
| Explain a shared workflow on the canvas | Workflow Note (`AUSBOSS_NODES_WorkflowNote`), Callout (`AUSBOSS_NODES_Callout`) |
| Add compact help or colored link buttons | Workflow Note Tile (`AUSBOSS_NODES_WorkflowNoteTile`), Callout Tile (`AUSBOSS_NODES_CalloutTile`) |
| Lay out boxes of things and words on a canvas | Layout Boxes (`AUSBOSS_NODES_LayoutBoxes`) |
Every node's display name ends in 🆎 and sits under `🆎 AusBoss/<group>` in
@@ -76,20 +62,6 @@ the `AUSBOSS_NODES_...` key above.
- **Media loaders start blank** in the example workflows. Put in the file the
person wants to use before you queue.
## H3 swaps and clip duration
For a swap, keep the target selector on its own line. An optional separate line,
`@1 looks like a woman with blonde hair and a black hoodie.`, describes the
connected replacement person in Picture 1; use its actual picture number. This
can help express appearance but does not guarantee identity. Do not add it to
other jobs. Existing scripts without it keep their previous behavior.
An active video sets the duration for **swap the person**, **change something**
and **new voice**. The card says **From the clip** and hides numeric timeline
retiming; trim or limit the upstream clip instead. Do not infer the final frame
count from raw source metadata: upstream processing and H3 frame rounding apply.
Other jobs and video OFF still use **Length** normally.
## Example workflows
`example_workflows/` in this pack holds complete workflows, each with a
-51
View File
@@ -1,51 +0,0 @@
{
"id": "27945e9e-3e7b-49c5-bcb7-434d5de9e689",
"revision": 0,
"last_node_id": 1,
"last_link_id": 0,
"nodes": [
{
"id": 1,
"type": "AUSBOSS_NODES_WorkflowNoteTile",
"pos": [
0,
0
],
"size": [
300,
88
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [],
"title": "Download models",
"properties": {
"Node name for S&R": "AUSBOSS_NODES_WorkflowNoteTile"
},
"widgets_values": [
"{\"v\": 1, \"title\": \"Download models\", \"subtitle\": \"Krea 2 Outpaint\", \"author\": \"\", \"layout\": \"tile\", \"accent\": \"\", \"body\": \"Get the four files below and put each one in its listed folder. Click **check files** after adding them.\", \"models\": [{\"name\": \"krea2_turbo_fp8_scaled.safetensors\", \"dir\": \"diffusion_models\", \"size\": \"13.1 GB\", \"url\": \"https://huggingface.co/Comfy-Org/Krea-2/resolve/main/diffusion_models/krea2_turbo_fp8_scaled.safetensors\", \"note\": \"\"}, {\"name\": \"qwen3vl_4b_fp8_scaled.safetensors\", \"dir\": \"text_encoders\", \"size\": \"5.2 GB\", \"url\": \"https://huggingface.co/Comfy-Org/Krea-2/resolve/main/text_encoders/qwen3vl_4b_fp8_scaled.safetensors\", \"note\": \"\"}, {\"name\": \"qwen_image_vae.safetensors\", \"dir\": \"vae\", \"size\": \"254 MB\", \"url\": \"https://huggingface.co/Comfy-Org/Krea-2/resolve/main/vae/qwen_image_vae.safetensors\", \"note\": \"\"}, {\"name\": \"krea2_anypaint_rank32.safetensors\", \"dir\": \"loras\", \"size\": \"229 MB\", \"url\": \"https://huggingface.co/yijunwang2/krea2-anypaint/resolve/main/krea2_anypaint_rank32.safetensors\", \"note\": \"by yijunwang2\"}], \"packs\": [], \"links\": []}"
],
"widgets_values_named": {
"note": "{\"v\": 1, \"title\": \"Download models\", \"subtitle\": \"Krea 2 Outpaint\", \"author\": \"\", \"layout\": \"tile\", \"accent\": \"\", \"body\": \"Get the four files below and put each one in its listed folder. Click **check files** after adding them.\", \"models\": [{\"name\": \"krea2_turbo_fp8_scaled.safetensors\", \"dir\": \"diffusion_models\", \"size\": \"13.1 GB\", \"url\": \"https://huggingface.co/Comfy-Org/Krea-2/resolve/main/diffusion_models/krea2_turbo_fp8_scaled.safetensors\", \"note\": \"\"}, {\"name\": \"qwen3vl_4b_fp8_scaled.safetensors\", \"dir\": \"text_encoders\", \"size\": \"5.2 GB\", \"url\": \"https://huggingface.co/Comfy-Org/Krea-2/resolve/main/text_encoders/qwen3vl_4b_fp8_scaled.safetensors\", \"note\": \"\"}, {\"name\": \"qwen_image_vae.safetensors\", \"dir\": \"vae\", \"size\": \"254 MB\", \"url\": \"https://huggingface.co/Comfy-Org/Krea-2/resolve/main/vae/qwen_image_vae.safetensors\", \"note\": \"\"}, {\"name\": \"krea2_anypaint_rank32.safetensors\", \"dir\": \"loras\", \"size\": \"229 MB\", \"url\": \"https://huggingface.co/yijunwang2/krea2-anypaint/resolve/main/krea2_anypaint_rank32.safetensors\", \"note\": \"by yijunwang2\"}], \"packs\": [], \"links\": []}"
},
"color": "#14424d",
"bgcolor": "#161f21"
}
],
"links": [],
"groups": [],
"config": {},
"extra": {
"ds": {
"scale": 0.9,
"offset": [
150,
115
]
},
"frontendVersion": "1.53.6"
},
"version": 0.4
}
+1 -1
View File
@@ -1,4 +1,4 @@
import { app } from "../../../scripts/app.js";
import { app } from "/scripts/app.js";
import { showToast } from "../shared/index.mjs";
import { openTransformEditorForNode } from "../shared/transform_editor.mjs";
+1 -1
View File
@@ -6,7 +6,7 @@
// hand-over waits one microtask, so the frontend has rebuilt the whole graph
// before any panel moves.
import { app } from "../../../scripts/app.js";
import { app } from "/scripts/app.js";
import { chainCallback, isAusbossNode } from "../shared/index.mjs";
import { createFaceHandover } from "../shared/face_handover.mjs";
-68
View File
@@ -1,68 +0,0 @@
// Film Grain's Auto, on the node's face: keeps what Auto picks for the
// picture on hand up to date for the card's "= 0.27" notes
// (js/shared/grain_auto.mjs).
import { api } from "../../../scripts/api.js";
import { app } from "../../../scripts/app.js";
import { chainCallback } from "../shared/index.mjs";
import { isForeignRun } from "../shared/prompt_scope.mjs";
import { keepMatch, matchFromRun, refreshAuto } from "../shared/grain_auto.mjs";
import { outputLocatorId, sourceFileWidget, upstreamNode } from "../shared/input_preview.mjs";
const NODE_CLASS = "AUSBOSS_NODES_FilmGrain";
const viewUrl = (query) => api.apiURL(`/view?${query}`);
// One hook on a Load Image's file box, with every Film Grain it feeds listed
// under it, so a picked file refreshes them all and a removed node leaves.
// Both pictures are watched: the one getting grain, and grain_from's.
const watched = new WeakMap();
const WATCHED_INPUTS = ["image", "grain_from"];
function unwatch(node) {
for (const entry of node.__ausbossGrainWatch ?? []) entry.nodes.delete(node);
node.__ausbossGrainWatch = [];
}
function watchFile(node) {
const widgets = WATCHED_INPUTS.map((name) => sourceFileWidget(upstreamNode(node, name))).filter(Boolean);
const now = node.__ausbossGrainWatch ?? [];
if (now.length === widgets.length && now.every((entry, i) => entry.widget === widgets[i])) return;
unwatch(node);
for (const widget of widgets) {
let entry = watched.get(widget);
if (!entry) {
const nodes = new Set();
entry = { widget, nodes };
chainCallback(widget, "callback", () => { for (const item of nodes) update(item); });
watched.set(widget, entry);
}
entry.nodes.add(node);
node.__ausbossGrainWatch.push(entry);
}
}
function update(node) {
if (!node?.graph) return;
watchFile(node);
const record = app.nodeOutputs?.[outputLocatorId(node)] ?? null;
refreshAuto(node, { viewUrl, record });
}
const later = (node) => queueMicrotask(() => update(node));
app.registerExtension({
name: "ausboss.film_grain",
beforeRegisterNodeDef(nodeType, nodeData) {
if (nodeData?.name !== NODE_CLASS) return;
chainCallback(nodeType.prototype, "onNodeCreated", function () { later(this); });
chainCallback(nodeType.prototype, "onConfigure", function () { later(this); });
chainCallback(nodeType.prototype, "onConnectionsChange", function () { later(this); });
chainCallback(nodeType.prototype, "onExecuted", function (output) {
if (isForeignRun()) return;
keepMatch(this, matchFromRun(output));
later(this);
});
chainCallback(nodeType.prototype, "onRemoved", function () { unwatch(this); });
},
// A reopened workflow restores every node's last output at once.
onNodeOutputsUpdated() {
for (const node of app.graph?._nodes ?? []) if (node.type === NODE_CLASS) later(node);
},
});
-177
View File
@@ -1,177 +0,0 @@
// H3 Prompt Writer 🆎 draws only the sockets in use.
//
// The node keeps every socket in its lists: a wire is saved by its socket's
// number, so taking one out would send the wrong output. A socket that is
// not in use is only left out of the drawing. The rule is in
// js/shared/h3_sockets.mjs.
//
// classic a hidden socket gets a position of its own, which takes it
// out of the stacked rows, and draws nothing.
// Nodes 2.0 one style rule hides the socket's row by its data-slot-key.
//
// If either lever is missing in the running frontend, every socket shows,
// as it always did.
import { app } from "../../../scripts/app.js";
import { chainCallback } from "../shared/index.mjs";
import { lookupLink } from "../shared/graph_links.mjs";
import { SHOW_ALL, dropTarget, hiddenRowsRule, setSocketHidden, socketsToShow } from "../shared/h3_sockets.mjs";
const NODE_CLASS = "AUSBOSS_NODES_H3PromptWriter";
const STYLE_ID = "ausboss-h3-sockets";
const showAll = () => Boolean(app.extensionManager?.setting?.get?.(SHOW_ALL));
let warned = false;
// Nothing here may stop a node from loading: on a throw the sockets show.
function safely(run) {
return function (...args) {
try { return run.apply(this, args); } catch (error) {
if (!warned) console.warn("[AusBoss] H3 Prompt Writer shows every socket:", error);
warned = true;
}
};
}
const plainInputs = (node) => (node.inputs ?? []).filter((slot) => !slot.widget);
const outputWired = (slot) => (slot.links?.length ?? 0) > 0;
const shownRows = (node) => Math.max(
plainInputs(node).filter((slot) => !slot._ausbossHidden).length,
(node.outputs ?? []).filter((slot) => !slot._ausbossHidden).length,
1,
);
const hiddenRows = (node) => Math.max(plainInputs(node).length, (node.outputs ?? []).length, 1) - shownRows(node);
const rowHeight = () => globalThis.LiteGraph?.NODE_SLOT_HEIGHT ?? 20;
function writerNodes(graph = app.graph, found = []) {
for (const node of graph?._nodes ?? []) {
if (node.type === NODE_CLASS) found.push(node);
if (node.subgraph) writerNodes(node.subgraph, found);
}
return found;
}
// Nodes 2.0 draws a row for every socket of the list. One style sheet for
// the page holds each node's hidden rows.
function writeStyleRules() {
const rules = writerNodes().map((node) => node._ausbossSocketRule ?? "").filter(Boolean).join("\n");
let sheet = document.getElementById(STYLE_ID);
if (!sheet && !rules) return;
sheet ??= document.head.appendChild(Object.assign(document.createElement("style"), { id: STYLE_ID }));
if (sheet.textContent !== rules) sheet.textContent = rules;
}
export function applySockets(node) {
if (!node?.inputs || !node?.outputs) return;
// The rows as this node last had them. Not counted from the sockets: a
// paste or a copy gives the node new socket objects, with no marks.
const rowsBefore = node._ausbossSocketRows;
const show = socketsToShow({
wiredInputs: plainInputs(node).filter((slot) => slot.link != null).map((slot) => slot.name),
wiredOutputs: node.outputs.filter(outputWired).map((slot) => slot.name),
showAll: showAll(),
inputNames: plainInputs(node).map((slot) => slot.name),
outputNames: node.outputs.map((slot) => slot.name),
});
const hiddenKeys = [];
node.inputs.forEach((slot, index) => {
if (slot.widget) return;
const hide = !show.inputs.has(slot.name);
if (setSocketHidden(slot, hide) && hide) hiddenKeys.push(`in-${index}`);
});
node.outputs.forEach((slot, index) => {
const hide = !show.outputs.has(slot.name);
if (setSocketHidden(slot, hide) && hide) hiddenKeys.push(`out-${index}`);
});
// When the hidden rows change, the nudge flips, so Nodes 2.0 measures the
// sockets again and every wire ends on its dot.
const hiddenNow = hiddenKeys.join(",");
if (node._ausbossHiddenRows !== undefined && node._ausbossHiddenRows !== hiddenNow) node._ausbossNudge = !node._ausbossNudge;
node._ausbossHiddenRows = hiddenNow;
node._ausbossSocketRule = hiddenRowsRule(node.id, hiddenKeys, Boolean(node._ausbossNudge));
writeStyleRules();
// The node gets a row taller or shorter with its sockets, so the panel
// keeps its size. A workflow that is loading keeps the size it was saved at.
const rows = shownRows(node);
if (rowsBefore != null && rows !== rowsBefore && !app.configuringGraph && node.size) {
node.setSize([node.size[0], node.size[1] + (rows - rowsBefore) * rowHeight()]);
}
node._ausbossSocketRows = rows;
node.setDirtyCanvas?.(true, true);
}
// A wire dropped on the node's body goes to the socket the frontend finds
// for its kind, and the first free one can be one nobody can see (an audio
// wire finds video_sound before voice). Nodes 2.0 then makes no wire at
// all, as a hidden row has no place to snap to. So the node answers with
// the first shown socket of that kind that can take the wire. The same goes
// for a wire pulled from another node's input, which lands on an output.
function shownSocketFor(node, found, outputs) {
if (!found?.slot?._ausbossHidden) return found;
const slots = outputs ? node.outputs : node.inputs;
const target = dropTarget(slots.map((slot) => ({
name: slot.name,
type: slot.type,
// A wire that is being dragged away leaves its socket free.
wired: outputs ? outputWired(slot) : slot.link != null && !lookupLink(node.graph, slot.link)?._dragging,
shown: !slot.widget && !slot._ausbossHidden,
})), found.index, { shared: outputs });
return target === found.index ? found : { index: target, slot: slots[target] };
}
app.registerExtension({
name: "AusBoss.H3Sockets",
settings: [
{
id: SHOW_ALL,
name: "Show every socket on H3 Prompt Writer",
type: "boolean",
defaultValue: false,
category: ["🆎 AusBoss", "H3 Prompt Writer", "Show every socket"],
tooltip:
"H3 Prompt Writer shows only the sockets and picture chips you are using. "
+ "Turn this on to see all of them all the time.",
// The card redraws too: its row of picture chips follows the setting.
onChange: safely(() => writerNodes().forEach((node) => { applySockets(node); node.__ausbossCard?.refresh?.(); })),
},
],
beforeRegisterNodeDef(nodeType, nodeData) {
if (nodeData.name !== NODE_CLASS) return;
const proto = nodeType.prototype;
// The least height counts only the rows that are drawn.
const computeSize = proto.computeSize;
proto.computeSize = function (...args) {
const size = computeSize.apply(this, args);
try { size[1] -= hiddenRows(this) * rowHeight(); } catch { /* the full height is a safe answer */ }
return size;
};
for (const [name, outputs] of [["findInputByType", false], ["findOutputByType", true]]) {
const find = proto[name];
if (typeof find !== "function") continue;
proto[name] = function (...args) {
const found = find.apply(this, args);
try { return shownSocketFor(this, found, outputs); } catch { return found; }
};
}
const apply = safely(function () { applySockets(this); });
chainCallback(proto, "onNodeCreated", apply);
chainCallback(proto, "onAdded", apply);
// A node that takes a saved state (a load, a paste, a copy) keeps the
// size that came with it.
chainCallback(proto, "onConfigure", safely(function () { this._ausbossSocketRows = null; applySockets(this); }));
chainCallback(proto, "onConnectionsChange", apply);
chainCallback(proto, "onRemoved", safely(function () {
this._ausbossSocketRule = "";
// The node is still in the graph's list while it is being removed.
queueMicrotask(safely(writeStyleRules));
}));
// The saved node is what it always was: no parked position in it.
chainCallback(proto, "onSerialize", safely(function (saved) {
(saved.inputs ?? []).forEach((slot, index) => { if (this.inputs?.[index]?._ausbossHidden) delete slot.pos; });
(saved.outputs ?? []).forEach((slot, index) => { if (this.outputs?.[index]?._ausbossHidden) delete slot.pos; });
}));
},
});
-14
View File
@@ -1,14 +0,0 @@
// On a Chinese ComfyUI (Settings > Language), the pack's own node faces show
// Chinese. js/shared/i18n.mjs holds the rules, js/shared/i18n_zh.mjs the words.
// The language is read when the page loads, so a change in Settings shows
// after a reload.
import { app } from "../../../scripts/app.js";
import { chineseActive, followFaces, useLocaleSource } from "../shared/i18n.mjs";
app.registerExtension({
name: "ausboss.i18n",
async setup() {
useLocaleSource(() => app.ui?.settings?.getSettingValue?.("Comfy.Locale"));
if (chineseActive()) followFaces(document.body);
},
});
+1 -1
View File
@@ -33,7 +33,7 @@ function mountTransformPanel(node, panel) {
fillNodeHeight(widget, {
minWidth: PANEL_MIN_WIDTH,
minHeight: () => transformPanelFloor(node),
minNodeSize: [PANEL_MIN_WIDTH, 396],
minNodeSize: [PANEL_MIN_WIDTH, 470],
exactMinWidth: true,
});
return widget;
+15 -59
View File
@@ -16,8 +16,8 @@
// files to this site?"). A page can neither word that question nor skip it,
// so the node says what it means here while the file explorer is open.
import { api } from "../../../scripts/api.js";
import { app } from "../../../scripts/app.js";
import { api } from "/scripts/api.js";
import { app } from "/scripts/app.js";
import { BRAND, chainCallback, chainHandler, keepDomWidgetWidthAuto, notifyAusbossChange, showToast } from "../shared/index.mjs";
import { fillNodeHeight } from "../shared/panel_layout.mjs";
import { isForeignRun } from "../shared/prompt_scope.mjs";
@@ -26,7 +26,6 @@ import {
childOf,
countLine,
foldersAddress,
folderContext,
isPicked,
listAddress,
nameAt,
@@ -275,7 +274,6 @@ async function refresh(state) {
}
function scheduleRefresh(state, delay = 160) {
++state.token;
clearTimeout(state.timer);
state.timer = setTimeout(() => refresh(state), delay);
}
@@ -344,7 +342,6 @@ async function upload(file, subfolder, overwrite) {
// Loose pictures go into the folder the node shows.
async function addFiles(state, files) {
if (!state.alive) return false;
const now = settings(state.node);
const images = [...(files ?? [])].filter(isPicture);
if (!images.length) return false;
@@ -355,13 +352,10 @@ async function addFiles(state, files) {
const added = [];
let failed = 0;
for (const file of images) {
if (!state.alive) return true;
const name = await upload(file, now.folder, false);
if (!state.alive) return true;
if (name) added.push(name); else failed += 1;
}
await refresh(state);
if (!state.alive) return true;
// A hand-made pick takes the new pictures in: they were just put there to be used.
const picked = parsePicked(settings(state.node).pictures);
if (picked !== null && added.length) setPicked(state, [...picked, ...added.filter((name) => state.names.includes(name))]);
@@ -394,7 +388,6 @@ function closeAsk(answer = false) {
}
function askBig(state, name, pictures) {
if (!state.alive) return Promise.resolve(false);
const bytes = pictures.reduce((sum, item) => sum + (Number(item.file?.size) || 0), 0);
if (pictures.length <= BIG_COUNT && bytes <= BIG_BYTES) return Promise.resolve(true);
closeAsk(false);
@@ -411,7 +404,7 @@ function askBig(state, name, pictures) {
foot.append(cancel, go);
root.append(foot);
const abort = new AbortController();
openAsk = { root, abort, done, state };
openAsk = { root, abort, done };
cancel.addEventListener("click", () => closeAsk(false));
go.addEventListener("click", () => closeAsk(true));
document.body.append(root);
@@ -427,17 +420,7 @@ function askBig(state, name, pictures) {
// input/<its name>, folders inside it too, and the node moves there. Copying
// the same folder again writes over its copies instead of piling up doubles.
async function copyFolder(state, name, pictures) {
if (!state.alive || state.copyLocked) return;
state.copyLocked = true;
try {
if (!(await askBig(state, name, pictures)) || !state.alive) return;
await copyPictures(state, name, pictures);
} finally {
state.copyLocked = false;
}
}
async function copyPictures(state, name, pictures) {
if (!(await askBig(state, name, pictures)) || !state.alive) return;
const target = folderName(name);
const queue = pictures.slice(0, COPY_LIMIT);
state.copying = { done: 0, total: queue.length, name, target };
@@ -448,9 +431,7 @@ async function copyPictures(state, name, pictures) {
for (;;) {
const next = queue.shift();
if (!next || !state.alive) return;
const added = await upload(next.file, next.folder ? `${target}/${next.folder}` : target, true);
if (!state.alive) return;
if (added) copied += 1;
if (await upload(next.file, next.folder ? `${target}/${next.folder}` : target, true)) copied += 1;
state.copying.done += 1;
paint(state);
cover(state);
@@ -463,7 +444,6 @@ async function copyPictures(state, name, pictures) {
if (!state.alive) return;
const moved = write(state.node, "source", "input") | write(state.node, "folder", target);
if (moved) notifyAusbossChange(); else await refresh(state);
if (!state.alive) return;
paint(state);
showToast({ detail: `Copied ${copied} picture${copied === 1 ? "" : "s"} from "${name}" into your ComfyUI input folder (input/${target}).` });
if (copied < total) showToast({ severity: "warn", detail: `${total - copied} could not be copied.` });
@@ -526,7 +506,7 @@ function addMenu(state, anchor) {
closeMenu();
const root = el("div", "ausboss-if-menu");
const abort = new AbortController();
openMenu = { root, abort, state };
openMenu = { root, abort };
const row = (text, title, run) => {
const button = el("button", "ausboss-if-browse-row", text);
button.type = "button"; button.title = title;
@@ -565,25 +545,19 @@ async function browse(state, anchor) {
foot.append(cancel, use);
root.append(path, list, foot);
const abort = new AbortController();
openBrowse = { root, abort, state };
openBrowse = { root, abort };
let at = now.folder;
let source = now.source;
let navigation = 0;
const show = async (folder) => {
const token = ++navigation;
use.disabled = true;
let data = null;
try {
const response = await api.fetchApi(foldersAddress({ source, folder }));
const response = await api.fetchApi(foldersAddress({ source: now.source, folder }));
if (response.ok) data = await response.json();
} catch { /* shown as an empty list below */ }
if (openBrowse?.root !== root || token !== navigation || !state.alive) return;
if (openBrowse?.root !== root) return;
if (!data && folder) return show(""); // a folder that is gone: start at the top
at = data?.folder ?? "";
source = data?.source ?? source;
use.disabled = false;
path.replaceChildren(document.createTextNode(`${source} / `), el("b", "", at || "(the folder itself)"));
path.replaceChildren(document.createTextNode(`${now.source} / `), el("b", "", at || "(the folder itself)"));
list.replaceChildren();
if (at) {
const up = el("button", "ausboss-if-browse-row up", "↑ up");
@@ -608,9 +582,7 @@ async function browse(state, anchor) {
};
use.addEventListener("click", () => {
if (use.disabled || !state.alive) return;
const moved = write(state.node, "source", source) | write(state.node, "folder", at);
if (moved) notifyAusbossChange();
if (write(state.node, "folder", at)) notifyAusbossChange();
closeBrowse();
});
cancel.addEventListener("click", closeBrowse);
@@ -734,12 +706,6 @@ function buildPanel(node) {
const now = settings(node);
const key = `${now.source}|${now.folder}|${now.subfolders}|${now.sort}`;
if (key === state.key) { paint(state); return; }
const context = folderContext(now);
if (context !== state.context) {
state.done.clear();
state.loadedLine = "";
state.context = context;
}
// Another folder holds other names: a pick made in the old one means nothing there.
const moved = state.key && (now.source !== state.shown.source || now.folder !== state.shown.folder || now.subfolders !== state.shown.subfolders);
state.key = key;
@@ -759,9 +725,7 @@ function buildPanel(node) {
const now = settings(node);
if (now.run !== "one per run" || isLinked(node, "position")) return;
const count = pickedNames(parsePicked(now.pictures), state.names).length;
// The folder can change on disk or arrive through a link. Only the
// backend knows where it ends; a cached gallery must not cap "next".
const next = nextPosition(now.position, now.afterRun === "next" ? null : count, now.afterRun, now.atTheEnd);
const next = nextPosition(now.position, count, now.afterRun, now.atTheEnd);
if (next !== now.position) { position.value = next; position.callback?.(next); }
});
}
@@ -784,7 +748,6 @@ function buildPanel(node) {
});
const now = settings(node);
state.context = folderContext(now);
state.key = `${now.source}|${now.folder}|${now.subfolders}|${now.sort}`;
rebuild(state);
scheduleRefresh(state, 60);
@@ -810,18 +773,12 @@ app.registerExtension({
});
chainCallback(nodeType.prototype, "onConfigure", function (info) {
const state = buildPanel(this);
++state.token;
clearTimeout(state.timer);
state.done.clear();
state.loadedLine = "";
// A node that comes with a size keeps it, the smallest one too.
if (info?.size) state.sized = true;
// A loaded workflow brings its own folder and its own pick.
state.restoring = true;
queueMicrotask(() => {
if (!state.alive) return;
const now = settings(this);
state.context = folderContext(now);
state.key = `${now.source}|${now.folder}|${now.subfolders}|${now.sort}`;
state.restoring = false;
scheduleRefresh(state, 30);
@@ -832,7 +789,6 @@ app.registerExtension({
const state = this.__ausbossImageFolder;
const note = output?.ausboss_image_folder?.[0];
if (!state?.alive || !note) return;
if (!note.context || folderContext(note.context) !== folderContext(settings(this))) return;
for (const name of note.names ?? []) state.done.add(name);
const loaded = note.loaded ?? [];
state.loadedLine = loaded.length === 1
@@ -849,9 +805,9 @@ app.registerExtension({
state.abort.abort();
state.choosing?.abort();
clearTimeout(state.dropTimer);
if (openBrowse?.state === state) closeBrowse();
if (openMenu?.state === state) closeMenu();
if (openAsk?.state === state) closeAsk(false);
if (openBrowse) closeBrowse();
if (openMenu) closeMenu();
if (openAsk?.root && state.grid.isConnected === false) closeAsk(false);
});
},
});
+1 -1
View File
@@ -11,7 +11,7 @@
// last text. The labels themselves are never saved, so an older version of
// the pack shows the plain names.
import { app } from "../../../scripts/app.js";
import { app } from "/scripts/app.js";
import { isForeignRun } from "../shared/prompt_scope.mjs";
import { chainCallback } from "../shared/index.mjs";
import { savedLabel, sizeLabel, sizesFromExecuted } from "../shared/image_size.mjs";
+85 -386
View File
@@ -1,5 +1,5 @@
// The in-node preview panel for LaMa Inpaint, Mask Refine, Mask by Name,
// Select Frame, Save Image, Film Grain, Cut Out and Keep Detail.
// Select Frame and Save Image.
//
// It shows this node's own result once it has one, and falls back to a
// thumbnail of whatever feeds its IMAGE/MASK input before the graph has run.
@@ -14,30 +14,24 @@
// switch lays each sampling step over the stage, with a Stop button on the
// bar (shared/step_preview.mjs).
import { panelSwitch, primaryAction } from "../shared/panel_controls.mjs";
import { api } from "../../../scripts/api.js";
import { app } from "../../../scripts/app.js";
import { api } from "/scripts/api.js";
import { app } from "/scripts/app.js";
import { isForeignRun } from "../shared/prompt_scope.mjs";
import { executionIdOf, nodeByExecutionId } from "../shared/graph_ids.mjs";
import { FONT_UI, RADIUS_CONTROL, RADIUS_XS, THEME as T } from "../shared/theme.mjs";
import { chainCallback, keepDomWidgetWidthAuto, notifyAusbossChange } from "../shared/index.mjs";
import { BRAND, chainCallback, keepDomWidgetWidthAuto, notifyAusbossChange } from "../shared/index.mjs";
import { ensureNodeMinHeight, fillNodeHeight, growToNodeFloor } from "../shared/panel_layout.mjs";
import { suppressCoreImagePreview } from "../shared/core_preview.mjs";
import { autoMaskValues } from "../shared/mask_auto.mjs";
import { CHECKER } from "../shared/compare_erase.mjs";
import { hideInputsInDef, hideWidget, setWidgetVisible } from "../shared/widget_visibility.mjs";
import { makePictureStepper } from "../shared/picture_stepper.mjs";
import { ALL, allLabel, gridShape, heldPlaces, keepIndex, keepWords, stepIndex, stepWithAll } from "../shared/picture_steps.mjs";
import { mountLive, takeStage } from "../shared/live_stage.mjs";
import { keepIndex, stepIndex } from "../shared/picture_steps.mjs";
import { addStepConsumer, mountStepOverlay, showsStepsOn, stepRun, stopStepRun, watchSteps } from "../shared/step_preview.mjs";
import {
describeNodePreview,
describeSourcePreview,
lightPreviewQuery,
outputLocatorId,
outputRecordCount,
outputRecordQuery,
ownResultIsCurrent,
placeholderText,
staleText,
sourceFileWidget,
@@ -58,15 +52,7 @@ const BAR_GAP = 6;
const BAR_PADDING = 2;
const PANEL_HEIGHT = STAGE_HEIGHT + BAR_HEIGHT + 4 + 16;
const OFF_HEIGHT = BAR_HEIGHT + 16;
// The row over pictures that wait for a Save, and the gap under it.
const KEEP_HEIGHT = 30;
const KEEP_SPACE = KEEP_HEIGHT + 4;
const INPUT_SIDE = 1; // LiteGraph.INPUT
// A run that left this many pictures or fewer opens with all of them side
// by side. More than that and each would be a speck, so the arrows go
// through them one at a time, as before.
const GRID_MAX = 48;
const GRID_GAP = 4;
// The node's height from before its preview was switched off, so switching
// it back on returns the node to it (saved with the workflow).
const HEIGHT_PROPERTY = "ausboss_preview_height";
@@ -125,23 +111,8 @@ const NODE_CONFIG = {
: null),
},
AUSBOSS_NODES_SelectFrame: { inputName: "frames", noun: "frames" },
// These three redraw their picture while a value is dragged, before any
// run (shared/live_stage.mjs), with a Fit | 100% switch on the bar.
AUSBOSS_NODES_FilmGrain: { inputName: "image", noun: "an image", live: "grain" },
AUSBOSS_NODES_CutOut: { inputName: "image", noun: "an image", checker: true, live: "cutout" },
AUSBOSS_NODES_KeepDetail: { inputName: "image", noun: "an image", live: "detail" },
// Its result is the file it just saved; the card sits above the panel.
// SAVE shows only for a run made with Auto save off, which holds its
// pictures until this button keeps them.
AUSBOSS_NODES_SaveImage: {
inputName: "images",
noun: "an image",
switchTitle: "Show the saved image here. The file is saved either way.",
steps: true,
// Auto save off: a row over the picture says it is not saved yet and
// holds the button that saves it.
keep: "Save what is showing: every picture, or the one the arrows picked.",
},
AUSBOSS_NODES_SaveImage: { inputName: "images", noun: "an image", switchTitle: "Show the saved image here. The file is saved either way.", steps: true },
};
// The picture sits out of flow, centred in the stage, so it can never set
@@ -158,41 +129,34 @@ function ensureCss() {
style.textContent = `
.ausboss-input-preview{box-sizing:border-box;display:flex;flex-direction:column;gap:4px;width:100%;height:100%;padding:0 6px 6px;pointer-events:none;overflow:hidden;}
.ausboss-input-preview-bar{box-sizing:border-box;flex:none;display:flex;align-items:center;gap:${BAR_GAP}px;height:${BAR_HEIGHT}px;padding:0 ${BAR_PADDING}px;pointer-events:none;}
.ausboss-input-preview-stage{position:relative;flex:1 1 auto;min-height:0;display:flex;align-items:center;justify-content:center;width:100%;overflow:hidden;border:1px solid ${T.rule};border-radius:${RADIUS_CONTROL}px;background:${T.well};}
.ausboss-input-preview-stage{position:relative;flex:1 1 auto;min-height:0;display:flex;align-items:center;justify-content:center;width:100%;overflow:hidden;border:1px solid rgba(0,180,170,.27);border-radius:6px;background:rgba(0,0,0,.28);}
[data-node-id] .ausboss-input-preview-stage{box-sizing:border-box;min-height:${STAGE_HEIGHT}px;}
.ausboss-input-preview.preview-off .ausboss-input-preview-stage{display:none;}
.ausboss-input-preview.preview-off .ausboss-stepper{display:none;}
.ausboss-input-preview-stage img,.ausboss-input-preview-stage video{display:none;position:absolute;inset:0;margin:auto;max-width:100%;max-height:100%;object-fit:contain;}
.ausboss-input-preview-stage.show-image img{display:block;}
.ausboss-input-preview-stage.checker img{background-image:repeating-conic-gradient(${CHECKER.light} 0 25%,${CHECKER.dark} 0 50%);background-size:${CHECKER.side * 2}px ${CHECKER.side * 2}px;}
.ausboss-input-preview-stage.loading-image img{opacity:.4;transition:opacity .3s ease 1.2s;}
.ausboss-input-preview-stage.show-video video{display:block;}
.ausboss-input-preview-grid{display:none;position:absolute;inset:0;box-sizing:border-box;gap:${GRID_GAP}px;padding:${GRID_GAP}px;justify-content:center;align-content:center;}
.ausboss-input-preview-stage.show-grid .ausboss-input-preview-grid{display:grid;}
.ausboss-input-preview-stage .ausboss-input-preview-grid img{display:block;position:static;margin:0;width:100%;height:100%;min-width:0;min-height:0;max-width:none;max-height:none;object-fit:contain;}
.ausboss-input-preview-hint{display:none;max-width:86%;color:${T.faint};font:11px/1.35 ${FONT_UI};text-align:center;}
.ausboss-input-preview-stage:not(.show-image):not(.show-video):not(.show-grid) .ausboss-input-preview-hint{display:block;}
.ausboss-input-preview-keep{box-sizing:border-box;flex:none;display:flex;align-items:center;justify-content:space-between;gap:10px;height:${KEEP_HEIGHT}px;padding:0 4px 0 10px;border-radius:${RADIUS_CONTROL}px;background:${T.brandSoft};pointer-events:none;}
.ausboss-input-preview-keep[hidden]{display:none;}
.ausboss-input-preview-keep span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:${T.brandInk};font:600 11px/1.2 ${FONT_UI};}
.ausboss-input-preview-keep.done{background:${T.fill};}
.ausboss-input-preview-keep.done span{color:${T.label};}
.ausboss-input-preview-hint{display:none;max-width:86%;color:#78908e;font:11px/1.35 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;text-align:center;}
.ausboss-input-preview-stage:not(.show-image):not(.show-video) .ausboss-input-preview-hint{display:block;}
.ausboss-input-preview-tools{display:flex;gap:4px;pointer-events:auto;}
.ausboss-input-preview-tool{box-sizing:border-box;height:${BAR_HEIGHT}px;min-width:24px;padding:0 6px;border:1px solid transparent;border-radius:${RADIUS_XS}px;background:${T.fill};color:${T.label};font:600 9.5px/18px ${FONT_UI};letter-spacing:.02em;cursor:pointer;}
.ausboss-input-preview-tool[hidden]{display:none;}
.ausboss-input-preview-stage .ausboss-input-preview-grid img.kept{outline:2px solid ${T.brand};outline-offset:-2px;}
.ausboss-input-preview-tool:hover{color:${T.ink};background:${T.fillHover};}
.ausboss-input-preview-tool.active{color:${T.brandInk};background:${T.brandSoft};}
.ausboss-input-preview-tool:focus-visible{outline:2px solid ${T.brand};outline-offset:1px;}
.ausboss-input-preview:not(.preview-off) .ausboss-panel-switch.steps + .ausboss-panel-switch{margin-left:0;}
.ausboss-input-preview.preview-off .ausboss-panel-switch.steps{display:none;}
.ausboss-input-preview-tool{box-sizing:border-box;height:${BAR_HEIGHT}px;min-width:24px;padding:0 6px;border:1px solid rgba(0,180,170,.52);border-radius:4px;background:rgba(0,0,0,.7);color:#c8dddd;font:700 9px/18px "Segoe UI",sans-serif;cursor:pointer;}
.ausboss-input-preview-tool:hover{border-color:${BRAND};color:#fff;background:rgba(0,79,75,.78);}
.ausboss-input-preview-tool.active{border-color:${BRAND};color:${BRAND};}
.ausboss-input-preview-toggle{display:flex;align-items:center;gap:6px;margin-left:auto;pointer-events:auto;cursor:pointer;user-select:none;}
.ausboss-input-preview:not(.preview-off) .ausboss-input-preview-toggle.steps + .ausboss-input-preview-toggle{margin-left:0;}
.ausboss-input-preview.preview-off .ausboss-input-preview-toggle.steps{display:none;}
.ausboss-input-preview-tool.ausboss-steps-stop{visibility:hidden;}
.ausboss-input-preview-tool.ausboss-steps-stop.live{visibility:visible;pointer-events:auto;}
.ausboss-input-preview-readout{box-sizing:border-box;height:${BAR_HEIGHT}px;padding:0 7px;border:1px solid transparent;border-radius:999px;background:${T.brandSoft};color:${T.brandInk};font:600 9.5px/18px ${FONT_UI};font-variant-numeric:tabular-nums;white-space:nowrap;pointer-events:none;}
.ausboss-input-preview-toggle span{color:#5f7674;font:10px -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;letter-spacing:.08em;text-transform:uppercase;}
.ausboss-input-preview-switch{box-sizing:border-box;width:24px;height:13px;border-radius:7px;border:none;background:#3a4047;position:relative;cursor:pointer;padding:0;flex:none;pointer-events:auto}
.ausboss-input-preview-switch::after{content:"";position:absolute;top:2px;left:2px;width:9px;height:9px;border-radius:50%;background:#9ba2aa;transition:left .12s}
.ausboss-input-preview-switch.on{background:${BRAND}}
.ausboss-input-preview-switch.on::after{left:13px;background:#fff}
.ausboss-input-preview-readout{box-sizing:border-box;height:${BAR_HEIGHT}px;padding:0 7px;border:1px solid rgba(0,180,170,.5);border-radius:10px;background:rgba(0,180,170,.14);color:${BRAND};font:700 9.5px/18px "Segoe UI",sans-serif;white-space:nowrap;pointer-events:none;}
.ausboss-input-preview-readout:empty{display:none;}
.ausboss-input-preview-readout.warn{background:${T.warnSoft};color:${T.warnInk};}
.ausboss-input-preview-note{display:none;position:absolute;left:6px;right:6px;bottom:6px;z-index:6;padding:6px 8px;border:1px solid ${T.warn};border-radius:${RADIUS_CONTROL}px;background:${T.warnSoft};color:${T.warnInk};font:600 11px/1.35 ${FONT_UI};text-align:center;pointer-events:none;}
.ausboss-input-preview-toast{position:absolute;left:50%;bottom:6px;z-index:5;max-width:88%;padding:3px 7px;border-radius:${RADIUS_XS}px;background:${T.fill};color:${T.inkSoft};font:10px/1.3 ${FONT_UI};text-align:center;transform:translateX(-50%);pointer-events:none;}
.ausboss-input-preview-readout.warn{border-color:#c98a2b;background:rgba(201,138,43,.16);color:#ffd9a0;}
.ausboss-input-preview-note{display:none;position:absolute;left:6px;right:6px;bottom:6px;z-index:6;padding:6px 8px;border:1px solid #c98a2b;border-radius:6px;background:rgba(20,10,0,.86);color:#ffd9a0;font:600 11px/1.35 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;text-align:center;pointer-events:none;}
.ausboss-input-preview-toast{position:absolute;left:50%;bottom:6px;z-index:5;max-width:88%;padding:3px 7px;border-radius:4px;background:rgba(0,0,0,.78);color:#b8d3d1;font:10px/1.3 "Segoe UI",sans-serif;text-align:center;transform:translateX(-50%);pointer-events:none;}
`;
document.head.appendChild(style);
}
@@ -333,9 +297,18 @@ function previewEnabled(state) {
}
function makePreviewToggle(state, signal) {
const button = panelSwitch("Preview", state.switchTitle ?? "Show this node's result here. Off also skips writing the preview file to the temp folder.");
button.addEventListener("pointerdown", (event) => event.stopPropagation(), { signal });
button.addEventListener("click", (event) => {
const toggle = document.createElement("div");
toggle.className = "ausboss-input-preview-toggle";
toggle.title = state.switchTitle ?? "Show this node's result here. Off also skips writing the preview file to the temp folder.";
const caption = document.createElement("span");
caption.textContent = "preview";
const button = document.createElement("button");
button.type = "button";
button.className = "ausboss-input-preview-switch";
button.setAttribute("role", "switch");
toggle.append(caption, button);
toggle.addEventListener("pointerdown", (event) => event.stopPropagation(), { signal });
toggle.addEventListener("click", (event) => {
event.preventDefault(); event.stopPropagation();
const next = !previewEnabled(state);
state.previewWidget.value = next;
@@ -344,7 +317,7 @@ function makePreviewToggle(state, signal) {
notifyAusbossChange();
}, { signal });
state.switchButton = button;
return button;
return toggle;
}
function installPreviewSwitch(state, signal) {
@@ -375,10 +348,18 @@ function installStepsSwitch(state, signal) {
if (!widget) return;
state.stepsWidget = widget;
hideWidget(widget);
const button = panelSwitch("Preview steps", "Show the picture here while it is being made, one step at a time, with a Stop button. Off by default.");
button.classList.add("steps");
button.addEventListener("pointerdown", (event) => event.stopPropagation(), { signal });
button.addEventListener("click", (event) => {
const toggle = document.createElement("div");
toggle.className = "ausboss-input-preview-toggle steps";
toggle.title = "Show the picture here while it is being made, one step at a time, with a Stop button. Off by default.";
const caption = document.createElement("span");
caption.textContent = "steps";
const button = document.createElement("button");
button.type = "button";
button.className = "ausboss-input-preview-switch";
button.setAttribute("role", "switch");
toggle.append(caption, button);
toggle.addEventListener("pointerdown", (event) => event.stopPropagation(), { signal });
toggle.addEventListener("click", (event) => {
event.preventDefault(); event.stopPropagation();
const next = widget.value !== true;
widget.value = next;
@@ -387,9 +368,9 @@ function installStepsSwitch(state, signal) {
notifyAusbossChange();
}, { signal });
state.stepsButton = button;
const previewToggle = state.switchButton;
if (previewToggle?.parentElement === state.bar) state.bar.insertBefore(button, previewToggle);
else state.bar.append(button);
const previewToggle = state.switchButton?.parentElement;
if (previewToggle?.parentElement === state.bar) state.bar.insertBefore(toggle, previewToggle);
else state.bar.append(toggle);
// Stop sits where the node's tools go; it keeps its place while hidden so
// the bar never shifts when a run starts.
@@ -427,6 +408,7 @@ function syncSteps(state, run = stepRun()) {
if (typeof state.placeholder === "boolean") state.hint.textContent = placeholderText(state.placeholder, state.noun, runningFor(state, run));
const on = stepsEnabled(state);
if (state.stepsButton) {
state.stepsButton.classList.toggle("on", state.stepsWidget?.value === true);
state.stepsButton.setAttribute("aria-checked", String(state.stepsWidget?.value === true));
}
state.stopButton?.classList.toggle("live", on && run.status === "running");
@@ -481,16 +463,17 @@ function syncPreviewMode(state, resize) {
const enabled = previewEnabled(state);
state.root.classList.toggle("preview-off", !enabled);
if (state.switchButton) {
state.switchButton.classList.toggle("on", enabled);
state.switchButton.setAttribute("aria-checked", String(enabled));
}
if (!enabled) {
// Nothing to show and nothing to fetch while it is off.
clearMedia(state);
state.img.removeAttribute("src");
}
if (resize) {
const node = state.node;
node.properties ??= {};
const floor = node.computeSize?.()[1] ?? panelFloor(state);
const floor = node.computeSize?.()[1] ?? (enabled ? PANEL_HEIGHT : OFF_HEIGHT);
if (!enabled) {
// Off: remember the height, then shrink to what is left.
const height = Number(node.size?.[1]);
@@ -533,7 +516,7 @@ function buildTools(state, tools, signal) {
}
function showHint(state, text) {
state.stage.classList.remove("show-image", "show-video", "show-grid");
state.stage.classList.remove("show-image", "show-video");
state.hint.textContent = text;
state.placeholder = null;
releaseSteps(state);
@@ -548,76 +531,24 @@ function showPlaceholder(state, connected) {
function showMedia(state, kind) {
state.stage.classList.toggle("show-image", kind === "image");
state.stage.classList.toggle("show-video", kind === "video");
state.stage.classList.toggle("show-grid", kind === "grid");
state.placeholder = null;
releaseSteps(state);
}
function clearMedia(state) {
state.img.removeAttribute("src");
state.stage.classList.remove("loading-image");
state.video.pause?.();
state.video.removeAttribute("src");
clearGrid(state);
}
function clearGrid(state) {
if (!state.gridKey) return;
state.gridKey = "";
state.grid?.replaceChildren();
}
// Every picture of the run at once, each as big as the stage allows.
function layoutGrid(state) {
const cells = [...(state.grid?.children ?? [])];
if (!cells.length) return;
const loaded = cells.find((cell) => cell.naturalWidth > 0 && cell.naturalHeight > 0);
const aspect = loaded ? loaded.naturalWidth / loaded.naturalHeight : 1;
const { columns, rows } = gridShape(cells.length, state.stage.clientWidth, state.stage.clientHeight, aspect);
// Tracks the size of one picture, so the pictures sit together in the
// middle of the stage with no bands between the rows.
const wide = (state.stage.clientWidth - GRID_GAP * (columns + 1)) / columns;
const tall = (state.stage.clientHeight - GRID_GAP * (rows + 1)) / rows;
if (!(wide > 0) || !(tall > 0)) return;
const width = Math.floor(Math.min(wide, tall * aspect));
const height = Math.floor(width / aspect);
state.grid.style.gridTemplateColumns = `repeat(${columns}, ${width}px)`;
state.grid.style.gridTemplateRows = `repeat(${rows}, ${height}px)`;
}
function showGrid(state, count) {
const urls = Array.from({ length: count }, (_, index) => storedResultUrl(state.node, index) ?? "");
const key = urls.join("\n");
if (state.gridKey !== key) {
state.gridKey = key;
state.grid.replaceChildren(...urls.map((url, index) => {
const cell = document.createElement("img");
cell.alt = `Picture ${index + 1} of ${count}`;
cell.decoding = "async";
// The first picture to load tells the grid the shape to lay out for.
cell.addEventListener("load", () => layoutGrid(state), { once: true });
cell.addEventListener("error", () => dropLightPreview(state), { once: true });
cell.src = url;
return cell;
}));
}
state.img.removeAttribute("src");
state.video.pause?.();
state.video.removeAttribute("src");
layoutGrid(state);
showMedia(state, "grid");
}
// Each source has one hook, with subscribers that can leave in any order.
const sourceWatchers = new WeakMap();
// Restore the watched widget's callback if our hook is still the tail of the
// chain; if someone chained after us the hook simply goes inert via
// state.alive. We never create object URLs, so there is nothing to revoke.
function unwatchSource(state) {
const watched = state.watched;
state.watched = null;
if (!watched) return;
watched.subscribers.delete(state);
if (!watched.subscribers.size && watched.widget.callback === watched.hook) {
if (watched && watched.widget.callback === watched.hook) {
watched.widget.callback = watched.prior;
sourceWatchers.delete(watched.widget);
}
}
@@ -626,21 +557,14 @@ function rewatchSource(state, source) {
if (state.watched?.widget === widget) return;
unwatchSource(state);
if (!widget) return;
let watched = sourceWatchers.get(widget);
if (!watched) {
const prior = widget.callback;
const subscribers = new Set();
const hook = function (...args) {
const result = prior?.apply(this, args);
for (const subscriber of subscribers) if (subscriber.alive) scheduleRefresh(subscriber);
return result;
};
watched = { widget, prior, hook, subscribers };
sourceWatchers.set(widget, watched);
widget.callback = hook;
}
watched.subscribers.add(state);
state.watched = watched;
const prior = widget.callback;
const hook = function (...args) {
const result = prior?.apply(this, args);
if (state.alive) scheduleRefresh(state);
return result;
};
widget.callback = hook;
state.watched = { widget, prior, hook };
}
// The node's stored output as a /view URL, for Nodes 2.0, where node.imgs
@@ -649,36 +573,17 @@ function rewatchSource(state, source) {
// record: an overwritten file reloads after the next run, and a plain refresh
// never reloads the picture.
const storedRand = new WeakMap();
const outputRecord = (node) => app.nodeOutputs?.[outputLocatorId(node)];
// Save Image also writes a small copy of each picture for its face, and the
// panel shows that one: a few hundred kilobytes where the file can be tens
// of megabytes. The copies are in the temp folder, which ComfyUI empties
// when it starts; a record whose copy is gone goes back to the file itself.
const lightGone = new WeakSet();
function lightQuery(record, index = null) {
return record && !lightGone.has(record) ? lightPreviewQuery(record, index) : null;
}
function storedResultUrl(node, index = null) {
const record = outputRecord(node);
const light = lightQuery(record, index);
const query = light ?? outputRecordQuery(record, index);
const record = app.nodeOutputs?.[outputLocatorId(node)];
const query = outputRecordQuery(record, index);
if (!query) return null;
if (!storedRand.has(record)) storedRand.set(record, app.getRandParam?.() ?? "");
return api.apiURL(`/view?${query}${light ? "" : app.getPreviewFormatParam?.() ?? ""}${storedRand.get(record)}`);
}
// A small copy that would not load: show the file itself from now on.
function dropLightPreview(state) {
const record = outputRecord(state.node);
if (!lightQuery(record)) return false;
lightGone.add(record);
scheduleRefresh(state);
return true;
return api.apiURL(`/view?${query}${app.getPreviewFormatParam?.() ?? ""}${storedRand.get(record)}`);
}
// Several pictures from one run (a list, or a batch Save Image saved one by
// one): they all show side by side, and the arrows in the bar go on to each
// one by itself and back round to all of them. One picture keeps the panel
// as it was, with no arrows.
// one): the arrows in the bar pick which one shows. One picture keeps the
// panel as it was, with no arrows.
function resultCount(state) {
if (state.stale || state.resultGone) return 0;
return outputRecordCount(app.nodeOutputs?.[outputLocatorId(state.node)]);
@@ -694,177 +599,21 @@ function previewMinWidth(state) {
return Math.max(PANEL_MIN_WIDTH, Math.ceil(state.node.size[0] - state.bar.clientWidth + needed));
}
// --- pictures held until Save (Save Image with Auto save off) ---------------
// The pictures this node is holding, in the order it shows them. Empty when
// the last run saved its pictures itself.
function heldPictures(state) {
if (state.stale || state.resultGone) return [];
return heldPlaces(app.nodeOutputs?.[outputLocatorId(state.node)]);
}
// Which of the shown pictures are kept, by their place on the node.
function keptOf(state, held) {
const key = held.map((picture) => `${picture.token}_${picture.index}`).join(" ");
if (state.kept?.key !== key) state.kept = { key, indexes: new Set() };
return state.kept.indexes;
}
// A click keeps every picture, or only the one the arrows picked. With the
// preview off there is no picture to pick, so it keeps them all.
function keepsAll(state, count) {
return count < 2 || showsAll(state, count) || !previewEnabled(state);
}
// The row shows while the node holds pictures. It says what is saved, and
// its button what a click will do (keepWords).
function syncHeld(state, count = resultCount(state)) {
const row = state.keepRow;
if (!row) return;
const held = heldPictures(state);
const hidden = !held.length || count < 1;
if (row.hidden !== hidden) {
row.hidden = hidden;
fitKeepRow(state);
}
if (hidden) return;
const kept = keptOf(state, held);
const all = keepsAll(state, count);
const done = all ? kept.size >= held.length : kept.has(state.index);
const words = keepWords({
held: held.length, kept: kept.size, all, done, saving: Boolean(state.keeping), name: state.kept?.name ?? "",
});
state.keepNote.textContent = words.note;
state.keepNote.title = state.kept?.path ? `ComfyUI/output/${state.kept.path}` : "";
state.keepButton.textContent = words.button;
state.keepButton.classList.toggle("quiet", words.quiet);
state.keepButton.disabled = Boolean(state.keeping);
row.classList.toggle("done", words.quiet && kept.size >= held.length);
[...(state.grid?.children ?? [])].forEach((cell, index) => cell.classList.toggle("kept", kept.has(index)));
}
// The row takes room of its own, so the picture keeps its floor: the node
// grows to hold it, and a node with the preview off gives the room back.
function fitKeepRow(state) {
const node = state.node;
if (previewEnabled(state)) {
ensureNodeMinHeight(node);
} else {
const floor = Number(node.computeSize?.()?.[1]);
if (Number.isFinite(floor)) node.setSize?.([node.size?.[0] ?? PANEL_MIN_WIDTH, floor]);
}
node.setDirtyCanvas?.(true, true);
}
function buildKeepRow(state, title, signal) {
const row = document.createElement("div");
row.className = "ausboss-input-preview-keep";
row.hidden = true;
const note = document.createElement("span");
const button = primaryAction("Save picture", title);
// Stop the graph from seeing the click as a canvas drag on the node.
button.addEventListener("pointerdown", (event) => event.stopPropagation(), { signal });
button.addEventListener("click", (event) => {
event.preventDefault();
event.stopPropagation();
keepHeld(state);
}, { signal });
row.append(note, button);
state.keepRow = row;
state.keepNote = note;
state.keepButton = button;
return row;
}
async function keepHeld(state) {
const held = heldPictures(state);
if (!held.length || state.keeping) return;
const count = resultCount(state);
const wanted = keepsAll(state, count) ? held.map((_, place) => place) : [state.index];
// One request for each run, in the order the pictures show.
const runs = new Map();
for (const place of wanted) {
const picture = held[place];
if (!picture) continue;
if (!runs.has(picture.token)) runs.set(picture.token, []);
runs.get(picture.token).push(picture.index);
}
state.keeping = true;
syncHeld(state);
const kept = keptOf(state, held);
const saved = [];
let skipped = 0;
try {
for (const [token, picks] of runs) {
const response = await api.fetchApi("/ausboss/save_image/keep", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ token, picks }),
});
const answer = await response.json().catch(() => ({}));
if (!response.ok) throw new Error(answer.error || "Could not save.");
if (!state.alive) return;
const done = new Set(answer.kept ?? []);
held.forEach((picture, place) => {
if (picture.token === token && done.has(picture.index)) kept.add(place);
});
saved.push(...(answer.saved ?? []));
// One picture: the row says the name it was saved under.
const path = held.length === 1 ? answer.saved?.[0]?.path : null;
if (typeof path === "string" && path && state.kept) {
state.kept.path = path;
state.kept.name = path.slice(path.lastIndexOf("/") + 1);
}
skipped += answer.skipped?.length ?? 0;
}
toast(state, saved.length === 1
? `Saved ${saved[0].path}`
: saved.length
? `Saved ${saved.length} pictures`
: skipped ? "Not saved: the file already exists" : "Already saved");
} catch (error) {
if (state.alive) toast(state, error?.message || "Could not save.");
} finally {
state.keeping = false;
if (state.alive) syncHeld(state);
}
}
function showsAll(state, count) {
return count > 1 && count <= GRID_MAX && state.all !== false;
}
function stepPicture(state, step) {
const count = resultCount(state);
if (count < 2) return;
if (count > GRID_MAX) {
state.index = stepIndex(state.index, count, step);
} else {
const at = stepWithAll(showsAll(state, count) ? ALL : state.index, count, step);
state.all = at === ALL;
if (!state.all) state.index = at;
}
state.index = stepIndex(state.index, count, step);
refresh(state);
}
function refresh(state) {
if (!state.alive) return;
if (!previewEnabled(state)) {
clearMedia(state);
syncHeld(state);
return;
}
const source = upstreamNode(state.node, state.inputName);
rewatchSource(state, source);
// Film Grain, Keep Detail and Cut Out draw their own picture while a value
// is dragged; the stage is theirs for as long as they can.
if (state.live && takeStage(state)) return;
const count = resultCount(state);
const hidden = state.stepper.root.hidden;
state.index = keepIndex(state.index, count);
const all = showsAll(state, count);
state.stepper.set(state.index, count, all ? allLabel(count) : undefined);
syncHeld(state, count);
state.stepper.set(state.index, count);
if (state.stepper.root.hidden !== hidden) growToNodeFloor(state.widget);
if (state.stale) {
// The node ran while its preview was off, so the picture it still has
@@ -876,20 +625,11 @@ function refresh(state) {
// A node that just stopped the run has no result for this picture: the
// one it still holds is from an earlier run (Mask by Name's last find,
// tinted), so show what feeds it instead.
if (all) {
showGrid(state, count);
// The grid's cells are new: mark the ones already kept.
syncHeld(state, count);
return;
}
clearGrid(state);
const described = state.resultGone
? describeSourcePreview(source)
: count > 1
? { kind: "url", url: storedResultUrl(state.node, state.index) }
: describeNodePreview(state.node, state.inputName, storedResultUrl(state.node),
// The small copy goes first: node.imgs is the full file.
!lightQuery(outputRecord(state.node)) && ownResultIsCurrent(state.node, outputRecord(state.node), state.imgsFor));
: describeNodePreview(state.node, state.inputName, storedResultUrl(state.node));
if (!described) {
clearMedia(state);
showPlaceholder(state, !!source);
@@ -911,9 +651,6 @@ function refresh(state) {
state.video.removeAttribute("src");
if (state.img.getAttribute("src") !== url) {
state.img.src = url;
// The picture before stays up while this one loads. A slow load
// dims it, so an old picture is never taken for the new one.
state.stage.classList.toggle("loading-image", true);
} else if (state.img.complete && state.img.naturalWidth > 0) {
showMedia(state, "image");
}
@@ -936,19 +673,8 @@ function scheduleRefresh(state) {
// Watching the property rather than an api event catches both routes that set
// it - the progress frames streamed during a run and the ui payload delivered
// when the node finishes - without this file having to know either event name.
// The panel's floor: the bar and the picture, the bar alone with the
// preview off, and the Save row on top while it shows.
function panelFloor(state, enabled = state ? previewEnabled(state) : true) {
const keep = state?.keepRow && !state.keepRow.hidden ? KEEP_SPACE : 0;
return (enabled ? PANEL_HEIGHT : OFF_HEIGHT) + keep;
}
function watchOwnResult(node, state) {
let images = node.imgs;
// Which output the pictures in node.imgs were loaded for. The frontend
// gives up on a picture that loads slowly and keeps the run before, so
// the panel checks this before it trusts node.imgs (ownResultIsCurrent).
state.imgsFor = outputRecord(node);
try {
Object.defineProperty(node, "imgs", {
configurable: true,
@@ -956,7 +682,6 @@ function watchOwnResult(node, state) {
get: () => images,
set: (value) => {
images = value;
state.imgsFor = outputRecord(node);
if (state.alive) scheduleRefresh(state);
},
});
@@ -975,8 +700,6 @@ function buildPanel(node, config) {
root.className = "ausboss-input-preview";
const stage = document.createElement("div");
stage.className = "ausboss-input-preview-stage";
// A cut-out's see-through parts show over a checkerboard.
if (config.checker) stage.classList.add("checker");
const img = document.createElement("img");
const video = document.createElement("video");
video.muted = true;
@@ -987,9 +710,7 @@ function buildPanel(node, config) {
const toastEl = document.createElement("div");
toastEl.className = "ausboss-input-preview-toast";
toastEl.style.display = "none";
const grid = document.createElement("div");
grid.className = "ausboss-input-preview-grid";
stage.append(img, video, grid, hint, toastEl);
stage.append(img, video, hint, toastEl);
const bar = document.createElement("div");
bar.className = "ausboss-input-preview-bar";
root.append(bar, stage);
@@ -999,7 +720,7 @@ function buildPanel(node, config) {
const widget = node.addDOMWidget(WIDGET_NAME, "ausboss_input_preview", root, {
serialize: false,
hideOnZoom: false,
getMinHeight: () => panelFloor(node.__ausbossInputPreview, enabled()),
getMinHeight: () => (enabled() ? PANEL_HEIGHT : OFF_HEIGHT),
});
keepDomWidgetWidthAuto(widget);
// Not saved with the workflow either: options.serialize only keeps it out
@@ -1011,7 +732,7 @@ function buildPanel(node, config) {
// dragged taller. With the preview off the floor is the bar alone.
fillNodeHeight(widget, {
minWidth: () => previewMinWidth(node.__ausbossInputPreview),
minHeight: () => panelFloor(node.__ausbossInputPreview, enabled()),
minHeight: () => (enabled() ? PANEL_HEIGHT : OFF_HEIGHT),
minNodeSize: [PANEL_MIN_WIDTH, 90],
exactMinWidth: true,
});
@@ -1023,10 +744,7 @@ function buildPanel(node, config) {
noun: config.noun,
switchTitle: config.switchTitle,
advanced: config.advanced,
root, bar, stage, img, video, grid, hint, widget, abort,
// Several pictures open side by side; the arrows pick one (false).
all: true,
gridKey: "",
root, bar, stage, img, video, hint, widget, abort,
toast: toastEl,
toastTimer: 0,
toolButtons: null,
@@ -1042,7 +760,6 @@ function buildPanel(node, config) {
};
livePanels.add(state);
if (config.tools?.length) bar.append(buildTools(state, config.tools, abort.signal));
if (config.keep) bar.after(buildKeepRow(state, config.keep, abort.signal));
if (config.readout) {
state.readout = document.createElement("span");
state.readout.className = "ausboss-input-preview-readout";
@@ -1060,27 +777,10 @@ function buildPanel(node, config) {
syncAdvanced(state);
installPreviewSwitch(state, abort.signal);
if (config.steps) installStepsSwitch(state, abort.signal);
if (config.live) {
state.live = mountLive(state, config.live, {
refresh: () => refresh(state),
// A run that came while the preview was off left an older picture.
record: () => (state.stale ? null : outputRecord(node) ?? null),
hasResult: () => resultCount(state) > 0,
resultUrl: () => storedResultUrl(node),
viewUrl: (query) => api.apiURL(`/view?${query}`),
});
}
// The grid is laid out for the stage's shape, so a resized node lays it out again.
if (typeof ResizeObserver === "function") {
const watcher = new ResizeObserver(() => { if (state.alive && state.gridKey) layoutGrid(state); });
watcher.observe(stage);
abort.signal.addEventListener("abort", () => watcher.disconnect(), { once: true });
}
img.addEventListener("load", () => { stage.classList.remove("loading-image"); showMedia(state, "image"); });
img.addEventListener("load", () => showMedia(state, "image"));
img.addEventListener("error", () => {
stage.classList.remove("loading-image");
if (img.getAttribute("src") && !dropLightPreview(state)) showPlaceholder(state, true);
if (img.getAttribute("src")) showPlaceholder(state, true);
});
video.addEventListener("loadeddata", () => showMedia(state, "video"));
video.addEventListener("error", () => {
@@ -1149,9 +849,9 @@ app.registerExtension({
if (state) scheduleRefresh(state);
});
chainCallback(nodeType.prototype, "onConfigure", function () {
const state = this.__ausbossInputPreview;
queueMicrotask(() => {
if (!state?.alive || this.__ausbossInputPreview !== state) return;
const state = buildPanel(this, config);
if (!state) return;
// onNodeCreated already built the panel before this node's saved
// properties existed, so the advanced toggle has to be re-applied
// here or a workflow always reopens in the simple state.
@@ -1185,7 +885,6 @@ app.registerExtension({
clearTimeout(state.toastTimer);
state.timer = 0;
state.abort?.abort();
state.live?.dispose();
unwatchSource(state);
clearMedia(state);
for (const forget of state.forgetSteps ?? []) forget();
+2 -2
View File
@@ -17,8 +17,8 @@
// it. Ctrl (or Alt) while dragging leaves the grid off. The grid starts off
// over a picture on `background`; a click on Grid is saved with the node.
import { api } from "../../../scripts/api.js";
import { app } from "../../../scripts/app.js";
import { api } from "/scripts/api.js";
import { app } from "/scripts/app.js";
import { BRAND, chainCallback, keepDomWidgetWidthAuto, notifyAusbossChange, showToast } from "../shared/index.mjs";
import { keepKeyInField } from "../shared/canvas_passthrough.mjs";
import { describeSourcePreview, outputLocatorId } from "../shared/input_preview.mjs";
-329
View File
@@ -1,329 +0,0 @@
// Check layout 🆎 (canvas right-click menu and command palette): lists what
// makes a workflow hard to read and moves nothing. Overlapping nodes and
// groups, wires that run backwards or hide behind a node, a node close under
// one that grows when it runs, nodes outside every group, a saved zoom too
// small to read and a missing Workflow Note, on the top level and inside
// every subgraph. Click an entry to jump to it. The decisions live in
// js/shared/layout_check_math.mjs under node:test.
import { app } from "../../../scripts/app.js";
import { t } from "../shared/i18n.mjs";
import { THEME as T, FONT_UI } from "../shared/theme.mjs";
import { compactAction } from "../shared/panel_controls.mjs";
import { CALLOUT_TYPES, NOTE_TYPES } from "../shared/note_identity.mjs";
import { normalizeNote } from "../shared/workflow_note.mjs";
import { frameBounds } from "../shared/workflow_switches.mjs";
import { KINDS, MIN_ZOOM, checkLayout, countByKind, jumpViewport } from "../shared/layout_check_math.mjs";
const CSS_ID = "ausboss-layout-check-css";
const LABEL = "Check layout";
const FRAME_FILL = 0.8;
// Core nodes that get taller once a run shows its picture or text in them.
// The pack's own preview nodes keep their size (js/input_preview/).
const GROWS = new Set(["PreviewImage", "SaveImage", "SaveAnimatedWEBP", "SaveAnimatedPNG", "SaveWEBM", "SaveVideo", "PreviewAny"]);
const KIND_LABEL = {
"overlap": "Overlapping",
"group-overlap": "Groups overlapping",
"under-grower": "Under a node that grows",
"hidden-wire": "Wire behind a node",
"backward-wire": "Wire runs backwards",
"outside-group": "Outside every group",
"no-groups": "No groups",
"zoom": "Zoomed out too far",
"no-note": "No Workflow Note",
};
function ensureCss() {
if (document.getElementById(CSS_ID)) return;
const style = document.createElement("style");
style.id = CSS_ID;
style.textContent = `
.ausboss-layout-check{position:fixed;z-index:1000;display:flex;flex-direction:column;box-sizing:border-box;width:360px;max-height:70vh;overflow:hidden;border:1px solid ${T.rule};border-radius:10px;background:${T.card};box-shadow:0 12px 40px #0009;color:${T.inkSoft};font:12px/1.4 ${FONT_UI}}
.ausboss-layout-check header{display:flex;align-items:center;gap:6px;padding:10px 10px 8px 14px;border-bottom:1px solid ${T.rule}}
.ausboss-layout-check header b{color:${T.ink};font-size:13px;font-weight:650}
.ausboss-layout-check header span{margin-right:auto;color:${T.faint}}
.ausboss-layout-check-list{overflow:auto;padding:4px 0 6px}
.ausboss-layout-check h4{display:flex;align-items:center;gap:6px;margin:10px 14px 4px;color:${T.label};font:600 11px/1.25 ${FONT_UI}}
.ausboss-layout-check h4 i{color:${T.faint};font-style:normal}
.ausboss-layout-check-row{display:block;box-sizing:border-box;width:100%;padding:5px 12px 5px 11px;border:0;border-left:3px solid transparent;background:transparent;color:${T.inkSoft};font:12px/1.35 ${FONT_UI};text-align:left;cursor:pointer}
.ausboss-layout-check-row:hover{background:${T.fill}}
.ausboss-layout-check-row.is-picked{border-left-color:${T.brand};background:${T.brandSoft}}
.ausboss-layout-check-row:focus-visible{outline:2px solid ${T.brand};outline-offset:-2px}
.ausboss-layout-check-row small{display:block;color:${T.faint};font-size:11px}
.ausboss-layout-check-row.is-info{cursor:default}
.ausboss-layout-check-row.is-info:hover{background:transparent}
.ausboss-layout-check-clean{padding:12px 14px;color:${T.inkSoft}}
.ausboss-layout-check-clean small{display:block;margin-top:2px;color:${T.faint};font-size:11px}
.ausboss-layout-check footer{padding:7px 14px 9px;border-top:1px solid ${T.rule};color:${T.faint};font-size:11px}
`;
document.head.append(style);
}
const el = (tag, className, text) => {
const node = document.createElement(tag);
if (className) node.className = className;
if (text !== undefined && text !== null) node.textContent = text;
return node;
};
// A name from the graph: never translated, whatever it says.
const nameSpan = (text) => {
const span = el("span", "", text);
span.dataset.noI18n = "";
return span;
};
const LINK_MODES = { 0: "straight", 1: "linear", 2: "spline" };
function titleHeight(node) {
const LG = globalThis.LiteGraph;
const none = LG?.NO_TITLE;
if (none !== undefined && (node.title_mode === none || node.constructor?.title_mode === none)) return 0;
return LG?.NODE_TITLE_HEIGHT ?? 30;
}
// A graph as plain numbers for checkLayout.
function readGraph(graph, top) {
const LG = globalThis.LiteGraph;
const nodes = (graph._nodes ?? graph.nodes ?? []).map((node) => {
const collapsed = Boolean(node.flags?.collapsed);
const kind = NOTE_TYPES.has(node.type) ? "note" : CALLOUT_TYPES.has(node.type) ? "callout" : null;
return {
id: node.id,
x: node.pos[0],
y: node.pos[1],
w: collapsed ? (node._collapsed_width ?? LG?.NODE_COLLAPSED_WIDTH ?? 80) : node.size[0],
h: collapsed ? 0 : node.size[1],
titleHeight: titleHeight(node),
grows: GROWS.has(node.type),
kind,
};
});
const mode = app.canvas?.links_render_mode;
const links = [];
if (mode !== LG?.HIDDEN_LINK) {
const all = graph.links instanceof Map ? [...graph.links.values()] : Object.values(graph.links ?? {});
for (const link of all) {
const from = link && graph.getNodeById?.(link.origin_id);
const to = link && graph.getNodeById?.(link.target_id);
if (!from || !to) continue;
const start = from.getConnectionPos?.(false, link.origin_slot);
const end = to.getConnectionPos?.(true, link.target_slot);
if (!start || !end) continue;
const via = [];
for (let id = link.parentId, guard = 0; id !== undefined && id !== null && guard < 64; guard++) {
const reroute = graph.reroutes?.get?.(id);
if (!reroute) break;
via.unshift([reroute.pos[0], reroute.pos[1]]);
id = reroute.parentId;
}
links.push({ id: link.id, from: from.id, to: to.id, points: [[start[0], start[1]], ...via, [end[0], end[1]]] });
}
}
const groups = (graph.groups ?? graph._groups ?? []).map((group) => {
const [x, y, w, h] = group._bounding ?? [group.pos[0], group.pos[1], group.size[0], group.size[1]];
return { id: group.id, x, y, w, h };
});
const shape = { nodes, links, groups, linkMode: LINK_MODES[mode] ?? "spline", topLevel: top };
if (top) {
const notes = (graph._nodes ?? []).filter((node) => NOTE_TYPES.has(node.type));
shape.noteFilled = notes.some((node) => {
const note = normalizeNote(node.widgets?.find((widget) => widget.name === "note")?.value);
return Boolean(note.title && note.body.trim());
});
if (app.canvas?.graph === graph) shape.scale = app.canvas.ds?.scale;
}
return shape;
}
// Every issue of the workflow, each with the graph it is in and the names of
// the boxes that lead there.
function findIssues() {
const root = app.rootGraph ?? app.graph;
if (!root) return [];
const graphs = [{ graph: root, path: [] }];
for (const sub of root.subgraphs?.values?.() ?? []) graphs.push({ graph: sub, path: [sub.name || "Subgraph"] });
const out = [];
for (const { graph, path } of graphs) {
for (const issue of checkLayout(readGraph(graph, path.length === 0))) out.push({ ...issue, graph, path });
}
return out.sort((a, b) => KINDS.indexOf(a.kind) - KINDS.indexOf(b.kind));
}
const nodeName = (graph, id) => {
const node = graph.getNodeById?.(id);
return node?.getTitle?.() ?? node?.title ?? String(id);
};
const groupName = (graph, id) => (graph.groups ?? []).find((group) => group.id === id)?.title || "Group";
// The two lines of an entry: what, and why or where.
function describe(issue) {
const { graph } = issue;
const names = (ids) => ids.map((id) => nodeName(graph, id));
const main = [];
const small = [];
const wires = issue.wires > 1 ? [" · ", el("span", "", `${issue.wires} wires`)] : [];
switch (issue.kind) {
case "overlap":
main.push(nameSpan(names(issue.nodes).join(" × ")));
small.push("Title bars count too");
break;
case "group-overlap":
main.push(nameSpan(issue.groups.map((id) => groupName(graph, id)).join(" × ")));
small.push("One group crosses the other");
break;
case "under-grower":
main.push(nameSpan(nodeName(graph, issue.nodes[0])));
small.push(el("span", "", "Under:"), " ", nameSpan(nodeName(graph, issue.nodes[1])));
break;
case "hidden-wire":
main.push(nameSpan(names(issue.nodes.slice(0, 2)).join(" → ")));
small.push(el("span", "", "Behind:"), " ", nameSpan(names(issue.behind).join(", ")), ...wires);
break;
case "backward-wire":
main.push(nameSpan(names(issue.nodes).join(" → ")));
small.push(el("span", "", "Ends left of where it starts"), ...wires);
break;
case "outside-group":
main.push(nameSpan(nodeName(graph, issue.nodes[0])));
small.push("Move it into a group");
break;
case "no-groups":
main.push("Nothing here is in a group");
small.push("Put each step in a numbered group");
break;
case "zoom":
main.push(el("span", "", "Saved zoom:"), " ", nameSpan(issue.scale.toFixed(2)));
small.push(el("span", "", `Below ${MIN_ZOOM.toFixed(2)} the text on nodes stops drawing`));
break;
case "no-note":
main.push(issue.empty ? "The Workflow Note has no title or steps" : "Add a Workflow Note");
small.push("It tells people what the workflow does and how to run it");
break;
default:
main.push(issue.kind);
}
if (issue.path.length) small.push(small.length ? " · " : "", el("span", "", "Inside:"), " ", nameSpan(issue.path.join(" › ")));
return { main, small };
}
// Open the graph the issue is in, select what it names and bring it into view.
function jump(issue) {
const canvas = app.canvas;
if (!canvas) return;
const { graph } = issue;
if (canvas.graph !== graph) {
const root = app.rootGraph ?? app.graph;
if (graph !== root && typeof canvas.openSubgraph === "function") canvas.openSubgraph(graph);
else canvas.setGraph?.(graph);
}
canvas.deselectAll?.();
for (const id of issue.nodes ?? []) {
const node = graph.getNodeById?.(id);
if (node) canvas.select?.(node);
}
for (const id of issue.groups ?? []) {
const group = (graph.groups ?? []).find((item) => item.id === id);
if (group) canvas.select?.(group);
}
const focus = issue.focus;
if (focus) {
const view = canvas.canvas?.getBoundingClientRect?.();
// Frame it in the part of the canvas left of the panel, so what the
// panel names is never under it.
const viewport = jumpViewport(view, panel?.getBoundingClientRect?.());
const size = viewport ? [viewport[2], viewport[3]] : [view?.width, view?.height];
const rect = frameBounds([focus[0], focus[1], focus[2] - focus[0], focus[3] - focus[1]], size, FRAME_FILL);
const options = viewport ? { zoom: FRAME_FILL, viewport } : { zoom: FRAME_FILL };
if (typeof canvas.animateToBounds === "function") canvas.animateToBounds(rect, options);
else canvas.ds?.fitToBounds?.(rect, options);
}
canvas.setDirty?.(true, true);
}
let panel = null;
function onKey(event) {
if (event.key !== "Escape" || !panel || event.target?.closest?.("input,textarea,select,[contenteditable]")) return;
closePanel();
}
function closePanel() {
if (!panel) return;
panel.remove();
panel = null;
window.removeEventListener("keydown", onKey, true);
}
function fill(list, count) {
const issues = findIssues();
list.replaceChildren();
count.textContent = issues.length === 0 ? "Nothing to fix" : issues.length === 1 ? "1 thing to look at" : `${issues.length} things to look at`;
if (!issues.length) {
const clean = el("div", "ausboss-layout-check-clean", "Nothing to fix.");
clean.append(el("small", "", "No overlaps, no hidden or backwards wires, and every node sits in a group."));
list.append(clean);
return;
}
for (const [kind, total] of countByKind(issues)) {
const heading = el("h4", "", KIND_LABEL[kind] ?? kind);
heading.append(el("i", "", String(total)));
list.append(heading);
for (const issue of issues.filter((item) => item.kind === kind)) {
const { main, small } = describe(issue);
const canJump = Boolean(issue.focus || issue.nodes?.length || issue.groups?.length);
const row = el(canJump ? "button" : "div", `ausboss-layout-check-row${canJump ? "" : " is-info"}`);
if (canJump) row.type = "button";
row.append(...main);
if (small.length) {
const line = el("small");
line.append(...small);
row.append(line);
}
if (canJump) {
row.addEventListener("click", () => {
list.querySelector(".is-picked")?.classList.remove("is-picked");
row.classList.add("is-picked");
jump(issue);
});
}
list.append(row);
}
}
}
function openPanel() {
closePanel();
ensureCss();
panel = el("div", "ausboss-layout-check");
panel.setAttribute("role", "dialog");
panel.setAttribute("aria-label", LABEL);
const head = el("header");
const count = el("span");
const again = compactAction("Check again", "Look at the workflow again after a change");
const close = compactAction("✕", "Close");
head.append(el("b", "", LABEL), count, again, close);
const list = el("div", "ausboss-layout-check-list");
panel.append(head, list, el("footer", "", "Click an entry to jump to it. Nothing is moved."));
again.addEventListener("click", () => fill(list, count));
close.addEventListener("click", closePanel);
// The panel is not part of the canvas: a press here must not start a drag.
panel.addEventListener("pointerdown", (event) => event.stopPropagation());
const rect = app.canvas?.canvas?.getBoundingClientRect?.();
panel.style.left = `${(rect?.right ?? window.innerWidth) - 376}px`;
panel.style.top = `${(rect?.top ?? 0) + 100}px`;
document.body.append(panel);
window.addEventListener("keydown", onKey, true);
fill(list, count);
}
app.registerExtension({
name: "AusBoss.LayoutCheck",
commands: [{ id: "AusBoss.CheckLayout", label: `AusBoss: ${LABEL}`, function: openPanel }],
getCanvasMenuItems() {
return [{ content: `${t(LABEL)} 🆎`, callback: openPanel }];
},
afterConfigureGraph() {
closePanel();
},
});
+1 -4
View File
@@ -1,4 +1,4 @@
import { app } from "../../../scripts/app.js";
import { app } from "/scripts/app.js";
import { BRAND, notifyAusbossChange, showToast } from "../shared/index.mjs";
import { enoughFor, lineUp, matchWidth, sameSize, sharedSides, spreadEvenly } from "../shared/line_up.mjs";
import { outlineOf } from "../shared/outline.mjs";
@@ -288,9 +288,6 @@ function syncSizes() {
const grabbed = together.grabbed;
if (!grabbed) return;
const was = together.before.get(grabbed);
// A handle click is not a resize. Once a drag starts, keep syncing even
// when it returns to its starting size so the other nodes follow it back.
if (!together.sides && grabbed.size[0] === was.size[0] && grabbed.size[1] === was.size[1]) return;
together.sides ??= sharedSides(
[...together.before.values()].map(({ pos, size }) => ({ x: pos[0], y: pos[1], w: size[0], h: size[1] })),
);
-99
View File
@@ -1,99 +0,0 @@
// Load Audio's window rules for the face, mirroring audio_window in
// nodes/_audio_trim_helpers.py so the wave shows exactly what one Run hands
// on. Pure: tests/load_audio_window.test.mjs runs it without a browser.
function finite(value, fallback = 0) {
const number = Number(value);
return Number.isFinite(number) ? number : fallback;
}
// The pick, and what comes out of it. `end` 0 means "to the end of the
// file". A max above 0 keeps the start and cuts off anything past
// start + max. All times in seconds; duration is the file's length.
export function outputWindow(durationValue, startValue, endValue, maxValue = 0) {
const duration = Math.max(0, finite(durationValue));
const start = Math.min(Math.max(0, finite(startValue)), duration);
const pickedEnd = finite(endValue) > 0 ? Math.min(finite(endValue), duration) : duration;
const end = Math.max(start, pickedEnd);
const max = Math.max(0, finite(maxValue));
const keepEnd = max > 0 && end - start > max ? Math.min(duration, start + max) : end;
return { start, end, keepEnd, length: keepEnd - start, cut: Math.max(0, end - keepEnd) };
}
const hundredth = (value) => Math.round(value * 100) / 100;
// What the face stores for a pick from `start` to `end`: a Start and a
// Duration (max_seconds, with end_seconds at 0, "to the end"). A pick that
// reaches the end of the file needs no Duration. When another node sets the
// Duration or the end, the pick is stored as a start and an end instead.
// A key left out is not written.
export function pickWrites(durationValue, startValue, endValue, { maxLinked = false, endLinked = false } = {}) {
const duration = Math.max(0, finite(durationValue));
const start = hundredth(Math.min(Math.max(0, finite(startValue)), duration));
const end = hundredth(Math.max(start, Math.min(finite(endValue), duration)));
const toEnd = end >= duration - 0.005;
if (endLinked) return { start };
if (maxLinked) return { start, end: toEnd ? 0 : end };
return { start, end: 0, max: toEnd ? 0 : Math.max(0.01, hundredth(end - start)) };
}
// A value typed into Start, Duration or Ends at, as the pick it makes.
// Start keeps the Duration; Duration and Ends at keep the start. An empty
// or 0 Duration, and an empty Ends at, run to the end of the file.
export function typedPick(key, value, window, durationValue, minimum = 0.1) {
const duration = Math.max(0, finite(durationValue));
const clampTime = (time) => Math.min(duration, Math.max(0, finite(time)));
if (key === "start") {
const start = clampTime(value);
return { start, end: Math.min(duration, start + window.length) };
}
if (value == null || (key === "duration" && !(finite(value) > 0))) return { start: window.start, end: duration };
const end = key === "duration" ? window.start + Math.max(minimum, finite(value)) : Math.max(window.start + minimum, finite(value));
return { start: window.start, end: clampTime(end) };
}
// Loud and quiet across the file: for each of `buckets` slices, the lowest
// and highest sample of the channels mixed down. Channel data is a list of
// Float32Arrays (AudioBuffer.getChannelData). Returns a Float32Array of
// [min0, max0, min1, max1, ...].
export function wavePeaks(channels, bucketsValue = 1200) {
const list = Array.isArray(channels) ? channels.filter(Boolean) : [];
const buckets = Math.max(1, Math.floor(finite(bucketsValue, 1200)));
const peaks = new Float32Array(buckets * 2);
const length = list.length ? list[0].length : 0;
if (!length) return peaks;
const count = list.length;
for (let bucket = 0; bucket < buckets; bucket += 1) {
const from = Math.floor((bucket * length) / buckets);
const to = Math.max(from + 1, Math.floor(((bucket + 1) * length) / buckets));
let low = 0;
let high = 0;
for (let index = from; index < to && index < length; index += 1) {
let sample = 0;
for (let channel = 0; channel < count; channel += 1) sample += list[channel][index] || 0;
sample /= count;
if (sample < low) low = sample;
if (sample > high) high = sample;
}
peaks[bucket * 2] = low;
peaks[bucket * 2 + 1] = high;
}
return peaks;
}
// Which part of the wave a press at `fraction` (0..1 across it) grabs: a
// handle within `hitPixels` of it, the inside of the pick to slide it, or
// "jump" to move the pick there.
export function grabZone(window, durationValue, fraction, widthValue, hitPixels = 10) {
const duration = Math.max(0, finite(durationValue));
const width = Math.max(0, finite(widthValue));
if (duration <= 0 || width <= 0) return "none";
const x = Math.min(1, Math.max(0, finite(fraction))) * width;
const startX = (window.start / duration) * width;
const endX = (window.end / duration) * width;
const toStart = Math.abs(x - startX);
const toEnd = Math.abs(x - endX);
if (Math.min(toStart, toEnd) <= hitPixels) return toStart <= toEnd ? "start" : "end";
if (x > startX && x < endX) return "move";
return "jump";
}
-582
View File
@@ -1,582 +0,0 @@
// Load Audio 🆎 - the wave, the timing and the player.
//
// The card above (js/widget_cards) holds Source. This panel draws the whole
// file as a wave: the part that comes out is bright and the rest is dim.
// Under it, Start, Duration and Ends at, as on the video nodes. Drag a
// handle on the wave to move the start or the end, drag the middle to slide
// the sound, or click elsewhere to move it there. Play plays only what comes
// out. The widgets underneath stay the source of truth: the Duration is
// max_seconds with end_seconds at 0. A saved end (or a linked Max length)
// still works: the part a Max length cuts off shows red.
import { api } from "../../../scripts/api.js";
import { app } from "../../../scripts/app.js";
import { BRAND, chainCallback, keepDomWidgetWidthAuto, notifyAusbossChange, showToast } from "../shared/index.mjs";
import { WIDGET_FRAME, fillNodeHeight } from "../shared/panel_layout.mjs";
import { formatTimecode } from "../shared/timecode.mjs";
import { inputNumber } from "../shared/clip_rate.mjs";
import { makeScrubInput } from "../shared/scrub_input.mjs";
import { linkedNodeInfo } from "../shared/timing_links.mjs";
import { parseImageReference } from "../shared/pad_canvas.mjs";
import { mediaViewQuery, splitMediaName } from "../shared/video_preview.mjs";
import { ensureVideoCss, hideCanvasWidget, makeToolButton } from "../shared/video_ui.mjs";
import { MIN_TRIM_SECONDS, dragTrimHandle, slideTrimWindow } from "../load_video/trim_preview.mjs";
import { grabZone, outputWindow, pickWrites, typedPick, wavePeaks } from "./audio_window.mjs";
const NODE_NAME = "AUSBOSS_NODES_LoadAudio";
const PANEL_WIDGET = "ausboss_load_audio_wave";
// The frontend's own player for an audio_upload input. The wave replaces it.
const CORE_AUDIO_WIDGET = "audioUI";
const MIN_WIDTH = 280;
// 8px root padding + the wave's 28px floor + 6px gap + the 38px Start,
// Duration and Ends at row (a label over a box).
const PANEL_MIN_HEIGHT = 80;
// Opens small and neat: 300 px wide, with a wave about as tall as a field
// (32 px). Drag the corner down for a taller wave.
const DEFAULT_WIDTH = 300;
const DEFAULT_WAVE_EXTRA = 4;
const CUT_RED = "#e0525a";
const PEAK_BUCKETS = 1600;
const END_EPSILON = 0.03;
// Decoded once per file and kept small: only the peaks and the length.
const peakCache = new Map();
function findWidget(node, name) {
return node.widgets?.find((widget) => widget.name === name);
}
function roundHundredth(value) {
return Math.round(Number(value || 0) * 100) / 100;
}
function hideCoreAudio(node) {
for (const widget of node.widgets ?? []) {
if (widget?.name === CORE_AUDIO_WIDGET) hideCanvasWidget(widget, widget.element);
}
}
function linked(node, name) {
return !!node.inputs?.some((slot) => slot?.widget?.name === name && slot.link != null);
}
// A value as the run will see it: the widget, or the number a linked input
// carries when the far end is a typed number (through Reroutes and
// subgraphs). null when only the run knows it.
function valueOf(state, name, widget) {
if (!linked(state.node, name)) return Number(widget?.value) || 0;
return inputNumber(state.node, name, null);
}
function maxSeconds(state) {
const fromLink = linked(state.node, "max_seconds");
const value = valueOf(state, "max_seconds", state.maxWidget);
return { value: value ?? 0, fromLink, known: value != null };
}
function currentWindow(state) {
const start = valueOf(state, "start_seconds", state.startWidget) ?? 0;
const max = maxSeconds(state).value;
let end = valueOf(state, "end_seconds", state.endWidget) ?? 0;
// No end and a Duration: the Duration is where the sound stops, so
// nothing past it shows as cut off. Only an end past the Duration does.
if (!(end > 0) && max > 0 && state.duration > 0) end = Math.min(state.duration, Math.max(0, start) + max);
return outputWindow(state.duration, start, end, max);
}
async function loadPeaks(name, route) {
const key = name;
if (peakCache.has(key)) return peakCache.get(key);
const job = (async () => {
const response = await api.fetchApi(route, { cache: "no-store" });
if (!response.ok) throw new Error(`the file could not be read (${response.status})`);
const bytes = await response.arrayBuffer();
const Context = window.AudioContext || window.webkitAudioContext;
const context = new Context();
try {
const buffer = await context.decodeAudioData(bytes);
const channels = [];
for (let index = 0; index < buffer.numberOfChannels; index += 1) channels.push(buffer.getChannelData(index));
return { duration: buffer.duration, peaks: wavePeaks(channels, PEAK_BUCKETS) };
} finally {
context.close?.();
}
})();
peakCache.set(key, job);
job.catch(() => peakCache.delete(key));
return job;
}
function ensureAudioCss() {
ensureVideoCss();
if (document.getElementById("ausboss-load-audio-css")) return;
const style = document.createElement("style");
style.id = "ausboss-load-audio-css";
style.textContent = `
.ausboss-audio-root .ausboss-video-stage{min-height:28px;background:#050b0b;cursor:pointer;touch-action:none;}
.ausboss-audio-error{pointer-events:auto;border:0;background:transparent;color:#e6bf87;font:11px system-ui;cursor:pointer;white-space:nowrap}
.ausboss-audio-root canvas.ausboss-audio-wave{position:absolute;inset:0;width:100%;height:100%;display:block;}
.ausboss-audio-root .ausboss-video-stage:not(.is-empty) .ausboss-video-status{display:none;}
.ausboss-audio-root .ausboss-audio-wave-row{display:flex;align-items:stretch;gap:6px;flex:1 1 auto;min-height:28px;}
.ausboss-audio-root .ausboss-audio-wave-row .ausboss-video-stage{flex:1 1 auto;min-width:0;}
.ausboss-audio-root .ausboss-audio-play{flex:none;align-self:center;min-width:30px;font-size:10px;}
.ausboss-audio-fields{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;flex:none;padding:0 2px;color:#ddd;font:11px system-ui;}
.ausboss-audio-field{display:flex;flex-direction:column;gap:2px;min-width:0;}
.ausboss-audio-field .ausboss-scrub{width:100%;box-sizing:border-box;}
.ausboss-audio-field-label{display:flex;align-items:center;gap:6px;min-width:0;color:#cadddb;}
.ausboss-audio-go{border:0;background:transparent;padding:0;color:#45d6cb;font:600 10px system-ui;text-decoration:underline;cursor:pointer;}
.ausboss-audio-go[hidden]{display:none;}
`;
document.head.appendChild(style);
}
function draw(state) {
const { canvas } = state;
const rect = canvas.getBoundingClientRect();
const scale = window.devicePixelRatio || 1;
const width = Math.max(1, Math.round(rect.width * scale));
const height = Math.max(1, Math.round(rect.height * scale));
if (canvas.width !== width || canvas.height !== height) {
canvas.width = width;
canvas.height = height;
}
const ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, width, height);
if (!state.peaks || state.duration <= 0) return;
const win = currentWindow(state);
const xOf = (seconds) => (seconds / state.duration) * width;
const startX = xOf(win.start);
const keepX = xOf(win.keepEnd);
const endX = xOf(win.end);
// Backdrops: the part that comes out, then the part cut off.
ctx.fillStyle = "rgba(0,180,170,0.13)";
ctx.fillRect(startX, 0, keepX - startX, height);
if (endX > keepX) {
ctx.fillStyle = "rgba(224,82,90,0.16)";
ctx.fillRect(keepX, 0, endX - keepX, height);
}
// The wave, one bar per pixel column.
const mid = height / 2;
const reach = mid * 0.92;
const buckets = state.peaks.length / 2;
for (let x = 0; x < width; x += 1) {
const from = Math.floor((x / width) * buckets);
const to = Math.max(from + 1, Math.floor(((x + 1) / width) * buckets));
let low = 0;
let high = 0;
for (let bucket = from; bucket < to && bucket < buckets; bucket += 1) {
low = Math.min(low, state.peaks[bucket * 2]);
high = Math.max(high, state.peaks[bucket * 2 + 1]);
}
if (x >= startX && x < keepX) ctx.fillStyle = BRAND;
else if (x >= keepX && x < endX) ctx.fillStyle = CUT_RED;
else ctx.fillStyle = "#3a4948";
const top = mid - high * reach;
ctx.fillRect(x, top, 1, Math.max(1, (high - low) * reach));
}
// The handles: IN and OUT, and a dashed line where the max cuts off.
// The grips stay small on a short wave so they don't hide it.
const grip = Math.round(Math.max(3, Math.min(7, rect.height * 0.12)) * scale);
const handle = (x, color) => {
ctx.fillStyle = color;
ctx.fillRect(Math.round(x) - scale, 0, 2 * scale, height);
ctx.fillRect(Math.round(x) - 4 * scale, 0, 8 * scale, grip);
ctx.fillRect(Math.round(x) - 4 * scale, height - grip, 8 * scale, grip);
};
handle(startX, "#f4ffff");
handle(endX, "#f4ffff");
if (endX > keepX + 1) {
ctx.strokeStyle = CUT_RED;
ctx.lineWidth = 2 * scale;
ctx.setLineDash([4 * scale, 3 * scale]);
ctx.beginPath();
ctx.moveTo(keepX, 0);
ctx.lineTo(keepX, height);
ctx.stroke();
ctx.setLineDash([]);
}
// The playhead while it plays, or where it paused inside the pick.
if (state.audio && !state.audio.paused) {
const x = xOf(state.audio.currentTime);
ctx.fillStyle = "#ffffff";
ctx.fillRect(x - scale / 2, 0, scale, height);
}
}
// One box's look: its value, whether it can be typed, and the "linked"
// button when another node sets it.
function showField(state, key, value, lockedBy, tip) {
const field = state.fields[key];
field.control.set(value);
field.control.root.style.opacity = lockedBy ? ".45" : "";
field.control.root.inert = Boolean(lockedBy);
field.go.hidden = !lockedBy;
field.cell.title = lockedBy ? `Set by ${lockedBy.title}. Click "linked" to go to that node.` : tip;
if (lockedBy) field.go.onclick = () => lockedBy.go?.();
}
function updateFace(state) {
const win = currentWindow(state);
const link = (name) => (linked(state.node, name) ? linkedNodeInfo(state.node, name) : null);
// A linked value the page cannot read is only known when the graph runs:
// its box, and the boxes that depend on it, stay empty.
const known = (name) => !linked(state.node, name) || inputNumber(state.node, name, null) != null;
const has = state.duration > 0;
const startKnown = has && known("start_seconds");
const lengthKnown = startKnown && known("max_seconds") && known("end_seconds");
showField(state, "start", startKnown ? win.start : null, link("start_seconds"), `Where the sound starts in the file, of ${formatTimecode(state.duration)}.`);
showField(state, "duration", lengthKnown ? win.length : null, link("max_seconds"),
win.cut > 0.005 ? `How long the sound is. It stops ${formatTimecode(win.cut)} before the saved end (red).` : "How long the sound is. Clear it, or type 0, to run to the end of the file.");
showField(state, "end", lengthKnown ? win.keepEnd : null, link("end_seconds"), "Where the sound stops in the file. Typing it changes the Duration.");
draw(state);
}
function writeWidget(widget, value) {
const next = roundHundredth(value);
if (Math.abs(Number(widget.value || 0) - next) < 0.0001) return;
widget.value = next;
widget.callback?.(next);
}
// The pick, stored the way the face shows it (pickWrites): a Start and a
// Duration, or a start and an end when another node sets the Duration.
function writeTrim(state, bounds) {
state.writing = true;
try {
const startLinked = linked(state.node, "start_seconds");
const writes = pickWrites(state.duration, startLinked ? currentWindow(state).start : bounds.start, bounds.end, {
maxLinked: linked(state.node, "max_seconds") || !state.maxWidget,
endLinked: linked(state.node, "end_seconds"),
});
if (!startLinked) writeWidget(state.startWidget, writes.start);
if (writes.end !== undefined) writeWidget(state.endWidget, writes.end);
if (writes.max !== undefined) writeWidget(state.maxWidget, writes.max);
} finally {
state.writing = false;
}
updateFace(state);
state.node.setDirtyCanvas?.(true, true);
}
function installDrag(state) {
const surface = state.stage;
const infoAt = (clientX) => {
const rect = state.canvas.getBoundingClientRect();
const fraction = rect.width ? Math.min(1, Math.max(0, (clientX - rect.left) / rect.width)) : 0;
const win = currentWindow(state);
return { fraction, win, zone: grabZone(win, state.duration, fraction, rect.width) };
};
surface.addEventListener("pointermove", (event) => {
if (state.dragging || state.duration <= 0) return;
const { zone } = infoAt(event.clientX);
surface.style.cursor = zone === "start" || zone === "end" ? "ew-resize" : zone === "move" ? "grab" : "pointer";
});
surface.addEventListener("pointerdown", (event) => {
if (event.button !== 0 || state.dragging || state.duration <= 0) return;
event.preventDefault();
event.stopPropagation();
const initial = infoAt(event.clientX);
const bounds = { start: initial.win.start, end: initial.win.keepEnd };
const anchor = initial.fraction * state.duration;
const downX = event.clientX;
let moved = false;
state.dragging = true;
try { surface.setPointerCapture(event.pointerId); } catch (_error) { /* mouse fallback */ }
const centred = (fraction) => {
const span = bounds.end - bounds.start;
return slideTrimWindow(state.duration, bounds, fraction * state.duration - span / 2 - bounds.start);
};
const apply = (clientX) => {
const next = infoAt(clientX);
if (initial.zone === "start" || initial.zone === "end") {
const now = currentWindow(state);
writeTrim(state, dragTrimHandle(state.duration, { start: now.start, end: now.keepEnd }, initial.zone, next.fraction, MIN_TRIM_SECONDS));
} else if (initial.zone === "move") {
writeTrim(state, slideTrimWindow(state.duration, bounds, next.fraction * state.duration - anchor));
} else {
writeTrim(state, centred(next.fraction));
}
};
const move = (moveEvent) => {
if (!(moveEvent.buttons & 1)) { finish(moveEvent); return; }
if (!moved && Math.abs(moveEvent.clientX - downX) < 3) return;
moved = true;
apply(moveEvent.clientX);
};
const finish = (finishEvent) => {
if (!state.dragging) return;
state.dragging = false;
surface.removeEventListener("pointermove", move);
try { surface.releasePointerCapture(event.pointerId); } catch (_error) { /* already released */ }
if (!moved && initial.zone === "jump") writeTrim(state, centred(infoAt(finishEvent?.clientX ?? downX).fraction));
if (moved || initial.zone === "jump") {
if (state.audio && !state.audio.paused) state.audio.currentTime = currentWindow(state).start;
notifyAusbossChange();
}
};
surface.addEventListener("pointermove", move);
surface.addEventListener("pointerup", finish, { once: true });
surface.addEventListener("pointercancel", finish, { once: true });
surface.addEventListener("lostpointercapture", finish, { once: true });
});
}
function loopEnabled(node) {
node.properties ??= {};
return !!node.properties.ausboss_load_audio_loop;
}
function installPlayer(state) {
const audio = state.audio;
const stop = () => {
if (state.raf) cancelAnimationFrame(state.raf);
state.raf = 0;
state.playButton.textContent = "▶";
state.playButton.classList.remove("active");
draw(state);
};
const tick = () => {
if (audio.paused) { stop(); return; }
const win = currentWindow(state);
if (audio.currentTime >= win.keepEnd - END_EPSILON || audio.currentTime < win.start - 0.25) {
if (loopEnabled(state.node)) audio.currentTime = win.start;
else { audio.pause(); audio.currentTime = win.start; stop(); return; }
}
draw(state);
state.raf = requestAnimationFrame(tick);
};
audio.addEventListener("play", () => {
state.playButton.textContent = "❚❚";
state.playButton.classList.add("active");
if (state.raf) cancelAnimationFrame(state.raf);
state.raf = requestAnimationFrame(tick);
}, { signal: state.abort.signal });
audio.addEventListener("pause", stop, { signal: state.abort.signal });
state.playButton.addEventListener("click", (event) => {
event.preventDefault();
event.stopPropagation();
if (state.duration <= 0) return;
if (!audio.paused) { audio.pause(); return; }
const win = currentWindow(state);
if (audio.currentTime < win.start || audio.currentTime >= win.keepEnd - END_EPSILON) audio.currentTime = win.start;
audio.play().catch(() => stop());
});
state.stopPlayer = () => { audio.pause(); stop(); };
}
function watchWidget(state, widget) {
if (!widget || widget.__ausbossAudioWatch) return;
widget.__ausbossAudioWatch = true;
const prior = widget.callback;
widget.callback = function (...args) {
const result = prior?.apply(this, args);
if (!state.writing) updateFace(state);
return result;
};
}
function buildPanel(node) {
if (node.__ausbossLoadAudio) return node.__ausbossLoadAudio;
const audioWidget = findWidget(node, "audio");
const startWidget = findWidget(node, "start_seconds");
const endWidget = findWidget(node, "end_seconds");
if (!audioWidget || !startWidget || !endWidget) return null;
ensureAudioCss();
hideCoreAudio(node);
hideCanvasWidget(startWidget);
hideCanvasWidget(endWidget);
const root = document.createElement("div");
root.className = "ausboss-video-root ausboss-audio-root";
const stage = document.createElement("div");
stage.className = "ausboss-video-stage is-empty";
stage.title = "Drag a handle to set where the sound starts or stops. Drag the middle to slide it.";
const canvas = document.createElement("canvas");
canvas.className = "ausboss-audio-wave";
const status = document.createElement("div");
status.className = "ausboss-video-status";
status.textContent = "Choose a sound file";
const playButton = makeToolButton("▶", "Play the part that comes out");
playButton.classList.add("ausboss-audio-play");
const loopButton = makeToolButton("LOOP", "Play it again and again");
stage.append(canvas, status);
// Play and Loop sit either side of the wave, so neither covers a handle.
loopButton.classList.add("ausboss-audio-play");
const waveRow = document.createElement("div");
waveRow.className = "ausboss-audio-wave-row";
waveRow.append(playButton, stage, loopButton);
// Start, Duration and Ends at, as on the video nodes, in seconds.
const fieldsRow = document.createElement("div");
fieldsRow.className = "ausboss-audio-fields";
const fields = {};
const commit = (key, value) => {
const state = node.__ausbossLoadAudio;
if (!state || state.duration <= 0) return;
writeTrim(state, typedPick(key, value, currentWindow(state), state.duration, MIN_TRIM_SECONDS));
};
for (const [key, caption] of [["start", "Start"], ["duration", "Duration"], ["end", "Ends at"]]) {
const cell = document.createElement("div");
cell.className = "ausboss-audio-field";
const label = document.createElement("span");
label.className = "ausboss-audio-field-label";
label.textContent = caption;
const go = document.createElement("button");
go.type = "button";
go.className = "ausboss-audio-go";
go.textContent = "linked";
go.hidden = true;
label.append(go);
const control = makeScrubInput({
value: 0, min: 0, max: 86400, step: 0.1, fineStep: 0.01, decimals: 2, minDecimals: 0, unit: "s", unitWidth: 14,
allowEmpty: true,
onChange: (value) => commit(key, value),
onSettle: () => notifyAusbossChange(),
});
cell.append(label, control.root);
fieldsRow.append(cell);
fields[key] = { cell, control, go };
}
root.append(waveRow, fieldsRow);
const widget = node.addDOMWidget(PANEL_WIDGET, "ausboss_audio", root, {
serialize: false,
hideOnZoom: false,
getMinHeight: () => PANEL_MIN_HEIGHT + WIDGET_FRAME,
});
keepDomWidgetWidthAuto(widget);
widget.serialize = false;
fillNodeHeight(widget, {
minWidth: MIN_WIDTH,
minHeight: PANEL_MIN_HEIGHT + WIDGET_FRAME,
minNodeSize: [MIN_WIDTH, 200],
exactMinWidth: true,
});
const audio = new Audio();
audio.preload = "auto";
const abort = new AbortController();
const state = node.__ausbossLoadAudio = {
node, root, stage, canvas, status, playButton, loopButton, audio, fields,
audioWidget, startWidget, endWidget, maxWidget: findWidget(node, "max_seconds"),
duration: 0, peaks: null, abort, writing: false, dragging: false, raf: 0, loading: 0,
};
const updateLoop = () => loopButton.classList.toggle("active", loopEnabled(node));
updateLoop();
loopButton.addEventListener("click", (event) => {
event.preventDefault();
event.stopPropagation();
node.properties.ausboss_load_audio_loop = !loopEnabled(node);
updateLoop();
notifyAusbossChange();
});
const refresh = async () => {
state.stopPlayer?.();
const name = audioWidget.value;
const ticket = ++state.loading;
state.duration = 0;
state.peaks = null;
if (!name || typeof name !== "string") {
audio.removeAttribute("src");
stage.classList.add("is-empty");
status.textContent = "Choose a sound file";
updateFace(state);
return;
}
const parts = splitMediaName(name);
stage.classList.add("is-empty");
status.textContent = `Loading ${parts.filename}…`;
const type = parseImageReference(name)?.type ?? "input";
const route = `/view?${mediaViewQuery({ ...parts, type }, "input")}`;
audio.src = api.apiURL(route);
try {
const result = await loadPeaks(name, route);
if (ticket !== state.loading) return;
state.duration = result.duration;
state.peaks = result.peaks;
stage.classList.remove("is-empty");
updateFace(state);
} catch (error) {
if (ticket !== state.loading) return;
const info = document.createElement("button");
info.type = "button";
info.className = "ausboss-audio-error";
info.textContent = "Audio preview unavailable ⓘ";
info.title = String(error?.message || error);
info.setAttribute("aria-label", "Audio preview unavailable. Show details.");
info.onclick = event => {
event.stopPropagation();
showToast({ summary: "Audio preview unavailable", detail: info.title });
};
status.replaceChildren(info);
}
};
state.refresh = refresh;
installDrag(state);
installPlayer(state);
watchWidget(state, startWidget);
watchWidget(state, endWidget);
watchWidget(state, state.maxWidget);
const observer = new ResizeObserver(() => draw(state));
observer.observe(stage);
state.observer = observer;
const priorAudioCallback = audioWidget.callback;
audioWidget.callback = function (...args) {
const result = priorAudioCallback?.apply(this, args);
peakCache.delete(audioWidget.value);
refresh();
return result;
};
setTimeout(refresh, 0);
return state;
}
app.registerExtension({
name: "ausboss.load_audio",
beforeRegisterNodeDef(nodeType, nodeData) {
if (nodeData?.name !== NODE_NAME) return;
// The frontend's Upload button for an audio_upload input looks for its
// player widget and fails without one, and it adds that player only to
// its own audio nodes. Ask for it here, ahead of the button; the panel
// hides it, since the wave plays the sound instead.
const required = nodeData.input?.required;
if (required && !required.audioUI) {
const entries = Object.entries(required);
const at = entries.findIndex(([name]) => name === "audio") + 1;
entries.splice(at, 0, ["audioUI", ["AUDIO_UI", {}]]);
nodeData.input.required = Object.fromEntries(entries);
}
chainCallback(nodeType.prototype, "onNodeCreated", function () {
buildPanel(this);
// Only for a genuinely new node: onConfigure restores a saved size
// after this runs, so a workflow's own size still wins.
const floor = Number(this.computeSize?.()?.[1]) || 0;
if (floor > 0) this.setSize?.([DEFAULT_WIDTH, floor + DEFAULT_WAVE_EXTRA]);
});
chainCallback(nodeType.prototype, "onConfigure", function () {
queueMicrotask(() => {
const state = buildPanel(this);
if (state) {
hideCoreAudio(this);
state.refresh?.();
}
});
});
// A wire into Max length changes what comes out; redraw when one comes or goes.
chainCallback(nodeType.prototype, "onConnectionsChange", function () {
const state = this.__ausbossLoadAudio;
if (state) queueMicrotask(() => updateFace(state));
});
chainCallback(nodeType.prototype, "onRemoved", function () {
const state = this.__ausbossLoadAudio;
state?.stopPlayer?.();
state?.abort?.abort();
state?.observer?.disconnect();
if (state) state.audio.removeAttribute("src");
this.__ausbossLoadAudio = null;
});
},
});
+2 -2
View File
@@ -1,5 +1,5 @@
import { api } from "../../../scripts/api.js";
import { app } from "../../../scripts/app.js";
import { api } from "/scripts/api.js";
import { app } from "/scripts/app.js";
import { isForeignRun } from "../shared/prompt_scope.mjs";
import { BRAND, chainCallback, keepDomWidgetWidthAuto, notifyAusbossChange } from "../shared/index.mjs";
import { fillNodeHeight } from "../shared/panel_layout.mjs";
+369 -159
View File
@@ -1,11 +1,9 @@
import { api } from "../../../scripts/api.js";
import { app } from "../../../scripts/app.js";
import { api } from "/scripts/api.js";
import { app } from "/scripts/app.js";
import { chainCallback, keepDomWidgetWidthAuto, notifyAusbossChange } from "../shared/index.mjs";
import { keepKeyInField } from "../shared/canvas_passthrough.mjs";
import { WIDGET_FRAME, fillNodeHeight } from "../shared/panel_layout.mjs";
import { inputNumber } from "../shared/clip_rate.mjs";
import { clipInfo, windowSeconds } from "../shared/timeline_math.mjs";
import { mountTransformTrim } from "../shared/transform_trim.mjs";
import { linkedNodeInfo, timingUnits } from "../shared/timing_links.mjs";
import { formatTimecode, parseTimecode } from "../shared/timecode.mjs";
import { parseImageReference } from "../shared/pad_canvas.mjs";
import {
mediaInfo,
@@ -21,31 +19,42 @@ import {
suppressCoreVideoPreview,
} from "../shared/video_ui.mjs";
import {
MIN_TRIM_SECONDS,
clampTrimSeek,
closestTrimHandle,
dragTrimHandle,
loadSummary,
playbackBoundaryAction,
singleFrameFraction,
singleFrameTime,
slideTrimWindow,
trimAfterFramePick,
trimBounds,
trimFractions,
} from "./trim_preview.mjs";
const NODE_NAME = "AUSBOSS_NODES_LoadVideo";
const PREVIEW_WIDGET = "ausboss_load_video_viewer";
const PREVIEW_CHROME = 88;
// 8px root padding + the stage's 112px floor + 6px gap + the 152px timing
// card (js/shared/transform_trim.mjs). The declared floor adds WIDGET_FRAME
// on top, or the element comes up short and clips the card's bottom border
// at the node's minimum height.
const PANEL_MIN_HEIGHT = 278;
// The shared video root's CSS minimum: 8px root padding + the stage's 112px
// floor + 6px gap + the 76px trim strip. The declared floor adds
// WIDGET_FRAME on top, or the element comes up short and clips the trim
// strip's bottom border at the node's minimum height.
const PANEL_MIN_HEIGHT = 202;
// Height the node opens at. It used to fall out of the panel's computeSize;
// with the panel free to follow the node, the default has to be stated. The
// extra covers the tools over the picture and the timing card under it.
const DEFAULT_NODE_SIZE = [380, responsivePreviewHeight(380) + PREVIEW_CHROME + 210];
// chrome covers the transport row and the trim strip under the player.
const DEFAULT_NODE_SIZE = [380, responsivePreviewHeight(380) + PREVIEW_CHROME + 190];
const TRIM_EPSILON = 0.04;
function findWidget(node, name) {
return node.widgets?.find((widget) => widget.name === name);
}
function roundHundredth(value) {
return Math.round(Number(value || 0) * 100) / 100;
}
function getLoopEnabled(node) {
node.properties ??= {};
if (node.properties.ausboss_load_video_loop === undefined) {
@@ -57,25 +66,14 @@ function getLoopEnabled(node) {
function setEmpty(state, text) {
state.stage.classList.add("is-empty");
state.status.textContent = text;
state.status.hidden = false;
}
function setReady(state, text) {
state.stage.classList.remove("is-empty");
state.status.textContent = text;
state.status.hidden = !text;
}
// The run's window in seconds, as the timing card works it out (Start, and
// the Duration or the end), or the plain start/end before the video's frame
// rate is known.
function currentBounds(state) {
const info = clipInfo(state.metadata);
const window = state.card?.window?.();
if (info.fps > 0 && window && Number.isFinite(window.first)) {
const last = Number.isFinite(window.last) ? window.last : info.count - 1;
return { start: window.first / info.fps, end: Math.min(info.duration || Infinity, (last + 1) / info.fps) };
}
return trimBounds(state.video.duration, state.startWidget.value, state.endWidget.value);
}
@@ -84,116 +82,271 @@ function isSingleFrame(state) {
}
// Where the preview belongs for the current mode: the chosen frame, or the
// clip's start.
// trim window's IN point.
function homeTime(state) {
return isSingleFrame(state)
? singleFrameTime(state.video.duration, state.startWidget.value)
: currentBounds(state).start;
}
function widgetLinkDriven(node, name) {
return !!node.inputs?.some((input) => input?.widget?.name === name && input.link != null);
}
// Frame rate and the real frame count come from the pack's metadata route:
// the <video> element knows neither, and its length rounds up a frame.
// Fail-soft: without it the card waits for a source.
async function probeMetadata(state, name) {
state.metadata = null;
try {
const query = new URLSearchParams({ source_mode: "input folder", video: name });
const type = parseImageReference(name)?.type;
if (type && type !== "input") {
query.set("source_mode", "local path");
query.set("local_path", name);
}
const response = await api.fetchApi(`/ausboss/transform/video/metadata?${query}`);
if (!response.ok) return;
const metadata = await response.json();
if (state.videoWidget.value !== name) return; // a newer selection won
state.metadata = metadata;
state.card?.sync();
} catch (_error) {
/* no metadata, no timing card numbers */
}
}
function setWidget(widget, value) {
if (!widget) return;
if (widget.value === value) return;
widget.value = value;
widget.callback?.(value);
}
// The timing card: the clip node's own, with Start, Duration and Ends at,
// or, while FRAME is on, its frame picker. The player above it is the
// picture, so the card leaves out its own Play button.
function mountCard(state) {
const { node } = state;
const widgetFor = (name) => node.widgets?.find((widget) => widget.name === name);
const fps = () => clipInfo(state.metadata).fps;
const single = isSingleFrame(state);
const card = mountTransformTrim({
get: (name, fallback) => {
if (name === "frame_index") return state.head ?? 0;
const widget = widgetFor(name);
return widget ? widget.value : fallback;
},
set: (name, value) => {
state.writing = true;
try { setWidget(widgetFor(name), value); } finally { state.writing = false; }
if (state.video.readyState >= 1 && !state.video.paused) return;
node.setDirtyCanvas?.(true, true);
},
has: (name) => Boolean(widgetFor(name)),
driven: (name) => widgetLinkDriven(node, name),
number: (name, fallback) => inputNumber(node, name, fallback),
metadata: () => state.metadata,
trim: !single,
play: false,
isPlaying: () => !state.video.paused,
onTogglePlayback: () => {},
onSeek: (frame, settled) => {
state.head = frame;
const rate = fps();
if (single && rate > 0) {
state.writing = true;
try { setWidget(state.startWidget, windowSeconds(clipInfo(state.metadata), frame, frame).start_seconds); } finally { state.writing = false; }
}
if (state.video.readyState >= 1 && rate > 0) state.video.currentTime = Math.min(state.video.duration || Infinity, (frame + 0.5) / rate);
if (settled) notifyAusbossChange();
},
onCommit: notifyAusbossChange,
linkInfo: (name) => linkedNodeInfo(node, name),
units: () => timingUnits(),
setUnits: (next) => timingUnits(next),
});
state.card?.root.remove();
state.card = card;
state.cardSlot.append(card.root);
return card;
}
function applyMode(state) {
const single = isSingleFrame(state);
state.root.classList.toggle("is-single-frame", single);
state.frameButton?.classList.toggle("active", single);
if (state.cardMode !== single) {
state.cardMode = single;
mountCard(state);
}
state.card?.sync();
state.startLabel.textContent = single ? "AT" : "IN";
state.range.title = single
? "Drag or click to choose the frame that loads"
: "Drag either handle to set the trim; drag the selected range to move it";
updateTrimFace(state);
}
// The playhead follows the player, so the card's marker and readout move
// with the picture.
function followPlayer(state) {
const rate = clipInfo(state.metadata).fps;
if (!(rate > 0)) return;
const frame = Math.max(0, Math.floor(state.video.currentTime * rate + 1e-6));
if (frame === state.head) return;
state.head = frame;
state.card?.sync();
function widgetLinkDriven(node, name) {
return !!node.inputs?.some((input) => input?.widget?.name === name && input.link != null);
}
// The honest "what will actually load" text for the label under the trim
// strip, or "" when there is nothing honest to say. Any of the deciding
// widgets driven by a link means its face value is stale, so the count
// drops out rather than guessing.
function trimLoadSummary(state, duration, bounds) {
const deciders = ["start_seconds", "end_seconds", "every_nth", "max_frames", "single_frame"];
if (deciders.some((name) => widgetLinkDriven(state.node, name))) return "";
return loadSummary(
duration,
bounds,
state.sourceFps,
state.everyNthWidget?.value,
state.maxFramesWidget?.value,
isSingleFrame(state),
);
}
// The <video> element never exposes the source frame rate, so the frame
// count in the label needs a probe of the pack's metadata route. Fail-soft:
// on any error the label simply omits the count and the timecodes stand.
async function probeSourceFps(state, name) {
state.sourceFps = 0;
try {
const query = new URLSearchParams({ source_mode: "input folder", video: name });
const response = await api.fetchApi(`/ausboss/transform/video/metadata?${query}`);
if (!response.ok) return;
const metadata = await response.json();
if (state.videoWidget.value !== name) return; // a newer selection won
state.sourceFps = Math.max(0, Number(metadata?.fps) || 0);
updateTrimFace(state);
} catch (_error) {
/* no fps, no frame count */
}
}
function writeWidget(widget, value) {
const next = roundHundredth(value);
if (Math.abs(Number(widget.value || 0) - next) < 0.0001) return;
widget.value = next;
widget.callback?.(next);
}
function writeTrim(state, bounds, seekEdge = null) {
state.writing = true;
try {
writeWidget(state.startWidget, bounds.start);
writeWidget(state.endWidget, bounds.end);
} finally {
state.writing = false;
}
updateTrimFace(state);
if (state.video.readyState >= 1 && seekEdge) {
state.video.currentTime = seekEdge === "start"
? bounds.start
: Math.max(bounds.start, bounds.end - TRIM_EPSILON);
}
state.node.setDirtyCanvas?.(true, true);
state.node.graph?.setDirtyCanvas?.(true, true);
}
function writeFrameTime(state, timeValue) {
const duration = Number.isFinite(state.video.duration) ? state.video.duration : 0;
const time = singleFrameTime(duration, timeValue);
state.writing = true;
try {
writeWidget(state.startWidget, time);
} finally {
state.writing = false;
}
updateTrimFace(state);
if (state.video.readyState >= 1) state.video.currentTime = time;
state.node.setDirtyCanvas?.(true, true);
state.node.graph?.setDirtyCanvas?.(true, true);
}
function updateTrimFace(state) {
const duration = Number.isFinite(state.video.duration) ? state.video.duration : 0;
if (isSingleFrame(state)) {
const time = singleFrameTime(duration, state.startWidget.value);
const percent = singleFrameFraction(duration, time) * 100;
state.selection.style.width = "0%";
state.startHandle.style.left = `${percent}%`;
if (document.activeElement !== state.startInput) state.startInput.value = formatTimecode(time);
// "1 frame at 0:05.2" - the count comes from the same pure summary the
// trim label uses, so both modes report what one Run will load.
const summary = trimLoadSummary(state, duration, null);
state.durationLabel.textContent = duration > 0
? `${summary || "frame"} at ${formatTimecode(time)}`
: "load a video to pick a frame";
if (duration > 0) state.status.textContent = `frame at ${formatTimecode(time)}`;
return;
}
const bounds = trimBounds(duration, state.startWidget.value, state.endWidget.value);
const fractions = trimFractions(duration, bounds);
const startPercent = fractions.start * 100;
const endPercent = fractions.end * 100;
state.selection.style.left = `${startPercent}%`;
state.selection.style.width = `${Math.max(0, endPercent - startPercent)}%`;
state.startHandle.style.left = `${startPercent}%`;
state.endHandle.style.left = `${endPercent}%`;
if (document.activeElement !== state.startInput) state.startInput.value = formatTimecode(bounds.start);
if (document.activeElement !== state.endInput) state.endInput.value = formatTimecode(bounds.end);
const selected = Math.max(0, bounds.end - bounds.start);
// The preview cannot re-render every_nth or max_frames, so the label
// reports them instead: "0:04.0 of 0:10.0 · 48 frames @ 12 fps".
const summary = trimLoadSummary(state, duration, bounds);
state.durationLabel.textContent = duration > 0
? `${formatTimecode(selected)} of ${formatTimecode(duration)}${summary ? ` · ${summary}` : ""}`
: "load a video to trim";
state.status.textContent = duration > 0
? `${formatTimecode(bounds.start)} → ${formatTimecode(bounds.end)}`
: state.status.textContent;
}
function installTrimDrag(state) {
const { range } = state;
const infoAt = (clientX) => {
const rect = range.getBoundingClientRect();
const duration = Number.isFinite(state.video.duration) ? state.video.duration : 0;
const bounds = currentBounds(state);
const fractions = trimFractions(duration, bounds);
const x = clientX - rect.left;
const hit = 10;
let zone = "jump";
const closest = closestTrimHandle(
fractions.start,
fractions.end,
rect.width ? x / rect.width : 0,
rect.width,
hit,
);
if (closest) zone = closest;
else if (x > fractions.start * rect.width && x < fractions.end * rect.width) zone = "move";
return { rect, duration, bounds, fraction: rect.width ? x / rect.width : 0, zone };
};
range.addEventListener("pointermove", (event) => {
if (state.dragging) return;
if (isSingleFrame(state)) {
range.style.cursor = "ew-resize";
return;
}
const { zone } = infoAt(event.clientX);
range.style.cursor = zone === "start" || zone === "end"
? "ew-resize"
: zone === "move" ? "grab" : "pointer";
});
range.addEventListener("pointerdown", (event) => {
if (event.button !== 0 || state.dragging) return;
const initial = infoAt(event.clientX);
if (initial.duration <= 0) return;
event.preventDefault();
event.stopPropagation();
if (isSingleFrame(state)) {
// Frame-picker gesture: the strip is one scrub rail. A click already
// sets the frame; a drag keeps refining it until release.
state.dragging = true;
try { range.setPointerCapture(event.pointerId); } catch (_error) { /* mouse fallback */ }
const scrub = (clientX) => {
const next = infoAt(clientX);
writeFrameTime(state, next.fraction * next.duration);
};
scrub(event.clientX);
const move = (moveEvent) => {
if (!(moveEvent.buttons & 1)) { finish(); return; }
scrub(moveEvent.clientX);
};
const finish = () => {
if (!state.dragging) return;
state.dragging = false;
range.removeEventListener("pointermove", move);
try { range.releasePointerCapture(event.pointerId); } catch (_error) { /* already released */ }
// One notification per gesture: the frame changed on pointerdown.
notifyAusbossChange();
};
range.addEventListener("pointermove", move);
range.addEventListener("pointerup", finish, { once: true });
range.addEventListener("pointercancel", finish, { once: true });
range.addEventListener("lostpointercapture", finish, { once: true });
return;
}
state.dragging = true;
try { range.setPointerCapture(event.pointerId); } catch (_error) { /* mouse fallback */ }
const downX = event.clientX;
const anchorTime = initial.fraction * initial.duration;
let moved = false;
const apply = (clientX) => {
const next = infoAt(clientX);
if (initial.zone === "start" || initial.zone === "end") {
writeTrim(
state,
dragTrimHandle(next.duration, currentBounds(state), initial.zone, next.fraction),
initial.zone,
);
} else if (initial.zone === "move") {
const pointerTime = next.fraction * next.duration;
writeTrim(
state,
slideTrimWindow(next.duration, initial.bounds, pointerTime - anchorTime),
"start",
);
} else {
const span = initial.bounds.end - initial.bounds.start;
const centeredStart = next.fraction * next.duration - span / 2;
writeTrim(
state,
slideTrimWindow(next.duration, initial.bounds, centeredStart - initial.bounds.start),
"start",
);
}
};
const move = (moveEvent) => {
if (!(moveEvent.buttons & 1)) { finish(moveEvent); return; }
if (!moved && Math.abs(moveEvent.clientX - downX) < 3) return;
moved = true;
apply(moveEvent.clientX);
};
const finish = (finishEvent) => {
if (!state.dragging) return;
state.dragging = false;
range.removeEventListener("pointermove", move);
try { range.releasePointerCapture(event.pointerId); } catch (_error) { /* already released */ }
if (!moved && initial.zone === "jump") {
const next = infoAt(finishEvent?.clientX ?? downX);
const span = initial.bounds.end - initial.bounds.start;
const centeredStart = next.fraction * next.duration - span / 2;
writeTrim(
state,
slideTrimWindow(next.duration, initial.bounds, centeredStart - initial.bounds.start),
"start",
);
}
// One notification per gesture, on release — never per pointermove.
if (moved || initial.zone === "jump") notifyAusbossChange();
};
range.addEventListener("pointermove", move);
range.addEventListener("pointerup", finish, { once: true });
range.addEventListener("pointercancel", finish, { once: true });
range.addEventListener("lostpointercapture", finish, { once: true });
});
}
function installPlayback(state) {
@@ -203,9 +356,9 @@ function installPlayback(state) {
state.playRaf = 0;
};
const tick = () => {
if (video.paused || video.ended) { stopTick(); followPlayer(state); return; }
// Frame picking plays the whole source freely - the clip is not in
// force, so there is no boundary to loop or stop at.
if (video.paused || video.ended) { stopTick(); return; }
// Frame picking plays the whole source freely — the trim window is not
// in force, so there is no boundary to loop or stop at.
if (!isSingleFrame(state)) {
const bounds = currentBounds(state);
const action = playbackBoundaryAction(video.currentTime, bounds, getLoopEnabled(state.node), TRIM_EPSILON);
@@ -214,11 +367,9 @@ function installPlayback(state) {
} else if (action === "stop") {
video.pause();
video.currentTime = Math.max(bounds.start, bounds.end - TRIM_EPSILON);
followPlayer(state);
return;
}
}
followPlayer(state);
state.playRaf = requestAnimationFrame(tick);
};
video.addEventListener("play", () => {
@@ -239,7 +390,7 @@ function installPlayback(state) {
state.correctingSeek = true;
video.currentTime = target;
}, { signal: state.abort.signal });
video.addEventListener("seeked", () => { state.correctingSeek = false; followPlayer(state); }, { signal: state.abort.signal });
video.addEventListener("seeked", () => { state.correctingSeek = false; }, { signal: state.abort.signal });
state.stopTick = stopTick;
}
@@ -250,8 +401,8 @@ function watchTrimWidget(state, widget) {
widget.callback = function (...args) {
const result = prior?.apply(this, args);
if (!state.writing) {
state.card?.sync();
if (state.video.readyState >= 1 && state.video.paused) state.video.currentTime = homeTime(state);
updateTrimFace(state);
if (state.video.readyState >= 1) state.video.currentTime = homeTime(state);
}
return result;
};
@@ -265,10 +416,7 @@ function watchFrameWidget(state, widget) {
const result = prior?.apply(this, args);
if (!isSingleFrame(state)) {
const reopened = trimAfterFramePick(state.startWidget.value, state.endWidget.value);
if (reopened) {
state.writing = true;
try { setWidget(state.endWidget, reopened.end); } finally { state.writing = false; }
}
if (reopened) writeTrim(state, reopened);
}
applyMode(state);
if (state.video.readyState >= 1) state.video.currentTime = homeTime(state);
@@ -276,6 +424,28 @@ function watchFrameWidget(state, widget) {
};
}
function commitTimeInput(state, edge, input) {
const duration = Number.isFinite(state.video.duration) ? state.video.duration : 0;
if (duration <= 0) return;
const seconds = parseTimecode(input.value);
if (seconds === null) {
// Malformed entry: restore the previous value and keep focus for a retry.
const bounds = currentBounds(state);
input.value = formatTimecode(edge === "start" ? bounds.start : bounds.end);
return;
}
if (isSingleFrame(state)) {
writeFrameTime(state, seconds);
notifyAusbossChange();
input.blur();
return;
}
const fraction = seconds / duration;
writeTrim(state, dragTrimHandle(duration, currentBounds(state), edge, fraction), edge);
notifyAusbossChange();
input.blur();
}
function buildPreview(node) {
if (node.__ausbossLoadVideo) return node.__ausbossLoadVideo;
const videoWidget = findWidget(node, "video");
@@ -291,8 +461,6 @@ function buildPreview(node) {
hideCanvasWidget(startWidget);
hideCanvasWidget(endWidget);
if (frameWidget) hideCanvasWidget(frameWidget);
// Every nth and the frame limit (the Duration) live in the timing card;
// the widget card hides their widgets (js/widget_cards).
const root = document.createElement("div");
root.className = "ausboss-video-root";
@@ -307,7 +475,7 @@ function buildPreview(node) {
status.textContent = "Choose or upload a video";
const tools = document.createElement("div");
tools.className = "ausboss-video-tools";
const loopButton = makeToolButton("LOOP", "Play the clip again and again");
const loopButton = makeToolButton("LOOP", "Loop playback inside the selected trim");
loopButton.classList.add("ausboss-video-loop");
const reloadButton = makeToolButton("↻", "Reload the selected source video");
const frameButton = frameWidget
@@ -317,12 +485,45 @@ function buildPreview(node) {
tools.append(loopButton, reloadButton);
stage.append(video, status, tools);
// The timing card goes here (mountCard): the clip node's Start,
// Duration and Ends at, or the frame picker while FRAME is on.
const cardSlot = document.createElement("div");
cardSlot.className = "ausboss-video-timing";
cardSlot.style.flex = "none";
root.append(stage, cardSlot);
const trim = document.createElement("div");
trim.className = "ausboss-video-trim";
const range = document.createElement("div");
range.className = "ausboss-video-range";
range.title = "Drag either handle to set the trim; drag the selected range to move it";
const selection = document.createElement("div");
selection.className = "ausboss-video-selection";
const startHandle = document.createElement("div");
startHandle.className = "ausboss-video-handle";
const endHandle = document.createElement("div");
endHandle.className = "ausboss-video-handle is-end";
range.append(selection, startHandle, endHandle);
const values = document.createElement("div");
values.className = "ausboss-video-values";
const makeValue = (labelText) => {
const wrap = document.createElement("div");
wrap.className = "ausboss-video-value";
const label = document.createElement("label");
label.textContent = labelText;
const input = document.createElement("input");
input.type = "text";
input.inputMode = "decimal";
input.placeholder = "m:ss.s";
input.title = `${labelText} point - type seconds (95.5) or a timecode (1:35.5, 1:02:03.5)`;
input.addEventListener("keydown", (event) => {
keepKeyInField(event);
if (event.key === "Enter") input.dispatchEvent(new Event("change"));
});
wrap.append(label, input);
return { wrap, input, label };
};
const startValue = makeValue("IN");
const endValue = makeValue("OUT");
endValue.wrap.classList.add("is-end");
const durationLabel = document.createElement("div");
durationLabel.className = "ausboss-video-duration";
values.append(startValue.wrap, durationLabel, endValue.wrap);
trim.append(range, values);
root.append(stage, trim);
const widget = node.addDOMWidget(PREVIEW_WIDGET, "ausboss_video", root, {
serialize: false,
@@ -343,9 +544,15 @@ function buildPreview(node) {
const abort = new AbortController();
const state = node.__ausbossLoadVideo = {
node, root, stage, video, status, loopButton, reloadButton, frameButton,
cardSlot, card: null, cardMode: null, metadata: null, head: 0,
trim, range, selection, startHandle, endHandle, startInput: startValue.input,
endInput: endValue.input, startLabel: startValue.label, durationLabel,
videoWidget, startWidget, endWidget, frameWidget,
widget, abort, writing: false, correctingSeek: false, playRaf: 0,
// Absent on a backend without these widgets; the summary then reads
// its defaults (keep every frame, no cap).
everyNthWidget: findWidget(node, "every_nth"),
maxFramesWidget: findWidget(node, "max_frames"),
sourceFps: 0,
widget, abort, writing: false, dragging: false, correctingSeek: false, playRaf: 0,
};
const updateLoopButton = () => loopButton.classList.toggle("active", getLoopEnabled(node));
@@ -376,9 +583,9 @@ function buildPreview(node) {
if (!name || typeof name !== "string") {
video.pause();
video.removeAttribute("src");
state.metadata = null;
state.sourceFps = 0;
setEmpty(state, "Choose or upload a video");
state.card?.sync();
updateTrimFace(state);
return;
}
const parts = splitMediaName(name);
@@ -388,7 +595,7 @@ function buildPreview(node) {
const type = parseImageReference(name)?.type ?? "input";
video.src = api.apiURL(`/view?${mediaViewQuery({ ...parts, type }, "input")}`);
video.load();
probeMetadata(state, name);
probeSourceFps(state, name);
};
state.refresh = refresh;
reloadButton.addEventListener("click", (event) => {
@@ -398,23 +605,31 @@ function buildPreview(node) {
});
video.addEventListener("loadedmetadata", () => {
const single = isSingleFrame(state);
const bounds = currentBounds(state);
if (!single && bounds.end - bounds.start < MIN_TRIM_SECONDS && video.duration >= MIN_TRIM_SECONDS) {
writeTrim(state, { start: Math.max(0, bounds.end - MIN_TRIM_SECONDS), end: bounds.end });
}
video.currentTime = homeTime(state);
// The card says where the clip is; the stage only names the source on hover.
setReady(state, "");
setReady(state, single
? `frame at ${formatTimecode(homeTime(state))}`
: `${formatTimecode(currentBounds(state).start)} → ${formatTimecode(currentBounds(state).end)}`);
// Quiet source hint: resolution and duration from the loaded metadata.
const sourceInfo = mediaInfo(null, video);
stage.title = sourceInfo ? `Source: ${sourceInfo}` : "";
state.card?.sync();
durationLabel.title = sourceInfo ? `Source: ${sourceInfo}` : "";
updateTrimFace(state);
node.setDirtyCanvas?.(true, true);
}, { signal: abort.signal });
video.addEventListener("error", () => setEmpty(state, "Preview could not load this video"), { signal: abort.signal });
installTrimDrag(state);
installPlayback(state);
watchTrimWidget(state, startWidget);
watchTrimWidget(state, endWidget);
watchFrameWidget(state, frameWidget);
watchTrimWidget(state, findWidget(node, "every_nth"));
watchTrimWidget(state, findWidget(node, "max_frames"));
applyMode(state);
startValue.input.addEventListener("change", () => commitTimeInput(state, "start", startValue.input));
endValue.input.addEventListener("change", () => commitTimeInput(state, "end", endValue.input));
const priorVideoCallback = videoWidget.callback;
videoWidget.callback = function (...args) {
@@ -449,11 +664,6 @@ app.registerExtension({
}
});
});
// A wire into a timing input changes what the card can show.
chainCallback(nodeType.prototype, "onConnectionsChange", function () {
const state = this.__ausbossLoadVideo;
if (state) queueMicrotask(() => state.card?.sync());
});
chainCallback(nodeType.prototype, "onRemoved", function () {
const state = this.__ausbossLoadVideo;
state?.stopTick?.();
+64 -391
View File
@@ -1,7 +1,7 @@
import { api } from "../../../scripts/api.js";
import { app } from "../../../scripts/app.js";
import { api } from "/scripts/api.js";
import { app } from "/scripts/app.js";
import { BRAND, chainCallback, keepDomWidgetWidthAuto, notifyAusbossChange, showToast } from "../shared/index.mjs";
import { WIDGET_FRAME, fillNodeHeight, growToNodeFloor, holdVueNodeMinWidth } from "../shared/panel_layout.mjs";
import { WIDGET_FRAME, fillNodeHeight, holdVueNodeMinWidth } from "../shared/panel_layout.mjs";
import { hideInputsInDef, hideWidget as collapseWidget } from "../shared/widget_visibility.mjs";
import {
closeSettingsMenu,
@@ -9,15 +9,10 @@ import {
loadSettings,
openSettingsMenu,
} from "../shared/settings_menu.mjs";
import { compactAction } from "../shared/panel_controls.mjs";
import {
STRENGTH_LINK_STYLES, WIRE_LOOKS, installStrengthLinks, sourceTitle, sourceValue, syncStrengthLinks, unlinkRow,
} from "./strength_links.mjs";
import { makeScrubInput } from "../shared/scrub_input.mjs";
import { isAppShortcut, keepKeyInField } from "../shared/canvas_passthrough.mjs";
import { resetUnknownValues } from "../shared/widget_card_math.mjs";
import { boxRowInputs, boxRowsWidget, boxesOf, hostBox, rowsInputName, workflowNodes } from "../shared/lora_box.mjs";
import { coreLoraList, syncFileWidgets } from "../shared/lora_file_widgets.mjs";
import {
SETTINGS_PROPERTY as SWITCHES_PROPERTY, releaseStackGroup, releaseStackRow, renameStackGroup, stackGroupOwners, stackRowOwners,
} from "../shared/workflow_switches.mjs";
@@ -25,13 +20,12 @@ import {
BYPASS_MODE,
DEFAULT_STEP,
FINE_STEP,
MAX_ROWS,
MUTE_MODE,
STRENGTH_MAX,
STRENGTH_MIN,
appendFolderRows,
clampHighlight,
followCurve,
rowsForNewCurve,
fitLoraLabel,
formatFileSize,
groupName,
@@ -53,8 +47,6 @@ import {
collectUpstreamLoaders,
collectDownstreamLoaders,
absorbChainIssue,
anyFolderOpen,
parentFolder,
mergeImportedRows,
moveGroup,
moveHighlight,
@@ -73,7 +65,6 @@ import {
scrubValue,
serializeRows,
setGroupEnabled,
setFolderFolds,
setGroupOff,
setStrength,
shortLoraName,
@@ -92,9 +83,8 @@ import {
upsertTemplate,
} from "../shared/lora_stack.mjs";
import {
MAX_PICTURE_BYTES, civitaiButtonLabel, civitaiByHashUrl, civitaiFailureText, civitaiQueueLabel,
civitaiQueueSummary, isCivitaiAddress, parseCivitaiBody, pickCivitaiPicture, runCivitaiQueue,
smallPictureUrl,
MAX_PICTURE_BYTES, civitaiButtonLabel, civitaiByHashUrl, civitaiFailureText, isCivitaiAddress,
parseCivitaiBody, pickCivitaiPicture, smallPictureUrl,
} from "../shared/civitai_lookup.mjs";
const NODE_CLASS = "AUSBOSS_NODES_LoraLoader";
@@ -149,14 +139,6 @@ const SETTINGS_SCHEMA = [
hint: "Two strength boxes per row on this node. New nodes always start "
+ "unified.",
},
{
key: "strength_wires", label: "Linked strength wires", type: "choice",
options: WIRE_LOOKS, default: "shown",
hint: "A number wire dropped on a row sets that row's strength. shown: "
+ "the wire runs to the row. on hover: it shows while the pointer is on "
+ "this node or its source. hidden: never drawn; the row still says "
+ "what sets it.",
},
{
key: "strength_bars", label: "Strength bars", type: "toggle",
default: true,
@@ -227,8 +209,6 @@ const SETTINGS_SCHEMA = [
// as much, and the name keeps the same room.
const PANEL_MIN_WIDTH = 320;
const SEPARATE_EXTRA_WIDTH = 72;
// The curve mark and its gap, on every row while a Strength Curve is wired in.
const CURVE_MARK_WIDTH = 28;
// The popups' font, shared with the picker's width measurement, and the
// picker's side paddings, from which an option's text width is worked out.
const POP_FONT = "12px system-ui";
@@ -239,7 +219,7 @@ function installStyles() {
if (document.getElementById("ausboss-lora-styles")) return;
const style = document.createElement("style");
style.id = "ausboss-lora-styles";
style.textContent = STRENGTH_LINK_STYLES + `
style.textContent = `
.ausboss-lora-panel, .ausboss-lora-panel *,
.ausboss-lora-pop, .ausboss-lora-pop *,
.ausboss-lora-hoverthumb { box-sizing: border-box; }
@@ -264,11 +244,6 @@ function installStyles() {
.ausboss-lora-actions { pointer-events: auto; }
.ausboss-lora-row { flex: none; display: flex; align-items: center; gap: 6px; height: ${ROW_HEIGHT}px; }
.ausboss-lora-row:focus-visible { outline: 2px solid ${BRAND}; outline-offset: 1px; border-radius: 4px; }
.ausboss-lora-curve { flex: none; width: 22px; height: 22px; display: grid; place-items: center; padding: 0;
border: 0; border-radius: 5px; background: #2d3134; color: #62676d; cursor: pointer; }
.ausboss-lora-curve:hover { background: #383c40; color: #b4b9bd; }
.ausboss-lora-curve.on { background: rgba(0,180,170,.26); color: #45d6cb; }
.ausboss-lora-curve:focus-visible { outline: 2px solid ${BRAND}; outline-offset: 1px; }
/* An off row dims its controls, not itself: the row's own opacity would
dim the focus outline with them. A dragged row is dimmed as one piece. */
.ausboss-lora-row.off > * { opacity: 0.45; }
@@ -419,10 +394,6 @@ function installStyles() {
.ausboss-lora-pop { position: fixed; z-index: 10000; background: #1c1f23;
border: 1px solid #3a4047; border-radius: 7px; box-shadow: 0 8px 28px rgba(0,0,0,.5);
font: ${POP_FONT}; color: #d7dde2; display: flex; flex-direction: column; }
.ausboss-lora-pickhead { display: flex; align-items: center; gap: 6px; margin: 8px; }
.ausboss-lora-pickhead .ausboss-lora-search { flex: 1 1 auto; min-width: 0; margin: 0; }
/* Wide enough for either label, so the search box keeps its width. */
.ausboss-lora-pickhead .ausboss-compact-action { min-width: 64px; }
.ausboss-lora-search { margin: 8px; height: 26px; border: 1px solid #3a4047; border-radius: 5px;
background: #23272c; color: inherit; padding: 0 8px; outline: none; }
.ausboss-lora-search:focus { border-color: ${BRAND}; }
@@ -506,10 +477,6 @@ function installStyles() {
color: inherit; cursor: pointer; padding: 2px 8px; font-size: 11px; }
.ausboss-lora-chip.active { border-color: ${BRAND}; color: ${BRAND}; }
.ausboss-lora-fetch { align-self: flex-start; }
.ausboss-lora-fetchrow { display: flex; gap: 6px; align-items: center; }
.ausboss-lora-fetchrow .ausboss-lora-fetch { align-self: auto; }
.ausboss-lora-fetchrow .ausboss-lora-fetch-all { height: ${ACTIONS_HEIGHT}px; }
.ausboss-lora-actions .ausboss-lora-civitai-run { align-self: center; margin-left: 6px; }
.ausboss-lora-custom { display: flex; gap: 6px; align-items: center; }
.ausboss-lora-custom input { flex: 1 1 auto; min-width: 0; height: ${ACTIONS_HEIGHT}px;
border: 1px solid #3a4047; box-sizing: border-box;
@@ -758,78 +725,15 @@ function commitRows(state, rows, { structural = false, record = true } = {}) {
state.node.graph?.setDirtyCanvas(true, true);
if (structural) renderRows(state);
else updateRowValues(state);
syncLoraFiles(state.node);
if (record) notifyAusbossChange();
}
// ComfyUI's missing-models list sees a row's file only through a list
// widget, so each row that needs a file gets a hidden one
// (js/shared/lora_file_widgets.mjs). Rows that come in over a link (from a
// box or another node) are not this node's to list.
function syncLoraFiles(node) {
if (node?.type !== NODE_CLASS) return;
const widget = node.widgets?.find((item) => item.name === "loras");
if (!widget) return;
const fed = node.inputs?.find((item) => item?.name === "loras")?.link != null;
syncFileWidgets(node, fed ? [] : parseRows(widget.value), {
installed: () => coreLoraList(globalThis.LiteGraph?.registered_node_types?.LoraLoader?.nodeData)
?? node.__ausbossLoraState?.available ?? null,
hide: hideWidget,
onPick: (rowId, name) => pickRowFile(node, rowId, name),
});
}
// ComfyUI put another file in a row's hidden list (a replacement picked in
// its Issues panel): the row takes that file.
function pickRowFile(node, rowId, name) {
const widget = node.widgets?.find((item) => item.name === "loras");
if (!widget) return;
const rows = parseRows(widget.value);
const row = rows.find((item) => item.id === rowId);
if (!row || row.name === name) return;
row.name = name;
const state = node.__ausbossLoraState;
if (state && !state.disposed && !state.readOnly && state.widget === widget) {
commitRows(state, rows, { structural: true });
return;
}
widget.value = serializeRows(rows);
node.graph?.setDirtyCanvas(true, true);
syncLoraFiles(node);
notifyAusbossChange();
}
// A box shows its loader's rows the way the loader does: one strength per
// row, or model and CLIP apart.
function linked(state) {
return (state.box?.loader ?? state.node).properties?.ausbossLoraLinked !== false;
}
// A Strength Curve is wired into this loader's `curve` input. Only then do
// the rows show the mark that makes one follow it.
function curveWired(state) {
if (state.box || state.readOnly) return false;
return Boolean(state.node.inputs?.some((input) => input?.name === "curve" && input.link != null));
}
function setFollowsCurve(state, ids, on) {
commitRows(state, followCurve(state.rows, ids, on), { structural: true });
}
// The curve wire came or went: the marks show or hide, and a first curve
// marks every row. A workflow being opened keeps the marks it was saved with.
function curveLinksChanged(state, { opening = false } = {}) {
const wired = curveWired(state);
if (wired === state.curveWired) return;
state.curveWired = wired;
if (wired && !opening && !app.configuringGraph && state.rows.length && !state.rows.some((row) => row.curve)) {
commitRows(state, rowsForNewCurve(state.rows), { structural: true });
} else {
renderRows(state);
}
growToNodeFloor(state.domWidget);
}
// Picker options honor only hide-extension: their folder context is the
// disambiguator (group headers, search prefixes), so it stays.
function displayName(state, name) {
@@ -910,7 +814,7 @@ function panelHeight(state) {
}
function panelMinWidth(state) {
return PANEL_MIN_WIDTH + (linked(state) ? 0 : SEPARATE_EXTRA_WIDTH) + (curveWired(state) ? CURVE_MARK_WIDTH : 0);
return PANEL_MIN_WIDTH + (linked(state) ? 0 : SEPARATE_EXTRA_WIDTH);
}
function fitNode(state) {
@@ -967,11 +871,7 @@ function strengthBox(state, index, key) {
input.dataset.ausbossStrength = key;
// A short name; the tooltip above stays as the longer description.
input.setAttribute("aria-label", key === "strength" ? "Model strength" : "CLIP strength");
input.__ausbossRead = () => {
const entry = linkedEntry(state, index);
if (entry) return sourceValue(entry)?.toFixed(2) ?? "link";
return state.rows[index]?.[key].toFixed(2) ?? "1.00";
};
input.__ausbossRead = () => state.rows[index]?.[key].toFixed(2) ?? "1.00";
input.__ausbossTint = () => state.rows[index] && applyRangeTint(input, state.rows[index], key);
ensureRange(state, state.rows[index].name);
@@ -985,16 +885,6 @@ function strengthBox(state, index, key) {
let drag = null;
input.addEventListener("pointerdown", (event) => {
if (event.button !== 0 || !input.readOnly) return;
// A linked strength is set by its wire: a click shows where it comes from.
const entry = linkedEntry(state, index);
if (entry) {
event.preventDefault();
if (entry.source) {
app.canvas?.selectNode?.(entry.source);
app.canvas?.centerOnNode?.(entry.source);
}
return;
}
drag = { x: event.clientX, y: event.clientY, start: state.rows[index][key], scrubbed: false };
input.setPointerCapture(event.pointerId);
event.preventDefault();
@@ -1066,34 +956,6 @@ function strengthBox(state, index, key) {
return box;
}
function linkedEntry(state, index) {
const row = state.rows[index];
return row ? state.linkedStrengths?.get(row.id) ?? null : null;
}
// Mark the rows a wire sets: the strength box shows the incoming number,
// and its tooltip names where it comes from.
function decorateStrengthLinks(state) {
if (state.disposed || state.box) return;
state.linkedStrengths = syncStrengthLinks(state);
for (const box of state.panel.querySelectorAll(".ausboss-lora-strengthbox")) {
const rowId = box.closest(".ausboss-lora-row")?.dataset.rowId;
const entry = rowId ? state.linkedStrengths.get(rowId) : null;
box.classList.toggle("linked", Boolean(entry));
const input = box.querySelector(".ausboss-lora-strength");
if (!input) continue;
input.title = entry
? `Set by "${sourceTitle(entry)}". Click to show it. Right-click the row to unlink.`
: input.dataset.baseTitle ?? "";
if (input.readOnly && input.__ausbossRead) input.value = input.__ausbossRead();
}
const signature = [...state.linkedStrengths].map(([id, entry]) => `${id}:${sourceValue(entry)}`).join("|");
if (signature !== state.linkSignature) {
state.linkSignature = signature;
decorateRows(state);
}
}
// ---------- picker ----------
// Width of the longest label in the picker's font. Remembered across opens,
@@ -1106,14 +968,6 @@ let widestPickerLabel = 0;
const COLLAPSED_FOLDERS_KEY = "AusBoss.lora_loader.collapsedFolders";
let rememberedCollapsedFolders = new Set();
// "Start folded" (the default) opens the picker with every folder folded
// and forgets folds when it closes. "Remember my folds" keeps them.
const PICKER_FOLDERS_SETTING = "AusBoss.LoraLoader.PickerFolders";
const START_FOLDED = "Start folded";
const REMEMBER_FOLDS = "Remember my folds";
const pickerStartsFolded = () =>
(app.ui?.settings?.getSettingValue?.(PICKER_FOLDERS_SETTING) ?? START_FOLDED) !== REMEMBER_FOLDS;
function loadCollapsedFolders() {
try {
const raw = window.localStorage?.getItem(COLLAPSED_FOLDERS_KEY);
@@ -1148,15 +1002,9 @@ function openPicker(state, index, anchor, { keyboard = false } = {}) {
const search = el("input", "ausboss-lora-search");
search.placeholder = "Search LoRAs...";
search.setAttribute("aria-label", "Search LoRAs");
// Folds or opens every folder at once. Hidden until the list has folders.
const foldAll = compactAction("Fold all");
foldAll.hidden = true;
foldAll.addEventListener("keydown", keepKeyInField);
const head = el("div", "ausboss-lora-pickhead");
head.append(search, foldAll);
const list = el("div", "ausboss-lora-list");
list.append(el("div", "ausboss-lora-empty", "Loading..."));
pop.append(head, list);
pop.append(search, list);
if (adding) pop.append(el("div", "ausboss-lora-picker-note",
"Click a file to add it. Tick boxes (or Ctrl-click) to add several at once. Click a folder name to add all of it. Skips files already in this stack."));
const anchorRect = anchor.getBoundingClientRect();
@@ -1179,8 +1027,7 @@ function openPicker(state, index, anchor, { keyboard = false } = {}) {
const inStack = () => new Set(state.rows.map((row) => pathKey(row.name)));
let loadError = false;
let highlight = -1;
const startFolded = pickerStartsFolded();
const collapsedFolders = startFolded ? new Set() : loadCollapsedFolders();
const collapsedFolders = loadCollapsedFolders();
// Search reveals matches without losing the user's usual folded view.
let searchCollapsed = new Set();
const currentFolds = () => search.value.trim() ? searchCollapsed : collapsedFolders;
@@ -1188,21 +1035,15 @@ function openPicker(state, index, anchor, { keyboard = false } = {}) {
// after: "highlight" keeps the folder highlighted for the search box's
// arrow keys, "arrow" keeps focus on the fold arrow that was pressed with
// the keyboard, "search" hands the keys back to the search box.
// subtree: the folder's own folders fold or open with it (Alt- or
// Shift-click on its arrow). A null name means every folder (Fold all).
const toggleFolder = (name, collapsed = !currentFolds().has(name), after = "highlight", { subtree = false } = {}) => {
const toggleFolder = (name, collapsed = !currentFolds().has(name), after = "highlight") => {
const folds = currentFolds();
if (subtree || name == null) {
const next = setFolderFolds(folds, folders.keys(), collapsed, name);
folds.clear();
for (const folder of next) folds.add(folder);
} else if (collapsed) folds.add(name);
if (collapsed) folds.add(name);
else folds.delete(name);
if (folds === collapsedFolders && !startFolded) saveCollapsedFolders(folds);
if (folds === collapsedFolders) saveCollapsedFolders(folds);
const scrollTop = list.scrollTop;
highlight = -1;
renderList();
if (after === "highlight" && adding && name != null) {
if (after === "highlight" && adding) {
highlight = options.findIndex((entry) => entry.kind === "folder" && entry.name === name);
list.querySelector(`[data-ausboss-flat="${highlight}"]`)?.classList.add("highlight");
}
@@ -1219,16 +1060,15 @@ function openPicker(state, index, anchor, { keyboard = false } = {}) {
button.dataset.folder = name;
button.innerHTML = chevronIconSvg(false);
button.setAttribute("aria-expanded", String(expanded));
button.setAttribute("aria-label", `${expanded ? "Collapse" : "Expand"} ${name}`);
button.title = `${button.getAttribute("aria-label")} (Alt-click: and every folder inside it)`;
button.title = `${expanded ? "Collapse" : "Expand"} ${name}`;
button.setAttribute("aria-label", button.title);
button.addEventListener("keydown", keepKeyInField);
button.addEventListener("click", (event) => {
// Only the folder name adds files; its arrow is browse-only.
event.stopPropagation();
// A click made with a key (detail 0) stays on the arrow. A mouse click
// goes back to the search box, so typing keeps searching.
toggleFolder(name, !currentFolds().has(name), event.detail === 0 ? "arrow" : "search",
{ subtree: event.altKey || event.shiftKey });
toggleFolder(name, !currentFolds().has(name), event.detail === 0 ? "arrow" : "search");
});
row.append(button);
};
@@ -1238,6 +1078,10 @@ function openPicker(state, index, anchor, { keyboard = false } = {}) {
const { name, kind } = entry;
if (kind === "folder") {
const result = appendFolderRows(state.rows, folders.get(name) ?? [], state.settings?.default_strength ?? 1);
if (result.needed > result.room) {
loraToast(`This folder has ${result.needed} new LoRAs, but only ${result.room} of ${MAX_ROWS} rows are free. Nothing was added. Remove rows or choose a smaller folder.`);
return;
}
if (!result.added) {
loraToast("Every LoRA in this folder is already in this stack. Nothing was added.");
return;
@@ -1251,6 +1095,10 @@ function openPicker(state, index, anchor, { keyboard = false } = {}) {
if (!pointer) backToStack(firstAdded);
return;
}
if (adding && state.rows.length >= MAX_ROWS) {
loraToast(`This stack already has ${MAX_ROWS} rows. Remove a row before adding another LoRA.`);
return;
}
closePopup();
const strength = roundStrength(state.settings?.default_strength ?? 1);
const rows = adding
@@ -1266,6 +1114,10 @@ function openPicker(state, index, anchor, { keyboard = false } = {}) {
const addTicked = ({ pointer = false } = {}) => {
const result = appendFolderRows(state.rows, ticked, state.settings?.default_strength ?? 1);
if (result.needed > result.room) {
loraToast(`You ticked ${result.needed} new LoRAs, but only ${result.room} of ${MAX_ROWS} rows are free. Nothing was added. Untick some or remove rows.`);
return;
}
if (!result.added) {
loraToast("Every ticked LoRA is already in this stack. Nothing was added.");
return;
@@ -1451,11 +1303,6 @@ function openPicker(state, index, anchor, { keyboard = false } = {}) {
for (const entry of entries) if (entry.kind === "file") entry.inStack = have.has(pathKey(entry.name));
}
options = entries.filter((entry) => adding || entry.kind === "file");
const open = anyFolderOpen(entries, currentFolds());
foldAll.hidden = !entries.some((entry) => entry.kind === "folder");
foldAll.textContent = open ? "Fold all" : "Open all";
foldAll.dataset.folds = open ? "1" : "";
foldAll.title = open ? "Fold every folder in this list" : "Open every folder in this list";
if (highlight >= 0) highlight = clampHighlight(highlight, options.length);
list.textContent = "";
hideHoverThumb();
@@ -1483,9 +1330,6 @@ function openPicker(state, index, anchor, { keyboard = false } = {}) {
place();
};
foldAll.addEventListener("click", () => {
toggleFolder(null, foldAll.dataset.folds === "1", "search");
});
search.addEventListener("input", () => { highlight = -1; searchCollapsed = new Set(); renderList(); });
search.addEventListener("keydown", (event) => {
keepKeyInField(event);
@@ -1495,18 +1339,9 @@ function openPicker(state, index, anchor, { keyboard = false } = {}) {
highlight = moveHighlight(highlight, event.key === "ArrowDown" ? 1 : -1, options.length);
renderList();
} else if ((event.key === "ArrowLeft" || event.key === "ArrowRight")
&& options[highlight]?.kind === "folder"
&& !(event.key === "ArrowLeft" && currentFolds().has(options[highlight].name)
&& parentFolder(options[highlight].name) && !event.altKey && !event.shiftKey)) {
&& options[highlight]?.kind === "folder") {
event.preventDefault();
toggleFolder(options[highlight].name, event.key === "ArrowLeft", "highlight",
{ subtree: event.altKey || event.shiftKey });
} else if (event.key === "ArrowLeft" && adding && highlight >= 0
&& parentFolder(options[highlight]?.name)) {
// On a file, or on a folder that is already folded, Left folds the
// folder it sits in and moves up to it, as in a file tree.
event.preventDefault();
toggleFolder(parentFolder(options[highlight].name), true);
toggleFolder(options[highlight].name, event.key === "ArrowLeft");
} else if (event.key === "Home" || event.key === "End") {
event.preventDefault();
highlight = event.key === "Home" ? 0 : options.length - 1;
@@ -1535,13 +1370,6 @@ function openPicker(state, index, anchor, { keyboard = false } = {}) {
if (!pop.isConnected) return;
names = fetched;
folders = new Map(loraFolders(fetched).map(({ folder, names }) => [folder, names]));
if (startFolded) {
for (const folder of folders.keys()) collapsedFolders.add(folder);
// A row's own picker opens the way to that row's file.
for (let folder = parentFolder(state.rows[index]?.name); folder; folder = parentFolder(folder)) {
collapsedFolders.delete(folder);
}
}
state.available = fetched;
state.nameStatus = new Map();
widestPickerLabel = widestLabel(names.map((name) => displayName(state, name))) + (adding ? 110 : 30);
@@ -1563,10 +1391,8 @@ function openPicker(state, index, anchor, { keyboard = false } = {}) {
// about that hash, and the server saves the answer beside the LoRA after
// checking it describes the same file. Returns false when Civitai does not
// know the file (unpublished or hidden models answer 404). `picture` is the
// Civitai picture gear option ("off", "PG-13" or "any"). Otherwise it returns
// `{ picture }`: "saved", "none" (Civitai has none to save), "failed" or
// "off". `quiet` keeps the picture's own messages back for Fetch all.
async function lookUpOnCivitai(serverName, picture = "PG-13", { quiet = false } = {}) {
// Civitai picture gear option ("off", "PG-13" or "any").
async function lookUpOnCivitai(serverName, picture = "PG-13") {
const hashed = await (await api.fetchApi(
`/ausboss/lora/hash?name=${encodeURIComponent(serverName)}`
)).json();
@@ -1575,9 +1401,7 @@ async function lookUpOnCivitai(serverName, picture = "PG-13", { quiet = false }
credentials: "omit", redirect: "error", referrerPolicy: "no-referrer", cache: "no-store",
});
if (response.status === 404) return false;
if (!response.ok) {
throw Object.assign(new Error(`Civitai answered ${response.status}.`), { status: response.status });
}
if (!response.ok) throw new Error(`Civitai answered ${response.status}.`);
const info = parseCivitaiBody(await response.text());
const saved = await (await api.fetchApi("/ausboss/lora/civitai", {
method: "POST",
@@ -1585,28 +1409,24 @@ async function lookUpOnCivitai(serverName, picture = "PG-13", { quiet = false }
body: JSON.stringify({ name: serverName, info }),
})).json();
if (!saved.ok) throw new Error(saved.error || "Could not save the Civitai info.");
if (picture === "off") return { picture: "off" };
try {
if (await saveCivitaiPicture(serverName, info, picture === "any")) return { picture: "saved" };
if (!quiet) {
loraToast(picture === "any"
? "Civitai has no picture of this LoRA to save."
: "Civitai has no picture of this LoRA rated PG-13 or milder.");
}
return { picture: "none" };
} catch (error) {
if (!quiet) loraToast(`Saved the Civitai info, but not its picture: ${civitaiFailureText(error)}`);
return { picture: "failed" };
if (picture !== "off") {
await saveCivitaiPicture(serverName, info, picture === "any").catch((error) =>
loraToast(`Saved the Civitai info, but not its picture: ${civitaiFailureText(error)}`));
}
return true;
}
// The LoRA's first picture on Civitai, saved beside it as its preview. The
// browser downloads a 450-pixel copy from Civitai's picture server without
// cookies; the server checks it is a picture and never replaces one.
// Returns false when Civitai has no picture the setting allows.
async function saveCivitaiPicture(serverName, info, anyRating) {
const picture = pickCivitaiPicture(info, anyRating);
if (!picture) return false;
if (!picture) {
loraToast(anyRating
? "Civitai has no picture of this LoRA to save."
: "Civitai has no picture of this LoRA rated PG-13 or milder.");
return;
}
const response = await fetch(smallPictureUrl(picture.url), {
credentials: "omit", referrerPolicy: "no-referrer", cache: "no-store",
});
@@ -1624,76 +1444,6 @@ async function saveCivitaiPicture(serverName, info, anyRating) {
})).json();
if (!saved.ok) throw new Error(saved.error || "Could not save the picture.");
pictureSaved();
return true;
}
// ---------- Fetch all ----------
// The same one-file lookup for every LoRA in the stack that has no Civitai
// info yet, one file at a time (runCivitaiQueue). One run for the whole
// page: Civitai counts requests per browser, not per node.
let civitaiRun = null;
function fetchAllFromCivitai(state) {
if (state.settings?.civitai_lookup === false) return;
if (civitaiRun) {
if (civitaiRun.state !== state) loraToast("Another LoRA Loader is fetching Civitai info. Wait for it, or stop it there.");
return;
}
const names = state.rows.map((row) => row.name).filter(Boolean)
.map((name) => effectiveLoraName(state, name));
const hasPicture = new Map();
const run = { state, done: 0, total: null, stopping: false, wake: null, button: null };
civitaiRun = run;
renderRows(state);
runCivitaiQueue(names, {
needsLookup: async (name) => {
const data = await (await api.fetchApi(`/ausboss/lora/info?name=${encodeURIComponent(name)}`)).json();
if (!data.ok) throw new Error(data.error || "No such LoRA.");
hasPicture.set(name, Boolean(data.info.has_preview));
return !data.info.has_civitai;
},
// The picture setting is read per file, so a change mid-run counts.
lookUp: (name) => lookUpOnCivitai(name,
hasPicture.get(name) ? "off" : (state.settings?.civitai_picture ?? "PG-13"), { quiet: true }),
wait: (ms) => new Promise((resolve) => {
const timer = setTimeout(resolve, ms);
run.wake = () => { clearTimeout(timer); resolve(); };
}),
shouldStop: () => run.stopping,
onProgress: ({ done, total }) => {
run.done = done;
run.total = total;
showCivitaiRun(run);
},
}).then((result) => loraToast(civitaiQueueSummary(result)))
.catch((error) => loraToast(civitaiFailureText(error)))
.finally(() => {
civitaiRun = null;
if (state.panel?.isConnected) renderRows(state);
});
}
// While a run works, its node's footer holds one button: how far it is, and
// a click stops it after the file being fetched.
function civitaiRunButton(run) {
const button = compactAction("", "Fetching Civitai info for every LoRA in this stack "
+ "that has none yet, one at a time. Click to stop after the current one.");
button.classList.add("ausboss-lora-civitai-run");
button.addEventListener("click", () => {
run.stopping = true;
run.wake?.();
showCivitaiRun(run);
});
run.button = button;
showCivitaiRun(run);
return button;
}
function showCivitaiRun(run) {
if (!run.button) return;
run.button.disabled = run.stopping;
run.button.textContent = run.stopping ? "Stopping..." : civitaiQueueLabel(run.done, run.total);
}
// ---------- info card ----------
@@ -1792,17 +1542,7 @@ function openInfo(state, index, anchor) {
loraToast(fetchButton.title);
}
});
const fetchAll = compactAction("Fetch all LoRAs",
"Fetch Civitai info for every LoRA in this stack that has none yet, one at a time.");
fetchAll.classList.add("ausboss-lora-fetch-all");
fetchAll.disabled = Boolean(civitaiRun);
fetchAll.addEventListener("click", () => {
closePopup();
fetchAllFromCivitai(state);
});
const fetchRow = el("div", "ausboss-lora-fetchrow");
fetchRow.append(fetchButton, fetchAll);
card.append(fetchRow);
card.append(fetchButton);
}
const range = el("div", "ausboss-lora-range");
@@ -2029,6 +1769,7 @@ function openRowMenu(state, index, event) {
}
menu.append(el("div", "ausboss-lora-menu-rule"));
const insertEmpty = (position) => {
if (state.rows.length >= MAX_ROWS) return;
const strength = roundStrength(state.settings?.default_strength ?? 1);
const rows = state.rows.slice();
// A row added next to a grouped one joins its group.
@@ -2038,20 +1779,8 @@ function openRowMenu(state, index, event) {
commitRows(state, rows, { structural: true });
fitNode(state);
};
if (state.linkedStrengths?.has(row.id)) {
item("Unlink strength", () => {
unlinkRow(state, row.id);
decorateStrengthLinks(state);
});
menu.append(el("div", "ausboss-lora-menu-rule"));
}
if (curveWired(state)) {
const follow = !chosen.every((entry) => entry.curve);
item(follow ? "Follow the strength curve" : "Keep a steady strength", () => setFollowsCurve(state, ids, follow));
menu.append(el("div", "ausboss-lora-menu-rule"));
}
item("Insert empty LoRA above", () => insertEmpty(index));
item("Insert empty LoRA below", () => insertEmpty(index + 1));
item("Insert empty LoRA above", () => insertEmpty(index), state.rows.length >= MAX_ROWS);
item("Insert empty LoRA below", () => insertEmpty(index + 1), state.rows.length >= MAX_ROWS);
item("Move up", () => commitGroups(state, moveRowInStack(state.rows, index, -1)),
index === 0 && !row.group);
item("Move down", () => commitGroups(state, moveRowInStack(state.rows, index, 1)),
@@ -2062,7 +1791,7 @@ function openRowMenu(state, index, event) {
rows.splice(index + 1, 0, copy);
commitRows(state, rows, { structural: true });
fitNode(state);
});
}, state.rows.length >= MAX_ROWS);
item(count > 1 ? `Remove these ${count} LoRAs` : "Remove this LoRA", () => {
commitGroups(state, state.rows.filter((entry) => !ids.includes(entry.id)));
}).classList.add("ausboss-lora-danger");
@@ -2075,7 +1804,7 @@ function openStackMenu(state, event) {
const menu = el("div", "ausboss-lora-menu");
const item = (label, action, disabled = false) => menuItem(menu, label, action, disabled);
const add = state.panel.querySelector(".ausboss-lora-add, .ausboss-lora-blank");
item("+ Add LoRAs…", () => openPicker(state, null, add), !add);
item("+ Add LoRAs…", () => openPicker(state, null, add), !add || state.rows.length >= MAX_ROWS);
const ids = state.rows.filter((row) => selectedIds(state).has(row.id)).map((row) => row.id);
if (ids.length) {
item(ids.length > 1 ? `Group the ${ids.length} selected LoRAs` : "Group the selected LoRA", () => {
@@ -2576,12 +2305,7 @@ function renameOwnedGroup(state, from, to) {
// value update - the bar scale can change whenever any row's strength does.
function decorateRows(state) {
const showBars = state.settings?.strength_bars !== false;
// A linked row's bar shows the number coming in on its wire.
const shown = state.rows.map((row, index) => {
const value = sourceValue(linkedEntry(state, index));
return value === null ? row : { ...row, strength: value };
});
const scale = strengthBarScale(shown);
const scale = strengthBarScale(state.rows);
const dups = duplicateLoraKeys(state.rows);
state.panel.querySelectorAll(".ausboss-lora-name").forEach((button, index) => {
const row = state.rows[index];
@@ -2592,8 +2316,8 @@ function decorateRows(state) {
}
const notes = [row.name];
if (showBars) {
button.style.background = strengthBarBackground(shown[index].strength, scale);
notes.push(`Model strength ${shown[index].strength.toFixed(2)}; `
button.style.background = strengthBarBackground(row.strength, scale);
notes.push(`Model strength ${row.strength.toFixed(2)}; `
+ `bar edges are ±${scale.toFixed(2)}`);
} else {
button.style.background = "";
@@ -2638,7 +2362,6 @@ function updateRowValues(state) {
master.classList.toggle("mixed", overall === "mixed");
}
decorateRows(state);
decorateStrengthLinks(state);
}
// ---------- absorb the loader chain ----------
@@ -2766,6 +2489,11 @@ async function runImportChain(state) {
{ position: "before", deduplicate: false });
const downMerge = mergeImportedRows(upMerge.rows, downResolved,
{ position: "after", deduplicate: false });
// Never bypass a source if any of its rows would be lost to the stack limit.
if (state.rows.length + upMerge.added + downMerge.added > MAX_ROWS) {
loraToast(`Absorb needs more than ${MAX_ROWS} rows. Free some stack rows first; source loaders remain active.`);
return;
}
// Rows that patch model and CLIP differently need both boxes visible, or
// the difference is invisible and lost on the first scrub. The flip is
// node-local (unified stays the default for new nodes) and the toast
@@ -2812,19 +2540,6 @@ function openSettings(state, anchor) {
runImportChain(state);
},
},
...(state.settings?.civitai_lookup === false ? [] : [{
key: "_civitai_all",
label: "Civitai info for every LoRA",
type: "action",
button: "Fetch all LoRAs",
hint: "Look up every LoRA in this stack that has no Civitai info yet, "
+ "one at a time, the same way the info card's button does. The "
+ "bottom of the node shows how far it is; click there to stop.",
onAction: () => {
closeSettingsMenu();
fetchAllFromCivitai(state);
},
}]),
];
// Inside a subgraph the rows can show on the box's face instead; first in
// the menu there, since it is what a loader in a box is usually set up for.
@@ -2955,6 +2670,7 @@ function installStackKeyboard(state) {
if (action.kind === "focus") {
focusStackRow(state, visibleRowIndex(state, index, action.index));
} else if (action.kind === "pick") {
if (atAdd && state.rows.length >= MAX_ROWS) return;
openPicker(state, atAdd ? null : index,
atAdd ? state.panel.querySelector(".ausboss-lora-add") : rowElement.querySelector(".ausboss-lora-name"),
{ keyboard: true });
@@ -2992,6 +2708,7 @@ function renderRows(state) {
panel.append(body);
const addRowAndPick = (event) => {
if (state.rows.length >= MAX_ROWS) return;
// detail is 0 for a click made with Enter or Space.
openPicker(state, null, event.currentTarget, { keyboard: event.detail === 0 });
};
@@ -3133,7 +2850,7 @@ function renderRows(state) {
let nameDrag = null;
name.addEventListener("pointerdown", (event) => {
if (event.button !== 0 || !row.name
|| state.settings?.name_scrub === false || linkedEntry(state, index)) return;
|| state.settings?.name_scrub === false) return;
nameDrag = { x: event.clientX, y: event.clientY,
start: state.rows[index].strength, scrubbed: false };
name.setPointerCapture(event.pointerId);
@@ -3180,20 +2897,7 @@ function renderRows(state) {
showHoverThumb(state, row.name, event.clientX, event.clientY));
name.addEventListener("pointerleave", hideHoverThumb);
rowElement.append(grip, toggle, name);
if (curveWired(state)) {
const mark = el("button", `ausboss-lora-curve${row.curve ? " on" : ""}`);
mark.type = "button";
mark.title = row.curve
? "This LoRA follows the strength curve. Click to keep it steady."
: "This LoRA keeps one strength. Click to make it follow the strength curve.";
mark.setAttribute("role", "switch");
mark.setAttribute("aria-checked", String(Boolean(row.curve)));
mark.innerHTML = '<svg width="14" height="10" viewBox="0 0 14 10" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M1 2 C5 2 6 8 13 8"/></svg>';
mark.addEventListener("click", () => setFollowsCurve(state, [row.id], !row.curve));
rowElement.append(mark);
}
rowElement.append(strengthBox(state, index, "strength"));
rowElement.append(grip, toggle, name, strengthBox(state, index, "strength"));
if (!linked(state)) rowElement.append(strengthBox(state, index, "strength_clip"));
const info = el("button", "ausboss-lora-info", "i");
@@ -3232,14 +2936,13 @@ function renderRows(state) {
const actions = el("div", "ausboss-lora-actions");
const add = el("button", "ausboss-lora-add", "+ LoRA");
add.type = "button";
add.disabled = state.rows.length >= MAX_ROWS;
add.addEventListener("click", addRowAndPick);
add.title = "Pick one LoRA, or click a folder name to add all its LoRAs.";
actions.append(add);
if (civitaiRun?.state === state) actions.append(civitaiRunButton(civitaiRun));
stack.append(actions);
body.append(stack);
decorateRows(state);
decorateStrengthLinks(state);
state.lockSignature = null;
refreshLocks(state);
// Names refit whenever the stack's box changes - the node was resized,
@@ -3346,7 +3049,6 @@ function syncRows(state) {
state.toggleSnapshot = snapshotEnabled(state.rows);
renderRows(state);
fitNode(state);
syncLoraFiles(state.node);
return true;
}
@@ -3371,7 +3073,6 @@ function ensureRedrawHook() {
if (state.node.graph !== shown) continue;
syncRows(state);
refreshLocks(state);
decorateStrengthLinks(state);
}
}, 250);
});
@@ -3477,7 +3178,6 @@ function watchBox(box) {
function unmountCard(state, { resize = true } = {}) {
liveCards.delete(state);
state.disposed = true;
state.unlinkStrengthWatch?.();
state.nameObserver?.disconnect();
closePopup();
try {
@@ -3513,7 +3213,6 @@ function mountCard(node, { box = null, separatorWidget = null, onMissingWidget =
state.owner = source.owner;
state.note = source.note;
state.readOnly = Boolean(source.readOnly);
state.curveWired = curveWired(state);
if (box) hideWidget(source.widget);
state.rows = parseRows(state.widget.value);
state.renderedValue = state.widget.value;
@@ -3572,10 +3271,6 @@ function mountCard(node, { box = null, separatorWidget = null, onMissingWidget =
panel.style.height = `calc(100% + ${reclaim}px)`;
}
if (!box) {
state.unlinkStrengthWatch = installStrengthLinks(state, app);
state.onStrengthLinks = () => decorateStrengthLinks(state);
}
renderRows(state);
refreshAvailable(state);
node.setSize?.([Math.max(336, node.size?.[0] || 336), node.computeSize?.()[1] || 220]);
@@ -3638,18 +3333,6 @@ function installLoraNode(node) {
app.registerExtension({
name: "AusBoss.LoraLoader",
settings: [
{
id: PICKER_FOLDERS_SETTING,
name: "+ LoRA list folders",
type: "combo",
options: [START_FOLDED, REMEMBER_FOLDS],
defaultValue: START_FOLDED,
category: ["🆎 AusBoss", "LoRA Loader", "Picker folders"],
tooltip: "Start folded opens the + LoRA list with every folder folded. "
+ "Remember my folds opens it the way you left it in this browser.",
},
],
setup() {
watchEnteredBoxes();
ensureRedrawHook();
@@ -3663,16 +3346,6 @@ app.registerExtension({
});
chainCallback(nodeType.prototype, "onConfigure", function () {
resetUnknownValues(this.widgets, RESET_UNKNOWN);
// Now, not later: ComfyUI reads its missing-models list right after
// the workflow is restored.
syncLoraFiles(this);
queueMicrotask(() => {
if (this.__ausbossLoraState) curveLinksChanged(this.__ausbossLoraState, { opening: true });
});
});
chainCallback(nodeType.prototype, "onConnectionsChange", function () {
syncLoraFiles(this);
if (this.__ausbossLoraState) curveLinksChanged(this.__ausbossLoraState);
});
},
// A box (subgraph node) shows the rows of a loader inside once they come
-303
View File
@@ -1,303 +0,0 @@
// A row's strength can come in on a link: drag a number wire onto a row and
// let go. The link lands on a hidden input named strength_<row id> that sits
// on the node's left edge at that row's height. Nothing marks the spot until
// a number wire is dragged over the node: then the row under the pointer
// lights up. Once linked, the row's strength box shows the incoming value,
// and the wire is shown, shown on hover, or hidden (gear menu).
//
// How the input stays out of sight: the frontend treats an input that names
// a widget as a widget's socket. It leaves such a socket out of the node's
// height, draws it only while a link is dragged or hovered or once it is
// connected, and keeps the position it is given when no widget by that name
// exists. The socket is also drawn in a clear colour, so a linked row shows
// no dot. The frontend does not hit-test such a socket either, so the
// loader's getInputOnPos finds the row under a drop itself.
//
// The frontend also removes, when a workflow loads, every widget socket
// whose widget it cannot find. So the input is saved as a plain input and
// becomes a widget socket again once the workflow has loaded.
import { chainCallback } from "../shared/index.mjs";
const NAME = /^strength_[A-Za-z0-9_-]{1,64}$/;
const CLEAR = "rgba(0,0,0,0)";
// Where the hidden socket sits from the node's left edge, as the frontend
// places a widget's socket.
const SOCKET_X = 10;
const NUMBER_TYPES = new Set(["FLOAT", "INT"]);
export const WIRE_LOOKS = ["shown", "on hover", "hidden"];
// The canvas skips drawing a wire it is told is being dragged, shadow and
// all, so a hidden wire carries that mark. The mark is not saved.
export const rowInputName = (rowId) => `strength_${rowId}`;
export const isRowInput = (input) => typeof input?.name === "string" && NAME.test(input.name);
const rowIdOf = (input) => input.name.slice("strength_".length);
const states = new Set();
let watching = false;
let hoverTarget = null;
function canvasOf(app) {
return app?.canvas ?? null;
}
function clientPoint(app, x, y) {
const canvas = canvasOf(app);
const rect = canvas.canvas.getBoundingClientRect();
const scale = canvas.ds.scale || 1;
const [ox, oy] = canvas.ds.offset;
return [rect.left + (x + ox) * scale, rect.top + (y + oy) * scale];
}
function graphPoint(app, clientX, clientY) {
const canvas = canvasOf(app);
const rect = canvas.canvas.getBoundingClientRect();
const scale = canvas.ds.scale || 1;
const [ox, oy] = canvas.ds.offset;
return [(clientX - rect.left) / scale - ox, (clientY - rect.top) / scale - oy];
}
function linkOf(graph, id) {
if (id === null || id === undefined || !graph) return null;
return graph.links?.get?.(id) ?? graph.links?.[id] ?? graph._links?.get?.(id) ?? null;
}
function rowElements(state) {
return [...state.panel.querySelectorAll(".ausboss-lora-row")]
.filter((element) => !element.classList.contains("folded-away"));
}
function rowElement(state, rowId) {
return rowElements(state).find((element) => element.dataset.rowId === rowId) ?? null;
}
// The row under a point in client pixels: anywhere across the node's width,
// so a drop does not have to hit the strength box itself.
function rowAtClient(state, clientX, clientY) {
const node = state.node;
const app = state.app;
const [left] = clientPoint(app, node.pos[0], node.pos[1]);
const [right] = clientPoint(app, node.pos[0] + node.size[0], node.pos[1]);
if (clientX < left - 4 || clientX > right + 4) return null;
for (const element of rowElements(state)) {
const rect = element.getBoundingClientRect();
if (clientY >= rect.top - 3 && clientY <= rect.bottom + 3) return element;
}
return null;
}
function isNumberDrag(app) {
const connector = canvasOf(app)?.linkConnector;
if (!connector?.isConnecting) return false;
if (connector.state?.connectingTo && connector.state.connectingTo !== "input") return false;
const types = (connector.renderLinks ?? []).map((link) => String(link?.fromSlot?.type ?? ""));
return types.length > 0 && types.every((type) => type.split(",").some((part) => NUMBER_TYPES.has(part.trim())));
}
export function rowInputs(node) {
return (node.inputs ?? []).filter(isRowInput);
}
// {row id: {input, link, source}} for every row a link sets now.
export function linkedRows(node) {
const found = new Map();
for (const input of rowInputs(node)) {
const link = linkOf(node.graph, input.link);
if (!link) continue;
const source = node.graph?.getNodeById?.(link.origin_id) ?? null;
found.set(rowIdOf(input), { input, link, source });
}
return found;
}
// What a linked row shows: the source's own number when it has one in
// sight (a Float or Int node, a slider), else just that it is linked.
export function sourceValue(entry) {
const widgets = entry?.source?.widgets ?? [];
const widget = widgets.find((item) => item.name === "value") ?? widgets.find((item) => typeof item.value === "number");
return typeof widget?.value === "number" ? widget.value : null;
}
export function sourceTitle(entry) {
return String(entry?.source?.title || entry?.source?.type || "another node");
}
function placeInput(state, input) {
const element = rowElement(state, rowIdOf(input));
if (!element) return;
const rect = element.getBoundingClientRect();
const [, y] = graphPoint(state.app, 0, rect.top + rect.height / 2);
const pos = [SOCKET_X, Math.round((y - state.node.pos[1]) * 10) / 10];
if (input.pos?.[0] !== pos[0] || input.pos?.[1] !== pos[1]) input.pos = pos;
}
const HIDDEN = () => ({ label: " ", localized_name: " ", color_on: CLEAR, color_off: CLEAR });
function hideInput(input) {
Object.assign(input, HIDDEN());
if (!input.widget) input.widget = { name: input.name };
}
function ensureRowInput(state, rowId) {
const node = state.node;
const name = rowInputName(rowId);
let input = node.inputs?.find((item) => item.name === name);
if (!input) input = node.addInput(name, "FLOAT,INT", { ...HIDDEN(), widget: { name } });
placeInput(state, input);
return input;
}
export function unlinkRow(state, rowId) {
const node = state.node;
const index = (node.inputs ?? []).findIndex((input) => input.name === rowInputName(rowId));
if (index < 0) return;
node.removeInput(index);
node.setDirtyCanvas?.(true, true);
}
function wireHidden(state, entry) {
const look = state.settings?.strength_wires ?? "shown";
if (look === "hidden") return true;
return look === "on hover" && hoverTarget !== state.node && hoverTarget !== entry.source;
}
function setWireHidden(entry, hidden) {
const link = entry.link;
if (hidden === Boolean(link._dragging)) return false;
// A wire the user is moving keeps the mark the canvas gave it.
if (!hidden && link.__ausbossHidden !== true) return false;
link._dragging = hidden;
link.__ausbossHidden = hidden;
return true;
}
// Keep the hidden inputs in step with the rows: drop the ones nothing is
// linked to or whose row is gone, move each to its row, colour its wire.
// Returns the linked rows.
export function syncStrengthLinks(state) {
const node = state.node;
const connecting = canvasOf(state.app)?.linkConnector?.isConnecting;
// Rows not yet read from a workflow that is loading say nothing about
// which inputs are stale.
const rowsCurrent = state.widget && state.renderedValue === state.widget.value;
if (!connecting && rowsCurrent) {
const ids = new Set(state.rows.map((row) => row.id));
for (let index = (node.inputs?.length ?? 0) - 1; index >= 0; index -= 1) {
const input = node.inputs[index];
if (!isRowInput(input)) continue;
if (!ids.has(rowIdOf(input)) || !linkOf(node.graph, input.link)) node.removeInput(index);
}
}
for (const input of rowInputs(node)) placeInput(state, input);
const linked = linkedRows(node);
let changed = false;
for (const entry of linked.values()) {
if (setWireHidden(entry, wireHidden(state, entry))) changed = true;
}
if (changed) node.setDirtyCanvas?.(true, true);
return linked;
}
function paintTarget(element) {
for (const state of states) {
for (const row of state.panel.querySelectorAll(".ausboss-lora-row.link-target")) {
if (row !== element) row.classList.remove("link-target");
}
}
element?.classList.add("link-target");
}
function watchPointer(app) {
if (watching) return;
watching = true;
window.addEventListener("pointermove", (event) => {
let target = null;
let over = null;
for (const state of states) {
if (state.disposed) continue;
const node = state.node;
const [x, y] = graphPoint(app, event.clientX, event.clientY);
if (x >= node.pos[0] && x <= node.pos[0] + node.size[0] && y >= node.pos[1] - 30 && y <= node.pos[1] + node.size[1]) over = node;
if (!target && !state.box && !state.readOnly && isNumberDrag(app)) target = rowAtClient(state, event.clientX, event.clientY);
}
paintTarget(target);
if (!over) {
const [x, y] = graphPoint(app, event.clientX, event.clientY);
over = canvasOf(app)?.graph?.getNodeOnPos?.(x, y) ?? null;
}
if (over !== hoverTarget) {
hoverTarget = over;
for (const state of states) if (!state.disposed) syncStrengthLinks(state);
}
}, true);
// Nodes 2.0 finishes a link drag in its own pointerup handler and never asks
// the node which input is under the pointer. So there the drop on a row is
// made here, before that handler runs; it then finds the link made.
window.addEventListener("pointerup", (event) => {
if (globalThis.LiteGraph?.vueNodesMode && isNumberDrag(app)) {
for (const state of states) {
if (state.disposed || state.box || state.readOnly) continue;
const element = rowAtClient(state, event.clientX, event.clientY);
if (element?.dataset.rowId) {
dropOnRow(state, element.dataset.rowId, canvasOf(app).linkConnector);
break;
}
}
}
requestAnimationFrame(() => {
paintTarget(null);
for (const state of states) if (!state.disposed) state.onStrengthLinks?.();
});
}, true);
}
function dropOnRow(state, rowId, connector) {
const input = ensureRowInput(state, rowId);
for (const link of connector.renderLinks ?? []) {
if (link.node === state.node) continue;
link.connectToInput?.(state.node, input, connector.events);
}
}
export function installStrengthLinks(state, app) {
state.app = app;
states.add(state);
watchPointer(app);
const node = state.node;
// Saved as plain inputs (see the top of this file), hidden again on load.
chainCallback(node, "onSerialize", (data) => {
if (!Array.isArray(data?.inputs)) return;
data.inputs = data.inputs.map((input) => {
if (!isRowInput(input)) return input;
const { widget, ...plain } = input;
return plain;
});
});
const rehide = () => {
for (const input of rowInputs(node)) hideInput(input);
requestAnimationFrame(() => { if (!state.disposed) state.onStrengthLinks?.(); });
};
chainCallback(node, "onGraphConfigured", rehide);
chainCallback(node, "onConfigure", () => requestAnimationFrame(rehide));
const original = node.getInputOnPos;
node.getInputOnPos = function (pos) {
const found = typeof original === "function" ? original.call(this, pos) : undefined;
if (found && !isRowInput(found)) return found;
if (state.disposed || state.box || state.readOnly || !isNumberDrag(app)) return found;
const [clientX, clientY] = clientPoint(app, pos[0], pos[1]);
const element = rowAtClient(state, clientX, clientY);
if (!element?.dataset.rowId) return found;
return ensureRowInput(state, element.dataset.rowId);
};
return () => {
states.delete(state);
if (node.getInputOnPos !== original) delete node.getInputOnPos;
};
}
export const STRENGTH_LINK_STYLES = `
.ausboss-lora-row.link-target{outline:2px solid #00b4aa;outline-offset:-1px;background:rgba(0,180,170,.14);}
.ausboss-lora-strengthbox.linked{border-color:transparent;outline:2px dashed rgba(0,180,170,.7);outline-offset:-2px;}
.ausboss-lora-strengthbox.linked .ausboss-lora-strength{color:#5fe3d9;cursor:pointer;}
.ausboss-lora-strengthbox.linked .ausboss-lora-step{display:none;}
`;
+3 -27
View File
@@ -4,8 +4,8 @@
// node, runs the node alone when the face asks for the picture or for what
// SAM 3 finds at a click, and hands it what a run sent back.
import { api } from "../../../scripts/api.js";
import { app } from "../../../scripts/app.js";
import { api } from "/scripts/api.js";
import { app } from "/scripts/app.js";
import { chainCallback } from "../shared/index.mjs";
import { executionIdOf, isSwitchedOff, nodeByExecutionId } from "../shared/graph_ids.mjs";
import { outputLocatorId } from "../shared/input_preview.mjs";
@@ -47,24 +47,6 @@ async function stopLook(node) {
return Boolean(running || waiting.length);
}
// Take this node's own runs that still wait out of the queue: the looks and
// touches its picture asked for (they carry an `ask`), never a run of the
// workflow. Says how many went. The one that is running is left alone.
async function dropWaiting(node) {
const id = executionIdOf(app.rootGraph ?? app.graph, node);
if (!id) return 0;
const queue = await (await api.fetchApi("/queue")).json();
const ours = (entry) => {
const step = entry?.[2]?.[id];
return step?.class_type === NODE_CLASS && String(step.inputs?.ask ?? "") !== "";
};
const waiting = (queue?.queue_pending ?? []).filter(ours).map((entry) => entry[1]);
if (waiting.length) {
await api.fetchApi("/queue", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ delete: waiting }) });
}
return waiting.length;
}
// The picture goes above the settings: the stage widget sits ahead of the
// node's card, whichever of the two was built first.
function stageFirst(node) {
@@ -110,7 +92,6 @@ function build(node) {
const face = mountTouchStage(node, {
lookOnButton: () => lookOnButton,
stopLook: () => stopLook(node).catch(() => false),
dropWaiting: () => dropWaiting(node).catch(() => 0),
// A workflow is being opened: nothing is run on the person's behalf.
loading: () => Boolean(app.configuringGraph),
// Bypassed or muted, or inside a box that is: nothing is run for it.
@@ -187,18 +168,13 @@ api.addEventListener("execution_error", ({ detail }) => {
api.addEventListener("execution_interrupted", () => settleAll());
// A look is one long, quiet run. The node sends what it has found every
// second or two, so things light up while it is still looking.
// A run that stops at the node (nothing picked on this picture) sends the
// picture that came in first, so a picture that changed upstream shows at
// once. It is shown like a kept note: it starts no run of its own.
api.addEventListener(LOOK_EVENT, ({ detail }) => {
try {
if (!faces.size || !detail?.note) return;
const id = String(detail.node ?? "");
const root = app.rootGraph ?? app.graph;
for (const face of faces) {
if (!face.alive || executionIdOf(root, face.node) !== id) continue;
if (detail.stopped) face.takeNote(detail.note, { restored: true });
else if (face.inFlight) face.takeNote(detail.note, { interim: true });
if (face.alive && face.inFlight && executionIdOf(root, face.node) === id) face.takeNote(detail.note, { interim: true });
}
} catch {
// Never in the way of a run.
+2 -2
View File
@@ -5,8 +5,8 @@
// setting turns it on. The chime is built once as a small WAV in memory
// and played through an ordinary audio element, so the pack ships no sound
// file and nothing is built until the first chime plays.
import { api } from "../../../scripts/api.js";
import { app } from "../../../scripts/app.js";
import { api } from "/scripts/api.js";
import { app } from "/scripts/app.js";
import { showToast } from "../shared/index.mjs";
import { noticesFromExecuted, queueRemaining, shouldChime } from "../shared/notify.mjs";
import { chimeSamples, wavBytes } from "./chime.mjs";

Some files were not shown because too many files have changed in this diff Show More