Compare commits

...
353 Commits
Author SHA1 Message Date
ausboss 77a3fe1ff8 Merge pull request #442 from ausboss/release/2.30.0
Release 2.30.0
2026-11-28 11:54:27 -06:00
ausboss 95ab5f6e0e Release 2.30.0 2026-11-28 11:53:18 -06:00
ausboss aadfcb88ec Merge pull request #440 from ausboss/feat/h3-writer-gear
H3 Prompt Writer gear: working Reset and wording editor
2026-11-28 11:10:51 -06:00
ausboss e8da2a52a2 Drop an unused import from the wording editor's helpers 2026-11-28 11:09:53 -06:00
ausboss 5fec58ace9 Merge branch 'main' of https://github.com/ausboss/ComfyUI-AusBoss into feat/h3-writer-gear
# Conflicts:
#	CHANGELOG.md
2026-11-28 11:03:39 -06:00
ausboss f91c8e48d5 Merge pull request #434 from ausboss/feat/touch-rmbg3
Mask by Touch: RMBG-3.0 as a Fine edges choice
2026-11-28 10:53:24 -06:00
ausboss c5ad611bee Merge pull request #435 from ausboss/feat/h3-writer-sockets
H3 Prompt Writer: show only the sockets and picture chips in use
2026-11-28 10:53:13 -06:00
ausboss f71088b958 Merge remote-tracking branch 'origin/main' into feat/touch-rmbg3
# Conflicts:
#	CHANGELOG.md
2026-11-28 10:49:57 -06:00
ausboss fec84b928c Merge branch 'feat/h3-writer-sockets' into feat/h3-writer-gear 2026-11-28 10:42:10 -06:00
ausboss 4b1ef024b8 Merge branch 'main' into feat/h3-writer-sockets 2026-11-28 10:41:08 -06:00
ausboss 71c1ec2071 Merge pull request #439 from ausboss/fix/h3-swap-reading
H3 Prompt Writer: show how a swap script is read
2026-11-28 10:38:23 -06:00
ausboss 0991ef27bb Merge remote-tracking branch 'origin/main' into feat/touch-rmbg3
# Conflicts:
#	CHANGELOG.md
2026-11-28 10:35:13 -06:00
ausboss 170885cb73 Merge branch 'main' of https://github.com/ausboss/ComfyUI-AusBoss into fix/h3-swap-reading
# Conflicts:
#	CHANGELOG.md
2026-11-28 10:35:10 -06:00
ausboss a4354a47dd Merge pull request #438 from ausboss/fix/h3-writer-qa
H3 Prompt Writer: fixes from a 37-script test run
2026-11-28 10:34:50 -06:00
ausboss cb612c777f Merge remote-tracking branch 'origin/main' into fix/h3-writer-qa
# Conflicts:
#	CHANGELOG.md
2026-11-28 10:32:27 -06:00
ausboss c0e348bedd Merge pull request #441 from ausboss/fix/nodes2-wheel
Scroll long text boxes with the wheel in Nodes 2.0
2026-11-28 10:32:07 -06:00
ausboss 722878d0c1 Mask by Touch help: RMBG-3.0 needs up to about 17 GB of graphics memory 2026-11-28 10:24:03 -06:00
ausboss 0f4a156c6b Drop an unused import in H3 Prompt Writer's helpers 2026-11-28 06:16:14 -06:00
ausboss 78e696ad8b Give each person named in words their own line, and say an unquoted shout, in H3 Prompt Writer
With two people named only in words, every line went to the person in the
picture. Each one now has their own speaker. Words after yells, says or
whispers with no quotes are spoken.
2026-11-28 05:07:50 -06:00
ausboss 6effc61e2d Keep how a line is said in H3 Prompt Writer
Whispers, shouts, sings and the other speech words all reached the model
as "says". The typed word is kept, with any words between it and the
line ("says quietly"). A voiceover keeps its fixed phrase.
2026-11-28 03:51:49 -06:00
ausboss 2b03710023 Read a framing typed without an article as a framing in H3 Prompt Writer 2026-11-28 03:36:29 -06:00
ausboss df5ee8bb08 Leave a chat model's small talk out of H3 Prompt Writer's moments and sound 2026-11-28 03:31:59 -06:00
ausboss da10e98b43 Keep what someone does after a spoken line in H3 Prompt Writer 2026-11-28 03:27:34 -06:00
ausboss 6308a7257f Read single-quoted lines with an apostrophe and none in Sound in H3 Prompt Writer 2026-11-28 03:21:18 -06:00
ausboss 14298c6d7e Say when a style picture is used like a thing in H3 Prompt Writer 2026-11-28 03:06:14 -06:00
ausboss 9a7b8ee5b1 Keep H3 Prompt Writer's picture chips on one line
Four pictures and a video need more width than the node opens with, and
the chips wrapped inside a 30 px row: the video chip was drawn over the
Length row. The chips are now columns on one line that take what their
words need while there is room and give way widest first when there is
not, so a short job stays whole. A chip's hint starts with its job, which
may be cut short on a narrow node.
2026-11-28 03:01:10 -06:00
ausboss acbbb032ef Scroll long text boxes with the wheel in Nodes 2.0
Nodes 2.0 hands every wheel turn over a node to the graph on its way down
to the node, before the node's own parts see it, so a text box with more
lines than fit zoomed the graph and never scrolled. A listener that runs
first now lets a box of the pack's keep the wheel while it can still
scroll that way; the graph zooms once the box is at its end, as in the
classic renderer, which is unchanged.

Checked with real wheel turns on Text, Text Lines, Prompt Variations,
Krea 2 Encode and H3 Prompt Writer, and with the wheel sweep over every
node in both renderers (0 dead points).
2026-11-28 02:51:03 -06:00
ausboss a8321bccad Make the H3 writer gear's Reset work and stop the wording editor losing typing
- Reset puts the sockets back to "in use" and all four wordings back to
  built-in, as one undo step, and the menu shows it. A toast says Ctrl+Z
  brings the wordings back. Before, Reset changed nothing.
- Esc, or a click outside the editor, over typing that is not saved says
  so once; the second press closes. Before, the typing was gone.
- Save over a wording that lost a name the node fills in, such as
  {lines}, says what the model will miss; Save anyway keeps it. A name the
  node does not fill in is called out the same way.
- The editor's buttons stay on one line next to a long message.
2026-11-28 02:33:00 -06:00
ausboss a0b3c2ea95 Show every picture and who speaks in H3 Prompt Writer's swap reading
- The Ref2VA cast lists every subject the written prompt defines, and says
  who wears an outfit picture.
- A line the written prompt uses is no longer shown as not used.
- The Plain tab names the place, outfit, thing and style pictures, and who
  says each line.
- The swap reader's report tests sat below the file's main guard and never
  ran; the guard is now at the end of the file.
2026-11-28 02:20:57 -06:00
ausboss d6a7c630b2 Run the Save Image preview tests that sat below the main guard
Each test file runs as a script, so unittest.main() ran only the classes
above it and SaveImageLightPreviewTests never ran. A new test fails on any
test class or function written after the guard.
2026-11-28 02:13:30 -06:00
ausboss 03ddbc9ef7 Keep face drags as undo steps and fix H3 writer messages
- Moment strip, picture chips, Strength Curve and the Load Image strip
  record an undo step when a drag or pick ends; a test holds every file
  that commits widget values to it.
- The timeline reads the script for problems while a clip sets the
  length, and draws a 4 s bar for a 4 s clip.
- An unclosed quote runs to the end of its line and is spoken.
- Two start or two end pictures, @5 and above, and a missing picture each
  get a message that says what to do.
2026-11-28 02:10:50 -06:00
ausboss 060c40a195 Keep the wording editor's keys to itself and fill each wording in one pass
Ctrl+Enter in the editor saves instead of queuing a run with the old
wording, Tab stays inside it and Escape closes it from any control. The
editor stops at the length the writer reads. A {count} typed in a script
line is no longer filled in, too-deep JSON falls back to the built-in
wording, and the Full prompt tab no longer runs under the gear.
2026-11-28 00:06:43 -06:00
ausboss 9f3ac5a498 Add a gear menu to H3 Prompt Writer: which sockets show, and the wording its model is asked 2026-11-27 22:42:15 -06:00
ausboss c7fe70dde9 Use a chevron for the Read as fold in H3 Prompt Writer 2026-11-27 19:39:12 -06:00
ausboss d28ce0ebb6 Show a swap's reading as the Ref2VA cast or plain words, folded by default, in H3 Prompt Writer 2026-11-27 18:20:44 -06:00
ausboss 72f8830ebd Give the swap reading its own tint in H3 Prompt Writer's report box 2026-11-27 18:02:02 -06:00
ausboss 2477b758a0 Read swap lines sentence by sentence and show the reading in H3 Prompt Writer's report box 2026-11-27 17:58:27 -06:00
ausboss 84515ebd97 Read the description after @N and each swap line's own who-goes in H3 Prompt Writer 2026-11-27 16:43:50 -06:00
ausboss d19e6661b2 Mask by Touch RMBG-3.0: fixes from review
- Cards draw their choice buttons again after R, so a new model file
  gets its button without re-adding the node.
- Turning Fine edges off after RMBG-3.0 asks for Subject and Background
  again, so the face shows what the next run makes.
- RMBG-3.0 reads RMBG-3.0 even when it is the only model, and both of
  Bria's copies say which is which.
- A background-removal file stays one whatever it is called; a broken
  link or a decoder-only VAE is named as missing; one RMBG-3.0 copy is
  held at a time.
- A batch's subjects are kept through both passes of a run, so a long
  batch asks about each picture once.
- The help page and changelog give the real default and speed.
2026-11-27 15:47:22 -06:00
ausboss 2e8a10ec10 H3 Prompt Writer: reword a test comment 2026-11-27 15:05:04 -06:00
ausboss f0f5134c7e Mask by Touch: RMBG-3.0 as a Fine edges choice
With Bria's RMBG-3.0 files installed, Fine edges lists RMBG-3.0 next to
BiRefNet, and the Subject and Background picks use whichever is chosen.
BiRefNet stays the default. RMBG-3.0 is unloaded before BiRefNet runs so
the two never sit in graphics memory together.
2026-11-27 15:04:52 -06:00
ausboss 174d4a81b1 H3 Prompt Writer: the Sound and Music hints read as examples 2026-11-27 14:34:14 -06:00
ausboss c30b124178 H3 Prompt Writer: the socket rule follows the node's own picture sockets, however many 2026-11-27 14:34:14 -06:00
ausboss 37e13da2ae H3 Prompt Writer: wire ends stay on their dots, a copy keeps its size, and a node id cannot add style rules 2026-11-27 14:34:14 -06:00
ausboss 8520951187 H3 Prompt Writer: a picture chip only for a picture that is plugged in 2026-11-27 14:34:14 -06:00
ausboss 7f13daead7 H3 Prompt Writer: help page and changelog for the smaller socket list 2026-11-27 14:34:14 -06:00
ausboss 1fca384aff H3 Prompt Writer: a wire dropped on the node takes a shown socket, and a setting shows them all 2026-11-27 14:34:07 -06:00
ausboss f39396c5d4 H3 Prompt Writer: draw only the sockets in use 2026-11-27 14:34:07 -06:00
ausboss 98dced9d2f H3 Prompt Writer: the rule for which sockets show 2026-11-27 14:34:07 -06:00
ausboss 369702d22a Merge pull request #431 from ausboss/fix/changelog-mask-refine-unreleased
CHANGELOG: the Mask Refine edge change came after 2.29.0
2026-11-27 13:40:45 -06:00
ausboss f453bacf5e Merge main: keep both Unreleased entries (Mask Refine edges, LoRA trigger words) 2026-11-27 13:39:53 -06:00
ausboss 48c0bc0000 Merge pull request #432 from ausboss/fix/flat-curve-missing-trigger-words
LoRA Loader: keep a skipped LoRA's trigger words out on a flat curve
2026-11-27 13:39:30 -06:00
ausboss e76d475eb3 LoRA Loader: keep a skipped LoRA's trigger words out on a flat curve
With Stop on missing LoRA off, a row whose file is missing is skipped
and the node leaves its trigger words out by matching the rows
apply_lora_stack reports in `missing` against its own rows by identity.
A flat Strength Curve made apply_lora_stack swap the rows for scaled
copies, so it reported the copy, the match failed, and the skipped
LoRA's words still reached `triggers`.

apply_lora_stack now keeps the caller's rows, loads from the scaled
copies, and reports the caller's own row as missing. Adds tests for a
missing row on a flat and on a moving curve; the flat one fails before
this change.
2026-11-27 10:52:46 -06:00
ausboss b33ea15575 CHANGELOG: the Mask Refine edge change came after 2.29.0 2026-11-27 10:28:25 -06:00
ausboss 2f080686f9 Merge pull request #415 from kajan988/mask-refine-fix
Mask Refine: guided and matting edges follow the picture, plus Detail range and Fix threshold
2026-11-27 10:27:45 -06:00
ausboss c020e53435 Merge pull request #430 from ausboss/release/2.29.0
Release 2.29.0
2026-11-27 10:24:46 -06:00
ausboss 0632c104ff Merge pull request #429 from ausboss/feat/h3-tidy
Tidy up my lines: check each tidied line against the whole script
2026-11-27 10:24:05 -06:00
ausboss 62413eef53 Merge main into mask-refine-fix
# Conflicts:
#	CHANGELOG.md
2026-11-27 10:24:00 -06:00
ausboss 9943a60e63 Release 2.29.0 2026-11-27 10:23:54 -06:00
ausboss 050723f245 Merge pull request #340 from ausboss/feat/load-audio-clean-up
Load Audio: Clean up switch for voice recordings
2026-11-27 10:23:49 -06:00
ausboss c5bfdcfe93 Tidy: check each line against the whole script
A tidied line is kept only when the whole script reads the same with it, so
a timed line can't speak earlier and a typed cut can't vanish. A quote typed
right after "@N says" keeps that person, and a quote on a sign stays on it
even next to dialogue.
2026-11-27 10:22:49 -06:00
ausboss 5cdb560c0c Merge main into mask-refine-fix
# Conflicts:
#	CHANGELOG.md
2026-11-27 10:20:24 -06:00
ausboss 6640478428 Merge main into feat/load-audio-clean-up
# Conflicts:
#	CHANGELOG.md
2026-11-27 10:17:29 -06:00
ausboss 067e5e946a Merge pull request #428 from ausboss/feat/h3-tidy
H3 Prompt Writer: optional Tidy up (the model on clip cleans up typed lines)
2026-11-27 10:17:06 -06:00
ausboss af923711a2 Pin Mask Refine's two new fallbacks in the saved-fallbacks test 2026-11-27 10:16:03 -06:00
ausboss 7766dad425 Tidy each typed line on its own
Blank lines, timed lines and the order of lines no longer pass through the
model, and camera, sound, music and look lines are not sent. A line's answer
is used only when every typed @N says "..." pair keeps its person, the same
words are said in the same order, and a quote shown on a sign (curly quotes
too) is not voiced.
2026-11-27 10:15:17 -06:00
ausboss 4f54298cac Merge main into mask-refine-fix 2026-11-27 10:10:30 -06:00
ausboss e2cef8e75c Load Audio: Chinese text for the Clean up row 2026-11-27 10:09:56 -06:00
ausboss ce672777c5 Merge remote-tracking branch 'origin/main' into feat/load-audio-clean-up
# Conflicts:
#	CHANGELOG.md
2026-11-27 10:06:41 -06:00
ausboss b9abadc011 Tidy up: use a tidy only when the writer reads it the same way
- Quotes are held out before any cleanup and put back in one pass, so a
  quote inside a quote or a quote that reads like a marker comes back as
  typed.
- @12 is not @1.
- A tidy is used only when everything said is still said, nothing on a
  sign or shirt becomes speech, and the cuts and timed seconds stay. A
  second quote in one sentence, which the writer can't voice, may become
  its own spoken line.
- Tidied lines the writer turns down go through as typed.
- A one-line idea is left for the model to fill out.
- The help no longer says quoted words never reach the model (the sound
  step still reads the lines), and drops a wrong ComfyUI version.
2026-11-27 10:05:41 -06:00
ausboss 7315c9bd30 Tidy up on a ComfyUI older than 0.46.1 leaves the lines as typed and says why in the log 2026-11-27 09:41:29 -06:00
ausboss cf5e5a832b Tidy up with nothing on clip leaves the lines as typed, so a workflow can leave it on 2026-11-27 09:39:49 -06:00
ausboss 4c1d25d81f Merge remote-tracking branch 'origin/main' into feat/h3-tidy 2026-11-27 09:36:49 -06:00
ausboss 3f248d1b98 Merge pull request #426 from ausboss/fix/h3-reading
H3 Prompt Writer follows the script's layout
2026-11-27 09:36:42 -06:00
ausboss 839e00bbac H3 Prompt Writer: optional Tidy up, the model on clip cleans up the typed lines
A new optional tidy switch (off by default, under More). With a text model on
clip it rewrites the typed script in short, ordered sentences and puts each
spoken line right after whoever says it. Quoted words are held out as markers
and put back exactly as typed; an answer that loses or repeats a marker,
changes the @ tags or grows far longer is dropped and the lines go on as typed.
H3's own six parts are never tidied.
2026-11-27 08:49:14 -06:00
ausboss 2a367a90cc Merge remote-tracking branch 'origin/main' into fix/h3-reading 2026-11-27 00:42:18 -06:00
ausboss 9c2fa1e454 Merge pull request #425 from ausboss/fix/h3-sound-words
H3 Prompt Writer keeps to what was typed
2026-11-27 00:41:40 -06:00
ausboss 57672d9058 H3 Prompt Writer: with two or more people, a spoken line goes to H3 as typed 2026-11-27 00:40:43 -06:00
ausboss 365050aa8c H3 Prompt Writer: who, she and a second named person keep the words 2026-11-26 23:37:11 -06:00
ausboss b9c5898285 H3 Prompt Writer: the speaker is who opens the clause, and quotes inside quotes stay put 2026-11-26 23:30:36 -06:00
ausboss b90ee3bf14 H3 Prompt Writer follows the script's layout
Moments split only at sequence words: "Back then", "next to her" and
"U.S." stay whole. A time needs its mark, so "7 seconds remain" is an
action, and a range like [00:02-00:04] is read whole, in the writer and
when a moment is dragged on the bar.

camera: and sound: lines go to the shot they are typed under, and a
Shot 2: header on its own line cuts before the next moment. Two quotes
in one sentence are two lines, single quotes after a speech word are
speech, voiceover said after a quote counts, and the person named just
before the speech word says it.

"Cut back to" returns to a place already shown, "Start on black."
opens on black, a line broken off with a dash trails off, and two
people are no longer placed left and right unless the script says so.
2026-11-26 23:19:26 -06:00
ausboss f3fd30e965 Keep "starts in ten seconds" where it was typed
The time guard covers "starts in" and "starts on" again, for a time
or a date, while "starts on one knee" and "starts with two people"
still open the clip.
2026-11-26 23:05:39 -06:00
ausboss 4186db0a26 Read clip notes only from a note of their own
"The TV plays without audio" no longer silences the clip, and an
opening such as "Starts with two people" moves first again. The time
guard now applies only to "starts at nine".
2026-11-26 22:59:48 -06:00
ausboss 1749792457 H3 Prompt Writer keeps to what was typed
The writer lays the notes out for H3 and no longer adds sound or
state sentences of its own. Notes are read more carefully: clip-wide
switches only match whole notes outside quotes, ordinals and step
numbers keep words like "First person", mid-sentence words such as
"suddenly" or "cut to" no longer split a moment, and words on a
shirt or sign stay written while a shout next to a sign is spoken.

A list of everyday lines checks that nothing is added or switched off.
2026-11-26 22:41:09 -06:00
ausboss 0ba8b5664b Merge pull request #418 from ausboss/feat/strength-curve
Add Strength Curve: change a LoRA's or a reference's strength over the run
2026-11-26 21:57:25 -06:00
ausboss 9136fe88d3 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	CHANGELOG.md
#	js/shared/i18n_zh.mjs
#	js/widget_cards/index.js
#	locales/zh/nodeDefs.json
2026-11-26 21:54:32 -06:00
ausboss 9cd87d4778 Merge pull request #419 from ausboss/feat/film-grain-cut-out-keep-detail
Add Film Grain, Cut Out and Keep Detail
2026-11-26 21:49:21 -06:00
ausboss f0ef22c01c Merge branch 'main' of https://github.com/ausboss/ComfyUI-AusBoss into feat/strength-curve
# Conflicts:
#	CHANGELOG.md
#	js/shared/i18n_zh.mjs
2026-11-26 21:48:54 -06:00
ausboss 98e4ddf1ff Merge branch 'main' of https://github.com/ausboss/ComfyUI-AusBoss into feat/film-grain-cut-out-keep-detail
# Conflicts:
#	CHANGELOG.md
#	js/shared/i18n_zh.mjs
2026-11-26 21:48:36 -06:00
ausboss c478c86e73 Merge pull request #420 from ausboss/feat/check-layout
Add Check layout and tidy the example workflows
2026-11-26 21:46:28 -06:00
ausboss bbd1841e42 Merge branch 'main' of https://github.com/ausboss/ComfyUI-AusBoss into feat/strength-curve
# Conflicts:
#	CHANGELOG.md
2026-11-26 21:43:15 -06:00
ausboss 50897144bd Merge branch 'main' of https://github.com/ausboss/ComfyUI-AusBoss into feat/check-layout
# Conflicts:
#	CHANGELOG.md
2026-11-26 21:38:27 -06:00
ausboss 84115ca26e Merge branch 'main' of https://github.com/ausboss/ComfyUI-AusBoss into feat/film-grain-cut-out-keep-detail
# Conflicts:
#	CHANGELOG.md
2026-11-26 21:38:25 -06:00
ausboss 699c435955 Merge pull request #423 from ausboss/ausboss/wizardly-tesla-02b1fe
Frame Interpolate: hold cuts between two shots of the same place
2026-11-26 21:36:28 -06:00
ausboss 017788a2d9 Merge branch 'main' of https://github.com/ausboss/ComfyUI-AusBoss into ausboss/wizardly-tesla-02b1fe
# Conflicts:
#	CHANGELOG.md
2026-11-26 21:35:33 -06:00
ausboss 6bfbfcbf29 Merge branch 'main' of https://github.com/ausboss/ComfyUI-AusBoss into feat/film-grain-cut-out-keep-detail
# Conflicts:
#	CHANGELOG.md
2026-11-26 21:35:20 -06:00
ausboss 7a34c917ae Merge branch 'main' of https://github.com/ausboss/ComfyUI-AusBoss into feat/check-layout
# Conflicts:
#	CHANGELOG.md
2026-11-26 21:35:10 -06:00
ausboss e3871d624c Merge pull request #424 from ausboss/feat/latent-ratio-list
Latent Size: pick which ratio chips show
2026-11-26 21:33:33 -06:00
ausboss 538698d2b2 Keep matting at the subject's size
Fix threshold defaulted to 0.75, which marked the blurred rim as
background and shrank the matte to about two thirds of the subject. It
now defaults to 0.01. Matting no longer reads White point as its upper
bound, so levels and the solve stay separate. When the blur is wider
than the subject, it narrows until the subject keeps a solid core,
instead of silently returning the mask unchanged.

Also: plain tooltips and help rows for Detail range and Fix threshold,
Chinese names for both, a changelog entry, and the card tests updated
for the two new inputs.
2026-11-26 20:49:48 -06:00
ausboss be9db84962 Merge main into mask-refine-fix 2026-11-26 20:45:50 -06:00
ausboss ad7bf01cbc Frame Interpolate: hold cuts between two shots of the same place
The cut test only compared the mean frame difference with a fixed
scene_cut_threshold. Two shots of one place in the same light can change
less than fast movement inside a single shot: on a MiniMax H3 rooftop
clip the three cuts scored 0.14 to 0.17, under the 0.35 default and even
under 0.2, while a fast street clip moved up to 0.15 inside one shot. No
fixed number held both, so the node blended two shots for two frames at
each rooftop cut.

A pair now also counts as a cut when it jumps out from the pairs around
it. The change is measured on 64 px thumbnails after every 4 px block has
looked for its best match up to 3 px away, so movement inside a shot
mostly cancels and a new picture does not. A cut is at least 3 times the
median of the 4 pairs on each side and above 0.02; repeated frames are
left out of that median so footage drawn on twos or threes does not read
every step as a cut. On seven H3 clips with 29 cuts, every cut stood out
at least 4.1 times and movement inside a shot at most 1.9 times; all 29
are held and nothing inside a shot is.

scene_cut_threshold keeps its name, place and default, and keeps its old
rule: a plain difference above it is still a cut, so no cut an earlier
version found is lost, and 0 still turns cut finding off. Saved
workflows, whatever value they hold, get the new test with no new input
on the card.
2026-11-26 14:40:47 -06:00
ausboss 254be062ba Latent Size: pick which ratio chips show
The gear menu gets a Ratio chips list: switch ratios on or off, add your
own (21:9 is in the list, off by default), delete them, or reset to the
defaults. A chip keeps the name it was given, so 21:9 no longer reads 7:3.
2026-11-26 11:56:23 -06:00
ausboss 1d4d619649 Merge branch 'main' of https://github.com/ausboss/ComfyUI-AusBoss into feat/film-grain-cut-out-keep-detail
# Conflicts:
#	CHANGELOG.md
2026-11-26 11:55:45 -06:00
ausboss d9a143b98e Merge branch 'main' of https://github.com/ausboss/ComfyUI-AusBoss into feat/check-layout
# Conflicts:
#	CHANGELOG.md
2026-11-26 11:50:28 -06:00
ausboss f6d01458a8 Merge pull request #422 from ausboss/ausboss/sharp-benz-0b488e
Edit Lock: say what is wrong when the VAE and model don't match
2026-11-26 11:48:51 -06:00
ausboss 60dca17f4a Merge pull request #421 from ausboss/fix/wired-megapixels-readout
Crop + Rotate + Pad: show wired values instead of the widget's own
2026-11-26 11:48:36 -06:00
ausboss 94b1ab1def Edit Lock: say what is wrong when the VAE and model don't match
The readout blamed the VAE alone. It now says either file can be the
wrong one, gives the two channel counts it compared, and points to the
model and VAE in the workflow's notes.
2026-11-26 11:27:06 -06:00
ausboss f7fe1ceac8 Crop + Rotate + Pad: show wired values in the summary, fields and size readout
A setting wired from another node runs with the wired value, and a wired
value skips the input's range. A Float of 24 wired into Megapixels resized
to 24 MP while the card summary, the MP field and the size readout all
showed the widget's own 16.00 MP, which read as a 16 MP cap.

The summary, the face fields and the size readout now read feather, Align,
the resize switch, Megapixels and Step through the link: a typed number
shows as itself, and a calculated one says it comes from a link. Shared by
the image and both video Crop + Rotate + Pad nodes.
2026-11-26 11:23:11 -06:00
ausboss e21c06591d Read a Load Image file without alpha in Cut Out's live preview
ComfyUI's Load Image hands a PNG's see-through part to its mask, so the
node's picture has none, but the live preview read the file's own alpha and
showed holes the real cut-out does not have. A Load Image file is now read
as colour only; a picture a run kept still carries its alpha.
2026-11-26 06:29:11 -06:00
ausboss 39af045ecd Keep a see-through picture see-through in Cut Out's live preview
Cut Out multiplies its mask by the picture's own alpha, but the picture its
live preview redraws from was saved and read without alpha, so dragging a
value made a see-through source solid until the next run. Cut Out's source
is now saved with its alpha and read as four channels.
2026-11-26 06:21:33 -06:00
ausboss 043025107d Show a new picture's live preview, not the last result, after picking another file
A run's result counted as current while the values matched, so picking
another file in the same Load Image kept showing the old picture's result
without the "not run yet" tag. The result now also has to come from the
same pictures: each Load Image's file, or the link a run reads.
2026-11-26 06:21:33 -06:00
ausboss 32b42832fc Keep a saturated colour's hue in Keep Detail's light-only mode
The small floor of extra light went to every channel evenly, so a pure red
that the original's detail brightened picked up green and blue. With only
light kept, it now goes to each channel in proportion; black still takes it
evenly, and the brightness reached is the same. The live preview follows.
2026-11-26 06:14:57 -06:00
ausboss 7ab5b333a0 Keep Film Grain's grain match when ComfyUI skips the run
ComfyUI does not run a node again for inputs it already ran, so a run
answered from its cache sent no match and the card waited for one. The
node now keeps the match for each pair of pictures in its saved
properties, and watches grain_from's Load Image as well as the picture's.
2026-11-26 04:54:02 -06:00
ausboss 62e5d26e14 Film Grain copies the grain of another picture
An optional grain_from input: with Auto on, the node reads that picture's
grain (how strong, how big, how colourful) from its plainest mid-tone
patches, at the same viewing size, and adds grain like it. Amount, Size and
Color then count from the match, with the real value beside each box; the
live preview uses the match after a run. Roughness stays the card's own.
2026-11-26 02:04:45 -06:00
ausboss 36d5ee3604 Tidy the Film Grain, Cut Out and Keep Detail example layout
Route the shared picture link through reroutes so no wire crosses a node.
2026-11-25 22:35:00 -06:00
ausboss 6ec510f5e0 Live preview on Film Grain, Keep Detail and Cut Out
The picture on the node redraws while a value is dragged, before any run, with a Fit | 100% switch and a not run yet tag. The maths is ported to the browser and checked against the Python nodes on recorded values.
2026-11-25 22:35:00 -06:00
ausboss 95350d1d77 Add Auto to Film Grain
Auto picks the grain for the picture: the size follows the square root of
the megapixels, and the amount starts at 0.25 and goes up by the grain the
picture already has, measured in its flat areas. Amount and Size become
multipliers while Auto is on, with the real value beside each box. Auto and
the plain numbers keep their own values. The browser measures a Load Image's
picture with the same filter as the node, so the note agrees with the result;
a picture from another node is known from the last run.
2026-11-25 22:35:00 -06:00
ausboss f6f9fb4525 Show a Mask by Name cut-out in the Film Grain example picture
The middle panel showed the no-model sky mask, which leaves blotches in the water. It now shows Cut Out with a Mask by Name mask of the pier and the boat, the subject a person would cut out.
2026-11-25 22:35:00 -06:00
ausboss 3399f6c4f2 Add an example workflow for Film Grain, Cut Out and Keep Detail 2026-11-25 22:35:00 -06:00
ausboss e9864c02cb Add Keep Detail: the original's fine detail back on a smoothed edit 2026-11-25 22:35:00 -06:00
ausboss ccce4073a6 Add Cut Out: a see-through cut-out with clean edges from a picture and a mask 2026-11-25 22:35:00 -06:00
ausboss 5389db5ce5 Add Film Grain: photographic grain for pictures and video 2026-11-25 22:35:00 -06:00
ausboss e8be47102e Note the example tidy in the changelog
One line under Unreleased: the examples moved, nothing in them changed.
2026-11-25 22:28:27 -06:00
ausboss ac9817945e Keep the tile subgraph's two reroutes apart in the Upscale + Restore example
The two reroutes in the tile subgraph sat on one spot. They now sit apart so each wire can be followed.
2026-11-25 22:28:17 -06:00
ausboss 1068b3fb75 Tidy the example workflows so Check layout finds nothing
Only node and group positions and sizes, and reroute spots, changed. No node, link or value was touched.
2026-11-25 22:28:17 -06:00
ausboss 1bf9f0bbb8 Frame a Check layout jump left of its panel, so the panel never covers it
The panel sits at the right of the canvas, so the jump frames the picked node in the free space on its left.
2026-11-25 22:28:06 -06:00
ausboss 201cd54508 Add Check layout: a list of what makes a workflow hard to read
Right-click the canvas or use the command palette. It lists overlaps, wires that run backwards or hide behind a node, nodes outside every group, a saved zoom too small to read and a missing Workflow Note, inside subgraphs too. Click an entry to jump to it. Nothing is moved. Includes the Chinese strings, README lines and the changelog entry.
2026-11-25 22:28:03 -06:00
ausboss 4ce99c7254 Let two curve rows share a layer and leave the plain model clean
Two rows that follow the curve can wrap the same layer: two marked rows in
one loader, or two LoRA Loaders with curves in a chain. ComfyUI takes its
bypass wrappers off in the order it put them on, so on a shared layer the
first row's wrapper stayed behind with nothing under it, and the next run
without those LoRAs failed with "'NoneType' object is not callable".

A curve row's wrapper now only passes the layer through once it is taken
off, and every such wrapper left on top is removed, so the order no longer
matters. Each row also gets its own injection key across the chain: a second
loader with a curve used to replace the first loader's rows.

Tests: two marked rows on one layer add up and the plain model samples clean
after, twice over; two chained loaders with their own curves both apply. Both
fail before this change.
2026-11-25 22:18:01 -06:00
ausboss be078c7da3 Run the LoRA strength curve in bypass mode, so it works on every model file
The curve used core hook keyframes, which rewrite the model's weights at
each keyframe. That crashed on fp8 scaled and int8 models, needed a second
copy of a full-size model in memory, and made plain fp8 2.8x slower.

A following row now loads in ComfyUI's bypass mode: the LoRA is added to
each layer's result as the layer runs. A model wrapper sets each row's
strength before every step, read by noise level the way hook keyframes
read it. On Krea 2 this runs on fp8, fp8 scaled, int8 and full size, with
steps 3 to 8% slower and no extra memory. The prompt no longer has to be
encoded with the loader's clip output.

The Strength Curve hover readout also moves to a corner that covers no point.
2026-11-25 20:10:58 -06:00
ausboss 533fede3b9 Mark which LoRA rows follow the strength curve
While a Strength Curve is wired into the loader's curve input, each row
shows a curve mark beside its strength: teal follows the curve, gray stays
steady. The first curve wired into a loader with no marked rows marks them
all, and the row's right-click menu can follow the curve or keep a steady
strength. Rows keep the mark through a save.
2026-11-25 19:45:38 -06:00
ausboss f8ce7c03b7 Draw Strength Curve on the node
The points are drawn on the node: drag a point, double-click to add one,
right-click to take one away, or start from a preset chip. A readout under
the pointer gives the place in the run and the strength there, and the
picked point's place and value are number boxes. Top and Bottom (high and
low) sit on a card under the curve; the hidden points widget stays what the
workflow saves. The face draws the same monotone curve as the node.
2026-11-25 19:45:38 -06:00
ausboss 6e9651613a Declare the curve sockets in the saved-values guard 2026-11-25 19:45:38 -06:00
ausboss e382402bea Add Chinese names for Strength Curve and the curve inputs 2026-11-25 19:45:38 -06:00
ausboss 676c810538 Document Strength Curve and the curve inputs 2026-11-25 19:45:38 -06:00
ausboss 780177f118 Scale the Krea 2 reference per step from a strength curve 2026-11-25 19:45:19 -06:00
ausboss 1f11996210 Let LoRA Loader rows follow a strength curve through core hooks 2026-11-25 19:45:19 -06:00
ausboss b5481a6bbd Add Strength Curve: a drawn curve as a per-step FLOATS schedule 2026-11-25 19:45:19 -06:00
ausboss 07bb4d792b Merge pull request #417 from ausboss/release/v2.28.1
Release 2.28.1
2026-11-25 08:17:59 -06:00
ausboss 34995f9fdb Release 2.28.1 2026-11-25 08:17:05 -06:00
ausboss 8e00fd07fc Merge remote-tracking branch 'origin/fix/card-rows-reach' into release/v2.28.1 2026-11-25 08:15:17 -06:00
kajan988 c47b4bd36e Merge branch 'Mask_refine=otput_node=true' into mask-refine-fix 2026-11-25 07:11:52 +02:00
kajan988 41260de5b3 Mask refine - output node=true 2026-11-25 06:46:42 +02:00
kajan988 e82fdddfb9 Mask Refine: port LayerStyle-grade edge refinement 2026-11-25 05:37:49 +02:00
ausboss 3213c6a4c1 Merge pull request #412 from ausboss/release/v2.28.0
Release 2.28.0
2026-11-24 10:55:21 -06:00
ausboss b6266d1f13 Release 2.28.0 2026-11-24 10:54:25 -06:00
ausboss fbabc5de42 Merge pull request #411 from ausboss/fix/face-fixes-2.28
Photo Camera More fold, Fetch all LoRAs, Color Match method hint
2026-11-24 10:53:56 -06:00
ausboss 6f2a39502e Photo Camera's More fold, Fetch all LoRAs at full height, a hint under Color Match's Method 2026-11-24 10:53:13 -06:00
ausboss c33fc9a968 Merge pull request #410 from ausboss/fix/drop-photo-backdrop
Pause for Shot: take out the photo backdrop before it ships
2026-11-24 10:46:17 -06:00
ausboss eb1be4f36c Card rows: Image Resize shows Fit only where it is read; Photo Camera's More opens
Image Resize showed Fit, and Fill under pad, for every target, but the node
fits every target except Width x height, so those rows did nothing there.
They now show only for Width x height (js/shared/image_resize_rows.mjs).

Photo Camera folded Crop margin and 360 width into a group with no header
row to open it, so they could not be reached. It gets its More header, and
a test fails on any card that folds rows into a group with no header.
2026-11-24 10:44:16 -06:00
ausboss 0a16f4da32 Pause for Shot: take out the photo backdrop before it ships
The photo-on-a-stage backdrop (the background, background_camera and
background_mode inputs, and Size on the viewer's Backdrop tab) projected the
photo onto a floor and walls. Turned shots smeared walls across the floor,
doubled cars and showed a seam where the photo ends, and the final picture
turned those smears into things. No release has these inputs. A workflow
can leave the backdrop grey and let the image model fill in the place. The
hidden `view` input stays.
2026-11-24 10:43:38 -06:00
ausboss 89a8e2d05d Merge pull request #409 from ausboss/feat/photo-camera
Photo Camera, and your own photo behind the model in Pause for Shot
2026-11-24 10:28:18 -06:00
ausboss 0d1f6cf246 Merge main into feat/photo-camera
# Conflicts:
#	CHANGELOG.md
2026-11-24 10:27:23 -06:00
ausboss f9b142bb76 Merge pull request #408 from ausboss/feat/layout-boxes-placement
Layout Boxes placement sentences; Color Match kept method for edits
2026-11-24 10:27:19 -06:00
ausboss d0ce322d7c Merge main into feat/layout-boxes-placement
# Conflicts:
#	CHANGELOG.md
2026-11-24 10:26:25 -06:00
ausboss 9a52cd8a04 Merge pull request #407 from ausboss/fix/civitai-readable-saves
Make saved pictures readable by civitai.com
2026-11-24 10:25:35 -06:00
ausboss 20f5ea273d Merge main into fix/civitai-readable-saves
# Conflicts:
#	CHANGELOG.md
2026-11-24 10:24:26 -06:00
ausboss f4c123cffb Merge pull request #406 from ausboss/feat/lora-fetch-all
LoRA Loader: fetch Civitai info for every LoRA at once
2026-11-24 10:24:17 -06:00
ausboss 148edbd741 Merge main into feat/lora-fetch-all
# Conflicts:
#	CHANGELOG.md
2026-11-24 10:23:23 -06:00
ausboss d31377a939 Merge pull request #405 from ausboss/feat/toolbox-cut-piece
Image Toolbox: cut a piece of your own size
2026-11-24 10:22:19 -06:00
ausboss 3942e7d9dc Pause for Shot: Size sets how far the walls around her are
The photo backdrop's stage is now a dome around the photo's camera with
the floor cut across it. Size on the viewer's Backdrop tab is its radius
in camera heights; empty keeps today's endless wall. From the photo's own
camera every Size gives the photo back unchanged.
2026-11-24 09:31:24 -06:00
ausboss 28936dbe7e Pause for Shot: your photo behind the model, lined up
Wire the photo with the person taken out into `background` and Photo
Camera's camera into `background_camera`: the viewer and `backdrop` show
that photo on a simple stage (a floor at the model's lowest point,
everything else far away), lined up from the photo's own camera and when
zoomed, with her standing on the photo's floor when the camera turns.
`background_mode` picks photo (the default), 360, or 360 floor; a pick
made while the run waits redraws the viewer at once.

The viewer's 360 settings and Cut now reach a run that goes straight
through in the hidden `view` input, filled by the page as Run is pressed.
They used to be read from the saved workflow, which is not part of what
ComfyUI compares, so a changed Turn handed back the old backdrop from the
cache. A test now keeps every node but the save nodes from reading the
saved workflow.
2026-11-24 08:27:26 -06:00
ausboss f75f7456b0 Color Match: kept method fixes the tone an edit shifted, from the pixels it kept 2026-11-24 08:01:53 -06:00
ausboss 52e1e81838 Cut the front or back off a model in the 3D viewer
Cut front and Cut back on the viewer's Model tab take away part of the
model as the camera sees it, each as a share of the model's depth: Back
hides what should sit behind something in the picture, such as the
inside of a hat behind the head. The viewer clips at two planes that face
the camera and draws both sides while a cut is on, so you see the inside
the way Render Mesh draws it.

Pause for Shot takes an optional mesh and hands it on cut the same way,
from the shot or from the cut saved on the viewer, so the render the
picture is painted from matches the viewer.
2026-11-24 00:48:29 -06:00
ausboss 6c41677b36 Pause for Shot: use the viewer's saved 360 settings when not pausing
A run on 'run through' had no Continue answer to carry the 360's Turn,
Tilt and Shadow, so its backdrop used the 360 unturned. It now reads them
from the viewer as saved in the workflow.
2026-11-24 00:21:47 -06:00
ausboss 33555abf0f Add Photo Camera: line a Pixal3D model up with the photo
Works out the camera a photo was taken with from the photo, the subject's
mask and the lens width (MoGe measures it). Pixal3D gets the crop's field
of view, the 3D viewer gets the photo's own view, and the photo's place on
a 360 canvas follows the camera so the 360 lines up behind the model.
2026-11-24 00:21:47 -06:00
ausboss 6a891d185c Layout Boxes: placement output, the boxes as prompt sentences 2026-11-24 00:17:48 -06:00
ausboss 199a618a94 Tag Civitai uploads with the ComfyUI tool and their technique
The Civitai line now ends with engine: ComfyUI and process: txt2img or
img2img. Civitai keeps lower-case keys from that line as they are, and
reads engine for the post's tool and process for its technique, so a
picture saved with Civitai info gets the ComfyUI tool tag back.
2026-11-23 22:17:01 -06:00
ausboss 62a3fcbacc Drop the json import the EXIF writer no longer uses 2026-11-23 21:20:57 -06:00
ausboss 09bf3e9908 Make saved pictures readable by civitai.com
Civitai flags an upload "Unable to Verify AI Generation" when it finds no
prompt in the file, and it only finds a model by its file hash.

Save Image's WebP (and JPEG XL) wrote the prompt in EXIF Make and the rest
as one JSON object in ImageDescription. Core ComfyUI writes the prompt in
Model and "workflow:<json>" in Make. Civitai looks for "prompt:" in Model,
so our WebP files had no prompt at all for it, and ComfyUI's own canvas
read the workflow entry's key as '{"workflow"' and could not restore the
graph. Both now use core's layout. Save Video's animated webp carries the
same EXIF, as core's animated WebP does.

Save Image also gets an opt-in Civitai choice on its Embed switch (Off |
On | Civitai, new optional civitai_info input, default off). It adds the
A1111-style parameters line Civitai reads first: the prompt and negative
of the nearest sampler upstream of the save, its settings, and AutoV2
hashes of the checkpoint or diffusion model and LoRAs on its model input
(LoRA Loader rows that are off or at 0 are skipped). This covers graphs
Civitai's ComfyUI reader cannot follow: Krea 2 Encode, Qwen Image 2.1's
encoder, prompts inside subgraphs. It is off by default because Civitai
then shows these settings in place of the ComfyUI workflow; the workflow
stays in the file. Hashes reuse the LoRA Loader's cached file SHA256.
2026-11-23 21:17:42 -06:00
ausboss 2e713a4f10 LoRA Loader: fetch Civitai info for every LoRA at once
A stack of 44 LoRAs meant 44 info cards and 44 clicks to get their Civitai
info and pictures. Fetch all, in the info card beside the one-LoRA button
and in the gear menu, runs that same lookup for each LoRA in the stack
that has no Civitai info yet: one file at a time, 1.5 s apart, through the
same browser-side request to civitai.com and the same server routes, so
no new address, no server request and no new write. LoRAs that already
have info are skipped, so a second run only fetches the rest.

The node's footer shows "Civitai 12 / 44 · Stop" while it runs; a click
stops it after the file being fetched. A 429 waits 20 s and retries that
file once, a second one stops the run; an unreachable civitai.com, or
three failures in a row, stop it too. One message at the end counts what
was found, not on Civitai, failed and already had info, instead of a
toast per picture. The picture setting is read per file and a picture
already beside a LoRA is never replaced.

The queue lives in js/shared/civitai_lookup.mjs as runCivitaiQueue, with
tests for skips, repeats, stop, a single failure, three in a row, an
unreachable site and both 429 cases.
2026-11-23 21:07:35 -06:00
ausboss 0b84c467c7 Image Toolbox: cut a piece of your own size
A new job, cut a piece, cuts one piece of a set width and height at a
picked position (a corner, an edge or the centre), moved right or down
by an offset. A new second output, rest, gives back what is left: the
strip beside a piece that takes a whole side, else the picture with the
hole filled with its backdrop colour. Width or height 0 takes the full
side, so one node splits a picture into two parts of different sizes.

Inputs and the output are appended as optional; the card shows the new
rows only for the new job.
2026-11-23 21:03:56 -06:00
ausboss 2ec0c6c425 Merge pull request #404 from ausboss/release/v2.27.0
Release 2.27.0
2026-11-23 19:06:35 -06:00
ausboss 80d056fc55 Release 2.27.0 2026-11-23 18:54:17 -06:00
ausboss 84c346c250 Merge pull request #402 from ausboss/fix/callout-row-class
Callout: keep its styles off the shared card rows
2026-11-23 18:23:29 -06:00
ausboss 3fb2f028e3 Merge pull request #401 from ausboss/fix/grid-under-feet
Stand the 3D viewer's floor grid under the model
2026-11-23 18:22:37 -06:00
ausboss d9c5a9e758 Merge pull request #403 from ausboss/feat/clip-window
Clip window for App-mode forms, with min/max clip seconds
2026-11-23 18:22:20 -06:00
ausboss 04e4d71a73 Merge remote-tracking branch 'origin/main' into feat/clip-window
# Conflicts:
#	CHANGELOG.md
2026-11-23 18:21:16 -06:00
ausboss 5f6ba96174 Play the picked part of the video above the App mode clip window
The clip window now has a muted player over its strip that plays only the
part a run uses, on a loop; a drag shows the frame under the moving edge,
and a click pauses it. It plays only while it is on screen.

The form row is now refilled whenever it is empty while App mode is open
(a watcher instead of a few timed retries), so a slow reload no longer
leaves the row blank.
2026-11-23 18:18:04 -06:00
ausboss b1f9b9ab21 Keep a DOM widget in its App mode form row
The form moves a listed DOM widget (the clip window) into its row once,
as the row mounts. The graph's widget layer could take the element back
a moment later, so the row stayed empty after switching from the graph
or reopening the page in App mode. Move it back into the row after each
mode change.
2026-11-23 18:01:32 -06:00
ausboss 762b84886d Callout: keep its styles off the shared card rows
The Callout's stylesheet styled .ausboss-card-row, the class every widget
card row uses. Once a Callout was on the canvas, card rows became flex
rows: Workflow Switches cut its names to a letter or two and other cards
lost their column layout. The Callout's own classes are now
ausboss-callout-row, -block, -title and -icon, and a test fails if its CSS
styles a class widget_card.mjs owns.
2026-11-23 14:41:29 -06:00
ausboss 1321486537 Stand the 3D viewer's floor grid under the model
ComfyUI's grid lies at height 0, and TRELLIS 2 centres its models there,
so the grid ran through the middle of the person in Pause for Shot's
viewer. Each frame the grid now moves to the model's lowest point, the
floor the shadow already uses. While the viewer captures a run's
pictures the grid goes back to 0, so Load3D's image with the grid shown
is unchanged.
2026-11-23 13:36:22 -06:00
ausboss 6e3ced5f2d Merge pull request #380 from TWIISTED-STUDIOS/fix/media-picker-virtual-scroll-folders
Fix media picker 400-item limit with virtual scrolling and folder navigation
2026-11-23 12:52:14 -06:00
ausboss 841d82dff1 Changelog: media picker shows every file, in folders 2026-11-23 12:51:15 -06:00
ausboss 3d3a0d1a51 Merge remote-tracking branch 'origin/main' into media-picker-380 2026-11-23 12:51:03 -06:00
ausboss 515bb90afb Merge pull request #400 from ausboss/feat/viewer-ratio 2026-11-23 12:42:15 -06:00
ausboss e8df529c76 Document Pause for Shot and the 3D viewer extras 2026-11-23 11:21:37 -06:00
ausboss b40e19cf35 Show the paused model on every page with ComfyUI's newer 3D output
ComfyUI now names Preview 3D (Advanced)'s model in a "3d" list of
saved files instead of the older "result" list. Pause for Shot only
read the older shape, so it carried no model along and a page that did
not press Run showed the 360 with an empty viewer. Both shapes are read
now, in the node and on the page.
2026-11-23 11:21:37 -06:00
ausboss e40f1075b9 Add Pause for Shot and framing tools for the 3D viewer
Pause for Shot stops a run right after Preview 3D (Advanced) so the shot
can be framed on the model that run just made, then Continue carries on
with the camera exactly as the viewer shows it. A 360 picture wired in
shows behind the model while the run waits, and the backdrop output gives
the part of it the camera sees, with an optional floor shadow.

The 3D viewer also gets aspect ratio chips, Blender-style G/R/S keys for
moving the model, and a tidier toolbar layout.
2026-11-23 10:59:23 -06:00
ausboss c74c4877c3 Merge pull request #399 from ausboss/feat/moving-step-preview 2026-11-22 23:08:06 -06:00
ausboss 0a23673a5a Step preview: a video's step picture moves
For a run that shows its steps, the pack wraps ComfyUI's previewer for
video latents and, after each step, also sends about one frame per second
of the clip (16 at most) in an ausboss.step_frames message. Each frame is
made by the same previewer call ComfyUI makes for the first frame, one at
a time, so no extra memory or files are needed. The shared step overlay
loops them at the clip's own pace on Save Video, Save Image and Step
Preview. Frames skip steps when they would take more than a tenth of the
run (the tiny video decoder on a slow card).
2026-11-22 22:52:13 -06:00
ausboss 852af46786 Merge pull request #397 from ausboss/release/2.26.7
Release 2.26.7
2026-11-21 22:07:54 -06:00
ausboss 63790c2e10 Release 2.26.7 2026-11-21 22:07:00 -06:00
ausboss 2289ef77aa Merge pull request #395 from ausboss/fix/old-copy-warning 2026-11-21 21:02:15 -06:00
ausboss 7d09daeb39 Workflow Note: a missing AusBoss node offers an update in the Manager, not a GitHub clone 2026-11-21 20:44:51 -06:00
ausboss 7c61ae226d Workflow skill: clone into ausboss-nodes too 2026-11-21 20:07:17 -06:00
ausboss 52cb5d8493 README: clone into ausboss-nodes, the folder ComfyUI-Manager uses 2026-11-21 20:07:11 -06:00
ausboss bfa7c35a64 Say in the browser when an old copy of the pack loads instead of the new one 2026-11-21 20:02:28 -06:00
ausboss 916197fb28 Merge pull request #394 from ausboss/feat/lora-strength-links
LoRA Loader: set a row's strength with a wire
2026-11-21 16:39:12 -06:00
ausboss 286866fa0f LoRA Loader strength links: help page and changelog 2026-11-21 16:37:24 -06:00
ausboss a9fe941b03 LoRA Loader strength links: outline the whole linked box 2026-11-21 16:33:50 -06:00
ausboss f684af1273 LoRA Loader strength links: wires shown by default 2026-11-21 16:28:38 -06:00
ausboss 734e88af1f LoRA Loader strength links: Nodes 2.0 drop, Chinese labels, tests 2026-11-21 16:24:45 -06:00
ausboss a3a5cf2826 LoRA Loader: link a number wire to a row's strength 2026-11-21 16:15:09 -06:00
ausboss 2fa296fe89 Merge pull request #393 from ausboss/fix/saved-fallbacks-follow-run
Saved-fallback test follows run() into write() (#391)
2026-11-21 16:14:58 -06:00
ausboss 07461b5972 Merge pull request #392 from ausboss/feat/zh-node-faces
Show Chinese on node faces when ComfyUI's language is Chinese
2026-11-21 16:05:54 -06:00
ausboss 952f72bedf Saved-fallback test: follow run() into write() for H3 Prompt Writer (#391) 2026-11-21 15:40:53 -06:00
ausboss 3792649ae5 Merge pull request #390 from ausboss/fix/workflow-note-shared-folders
Workflow Note: find models in Stability Matrix's shared folders
2026-11-21 15:31:16 -06:00
ausboss 5b00d85094 Merge remote-tracking branch 'origin/main' into fix/workflow-note-shared-folders
# Conflicts:
#	CHANGELOG.md
2026-11-21 15:30:22 -06:00
ausboss 09b8c499e7 Merge pull request #389 from ausboss/fix/py310-tomllib
Load on Python 3.10, where tomllib does not exist
2026-11-21 15:30:11 -06:00
ausboss d2782a2a90 Show Chinese on node faces when ComfyUI's language is Chinese
Cards, panels, buttons, choices and tooltips follow Settings > Language through js/shared/i18n.mjs and the table in js/shared/i18n_zh.mjs. Text with no entry stays English; widget names and values are untouched. Adds the missing Chinese socket names for H3 Prompt Writer and a few other nodes.
2026-11-21 12:28:18 -06:00
ausboss 3ef50e0262 Workflow Note: find models in Stability Matrix's shared folders (#386)
A row in folder clip or unet was never checked: ComfyUI's /models/<folder>
list answers 404 for those old names, though it files them as
text_encoders and diffusion_models everywhere else. Stability Matrix uses
both. Rows now ask for the folder by the name ComfyUI lists it under.

The card also names the folders this install reads with a name of their
own (Stability Matrix's Data/Models/Lora, from extra_model_paths.yaml) under
the usual ComfyUI/models/<folder> heading, and a missing file's dot lists
every folder that was searched. Both come from ComfyUI's
/experiment/models; without it the card reads as before.

Fixes #386
2026-11-21 09:28:11 -06:00
ausboss f9cd259a3e Load on Python 3.10, where tomllib does not exist (#387)
__init__.py and the single-copy guard imported tomllib at the top, which
only exists from Python 3.11, so on a 3.10 install (some Stability Matrix
setups) the whole pack failed to import. Both now read pyproject.toml
through nodes/_pyproject.py: tomllib when it is there, the tomli backport
when installed, else a small reader for the plain name and version lines
of [project]. No new dependency.

Fixes #387
2026-11-21 09:23:56 -06:00
ausboss 9f3a6f2010 Media picker: open in the current pick's folder, pack icons, plain names inside a folder
The picker opened at the top level, so a pick in a subfolder was not shown
and the preview stayed empty. It now opens in that file's folder with the
file highlighted. Rows inside a folder show just the file name (a search
still shows the folder), the folder marks are drawn in the pack's style
instead of emoji, and the path line names the temp folder and drops the
trailing slash at the top level.
2026-11-20 22:54:53 -06:00
ausboss 2f31463af8 Merge main into fix/media-picker-virtual-scroll-folders 2026-11-20 22:39:48 -06:00
ausboss 9ab4365245 Merge pull request #385 from ausboss/fix/latent-size-chips-keep-default
Latent Size: ratio chips keep the current megapixels by default
2026-11-20 22:33:46 -06:00
ausboss 5dfbcdd99c Merge remote-tracking branch 'origin/main' into fix/latent-size-chips-keep-default
# Conflicts:
#	CHANGELOG.md
2026-11-20 22:33:13 -06:00
ausboss 20f860d5ff Merge pull request #382 from ausboss/feat/h3-full-prompt-tab
H3 Prompt Writer: a Full prompt tab to see and change the written prompt
2026-11-20 22:32:59 -06:00
ausboss 44edcc633c Latent Size: ratio chips keep the current megapixels by default
Fixes #377. The gear setting lived only in browser storage, so private
windows lost it every time. It now starts on; turning it off still brings
back the ~1MP jump.
2026-11-20 21:29:18 -06:00
ausboss c99425cef1 Merge branch 'main' of https://github.com/ausboss/ComfyUI-AusBoss into feat/h3-full-prompt-tab
# Conflicts:
#	CHANGELOG.md
2026-11-20 21:26:03 -06:00
ausboss dcb9be2bdc Merge pull request #384 from ausboss/release/2.26.6
Release 2.26.6
2026-11-20 21:24:57 -06:00
ausboss 9304be69a8 Release 2.26.6: Image Toolbox help says what too many pieces does 2026-11-20 21:13:24 -06:00
ausboss 743126d86f H3 Prompt Writer help: drop the reset-and-edit-again line 2026-11-20 15:42:37 -06:00
ausboss fb430afca1 Merge branch 'main' of https://github.com/ausboss/ComfyUI-AusBoss into feat/h3-full-prompt-tab
# Conflicts:
#	CHANGELOG.md
2026-11-20 15:39:03 -06:00
ausboss c636d73223 Merge pull request #383 from ausboss/release/2.26.5
Release 2.26.5: Image Toolbox
2026-11-20 15:35:21 -06:00
ausboss 6db92cdd28 Release 2.26.5 2026-11-20 15:33:27 -06:00
ausboss 3c6cbd3a41 Image Toolbox: one node for small picture jobs, starting with split sheet at gaps
A sheet of side-by-side pictures, such as a character sheet's four views,
rarely puts each picture on its equal share of the width, so cutting into
equal parts left part of a neighbour in one piece. Each cut now goes to the
cleanest column near its equal-share line. The pieces come out as one batch
of the same size, padded with the sheet's backdrop colour; the outer pieces
keep the sheet's own edge at their outer edge.

New jobs are new choices in the job list, so they need no new node.
2026-11-20 15:29:12 -06:00
ausboss a606d34b97 H3 Prompt Writer: a Full prompt tab to see and change the written prompt
The node gets two tabs. Simple is the card as before and stays the
default. Full prompt shows the prompt the node wrote on its last run, in a
box you can edit; when it holds an edit, that text is sent to H3 instead.
An amber dot on the tab, a note under the box and a line on the Simple tab
say an edit is being sent. Reset to written clears it.

- New optional `full_prompt` input, appended last, with a "" fallback for
  older saves. The node now returns the written prompt as ui output
  (`written_prompt`); `write` is unchanged and `run` wraps it.
- Widget card: `when` gets the node as well as the values, a panel row can
  grow, and `refreshByHand` lets a panel redraw the card.
- Fix: a hidden textarea or panel row stayed visible, because the later
  `display:block` rules for those rows beat `.hidden`.
2026-11-20 14:03:47 -06:00
TWIISTED-STUDIOS 6d1ca0055d Fix media picker scrolling and add folder navigation 2026-11-19 23:50:35 +00:00
ausboss aaf3ae6ae6 Merge pull request #379 from ausboss/feat/stitch-follow-changes 2026-11-18 22:25:04 -06:00
ausboss d62d263725 Merge branch 'main' of https://github.com/ausboss/ComfyUI-AusBoss into feat/stitch-follow-changes
# Conflicts:
#	CHANGELOG.md
2026-11-18 21:22:00 -06:00
ausboss ffd4e66654 Merge pull request #376 from ausboss/feat/lora-picker-fold-all 2026-11-18 21:20:01 -06:00
ausboss 7f97d84a88 Stitch Inpaint: Follow changes pastes what the model drew past the box
Edit models that redraw the whole crop draw a boot, a plate rim or a
collar a little past the box, and the classic paste cut it off at the
box's edge. Follow changes lines the model's crop up with the picture's
own (zoom and shift), then grows the paste to every change that touches
the box and fades it out before the crop border. When the model redrew
nearly everything, the paste stays the box. Off by default.
2026-11-18 20:12:31 -06:00
ausboss acfe587691 Merge branch 'main' of https://github.com/ausboss/ComfyUI-AusBoss into feat/lora-picker-fold-all
# Conflicts:
#	CHANGELOG.md
2026-11-18 19:30:19 -06:00
ausboss f87d710d14 Merge pull request #378 from ausboss/perf/box-edit-speed
Make the box-edit nodes cost the box, not the picture
2026-11-18 19:29:31 -06:00
ausboss 85da4a4d0e Make the box-edit nodes cost the box, not the picture
Crop For Inpaint, Image Crop + Rotate + Pad and Stitch Inpaint grew and
blurred masks over the whole frame. On a 17 MP photo with a small box this
took about 5 s of CPU before sampling, most of it in a 97 px max pool and a
blur over millions of zero pixels.

- Grow, shrink and blur run on a window around the mask's nonzero pixels;
  an empty mask costs one scan.
- Grows use an exact doubling running max instead of a wide max pool.
- Crop + Rotate + Pad reuses its stored original when nothing is
  see-through and drops two redundant copies.

Grows match the old filters to the bit; blurs match within one float32
rounding step. tests/test_box_edit_speed.py checks both and holds 17 MP
timing bounds the old code fails.
2026-11-18 17:46:58 -06:00
ausboss 4832789b48 LoRA Loader: + LoRA list opens folded, with Fold all / Open all
The + LoRA list now opens with every folder folded, so a big LoRA folder
starts as a short list of top folders. A Fold all / Open all button beside
the search box folds or opens every folder at once, and Alt- or Shift-click
on a folder's arrow does the same for that folder and everything inside it.
Left on a highlighted file folds the folder it is in and moves up to it.

A setting (LoRA Loader > Picker folders) brings back the old way: Remember
my folds opens the list as it was left in this browser.
2026-11-18 15:53:04 -06:00
ausboss 9e9121accb Merge pull request #375 from ausboss/release/2.26.4
Release 2.26.4
2026-11-18 14:55:35 -06:00
ausboss 905ee4033f Release 2.26.4 2026-11-18 14:53:34 -06:00
ausboss 3ef9e5f51d Stop a video upload at 4 GB and remove the partial file 2026-11-18 14:50:46 -06:00
ausboss 05628b7834 Merge pull request #370 from ausboss/feat/h3-camera-from-video
H3 Prompt Writer: Camera reads "from the video" when the clip sets it
2026-11-18 14:50:35 -06:00
ausboss c1c1a5e054 Move the Layout Boxes and Camera notes to Unreleased 2026-11-18 14:49:20 -06:00
ausboss a3eb72a30c H3 Prompt Writer: Camera reads "from the video" when the clip sets it
The first Camera choice adds no camera words. With a live clip wired for
copy its moves, swap the person, new voice or change something, the prompt
already hands H3 the clip's own camera, so the list now shows that choice
as "from the video". Keep going makes new footage and keeps "as typed".

Only the shown text changes: the saved value stays "as typed", so saved
workflows and API prompts are unchanged. Card labels functions now also
receive the node, which the label needs to read the wire and the job.
2026-11-18 14:48:54 -06:00
ausboss cacadcf3b1 Merge pull request #369 from ausboss/feat/layout-boxes-h3
Layout Boxes: h3_prompt output for MiniMax H3 Image
2026-11-18 14:48:31 -06:00
ausboss 467505748d Merge pull request #373 from ausboss/test/privacy-browser-faces
Nightly face test: also run as a privacy browser
2026-11-18 14:48:26 -06:00
ausboss c100ef82c4 Merge pull request #374 from KBerwari/patch-1
Fix image previews for filenames with leading spaces
2026-11-18 14:48:22 -06:00
Kurdin Bekes Berwari fa695038ce Add regression tests for image filename whitespace in media_list.test.mjs 2026-11-18 15:36:59 +01:00
Kurdin Bekes Berwari 30cc27b985 Add regression tests for image filename whitespace 2026-11-18 15:35:50 +01:00
Kurdin Bekes Berwari 081379ae97 Preserve empty image selection handling 2026-11-18 15:27:28 +01:00
ausboss 21f97580e9 Merge pull request #372 from ausboss/fix/compare-rest-switch
Image Compare: save the picture it rests on, B for a new node
2026-11-17 23:38:09 -06:00
ausboss 8c6599d2d4 Run the face smoke test as a privacy browser too
--blocked-reads blanks every canvas pixel read the page makes, gives each
node that loads a picture a sample picture, and fails when its face then
draws none. The nightly ComfyUI check runs it beside classic and Nodes 2.0.
2026-11-17 23:34:19 -06:00
ausboss 78312c7bf5 Image Compare: save the picture it rests on, B for a new node
A new node rests on B, the after picture, and saves that with the
workflow. Right-click the node to rest on A instead. A workflow saved by an
earlier version has no saved side: it is worked out from the links as
before and held in memory, so older workflows show what they did and do not
open marked as changed. It is written only when a side is picked.
2026-11-17 23:21:43 -06:00
ausboss 16796566c4 Image Compare: rest on the result when the before comes out of a switch
A before picture that is a switch, handing on your picture for an edit and
the result for a new picture, is fed by the result. The panel read that as
the before being made from the result and rested on it. A switch now only
counts as made from the other picture when one branch is and no branch can
hand on the picture that one started from; a picture the other side can
hand on is the result.
2026-11-17 22:44:32 -06:00
ausboss 3f36952095 Merge pull request #371 from ausboss/fix/blocked-pixel-reads
Show the crop node's picture where the browser blanks pixel reads
2026-11-17 22:43:34 -06:00
ausboss 0f4bd5b135 Draw the crop node's picture where the browser blanks pixel reads
Some browsers and privacy add-ons return blank pixels when a page reads a
canvas. The see-through check read that as a fully see-through picture,
so the stage drew nothing. Probe pixel reads once per page and draw the
picture as it is when they cannot be trusted.
2026-11-17 22:36:57 -06:00
ausboss 8a5fbfe1fb Layout Boxes: drop an unused import 2026-11-17 20:31:01 -06:00
ausboss f6503cc7af Layout Boxes: h3_prompt output for MiniMax H3 Image
A fifth output says the boxes in words for MiniMax H3 Image: where each
box is across and up and down, how much of the frame it takes, and which
box it stands beside. The picture on background is <Picture 1>. An
object box with no description takes the next reference picture.

Places are said only in words, never as coordinates: H3 Image draws
numbers from the prompt onto the picture as text. The help page leads
with descriptions that name the picture and the pose ("the man from
<Picture 2>, sitting on the couch"). With those, people land in their
boxes far more often than with empty boxes.
2026-11-17 20:21:04 -06:00
ausboss 51993c0a2c Merge pull request #367 from ausboss/release/2.26.3 2026-11-17 14:12:39 -06:00
ausboss b043f6f1a7 Merge pull request #365 from ausboss/fix/stitch-tone-match 2026-11-17 14:12:27 -06:00
ausboss 29c986cfdc Merge main into release/2.26.3 2026-11-17 19:02:33 +00:00
ausboss 171ad422b9 Merge pull request #368 from ausboss/registry-scan-fixes 2026-11-17 13:01:54 -06:00
ausboss f4061f4255 Accept either answer for a thumbnail inside a looping link
Python 3.12 raises on the loop while resolving and answers 400; 3.13
resolves it and answers 404. Neither names the path.
2026-11-17 18:57:30 +00:00
Kurdin Bekes Berwari 9d7bcfbfb6 Fix image previews for filenames with leading spaces
Preserve filename whitespace when building image preview URLs. Trimming caused files with leading spaces to fail to display in Image Crop + Rotate + Pad and other nodes using the shared parser.
2026-11-17 19:13:20 +01:00
ausboss 8d139cdfc5 Merge branch 'main' of https://github.com/ausboss/ComfyUI-AusBoss into fix/stitch-tone-match
# Conflicts:
#	CHANGELOG.md
2026-11-17 11:58:55 -06:00
ausboss fae68ecb77 Merge pull request #358 from ausboss/codex/fix-crop-image-copy
Copy original pictures by default with optional edits in the gear menu
2026-11-17 11:53:33 -06:00
ausboss 661c33a926 Merge remote-tracking branch 'origin/main' into codex/fix-crop-image-copy
# Conflicts:
#	CHANGELOG.md
2026-11-17 17:52:23 +00:00
ausboss 9b27bc9c4c Merge pull request #363 from ausboss/fix/looks-line-same-line
H3 Prompt Writer: a swap reads the new person's looks however they are typed
2026-11-17 11:51:58 -06:00
ausboss 2b5d5de853 Merge main into feat/load-audio-clean-up
Main moved Load Audio to Start, Duration and Ends at. Clean up stays the
last input, after max_seconds. The card keeps main's layout (Duration
hidden, it lives in the panel) with the Clean up row and its resetUnknown
added. The help page and description use the new box names, and the
changelog entry moves to the current Unreleased section.
2026-11-17 17:29:41 +00:00
ausboss de530e2eac Merge remote-tracking branch 'origin/main' into codex/fix-crop-image-copy
# Conflicts:
#	CHANGELOG.md
2026-11-17 17:24:29 +00:00
ausboss 7d81a43133 H3 Prompt Writer: split a looks sentence off only after a full stop
"Put @1 looks like a friend here." was cut into "Put" and a looks line
for @1, because the split happened after any character. Now it happens
only where a new sentence starts (after ".", "!" or "?"), so the typed
swap line "with @1 .@1 looks like ..." still splits and a sentence that
merely holds the words stays whole. test_h3_swap_appearance passes again,
and test_h3_prompt_writer checks both cases.
2026-11-17 17:24:00 +00:00
ausboss 0067575b0c Merge branch 'main' of https://github.com/ausboss/ComfyUI-AusBoss into fix/stitch-tone-match
# Conflicts:
#	CHANGELOG.md
2026-11-17 11:23:08 -06:00
ausboss 8cc90794d8 Merge main into fix/looks-line-same-line 2026-11-17 11:23:08 -06:00
ausboss d82ed510b9 Merge pull request #362 from ausboss/fix/h3-writer-all-lines
H3 Prompt Writer: every line in a row is spoken, and a looks line keeps only the looks
2026-11-17 11:17:38 -06:00
ausboss 3f06362f9c Merge pull request #359 from ausboss/fix/h3-writer-video-jobs
H3 Prompt Writer: more video jobs work, carry a line across a cut
2026-11-17 11:17:14 -06:00
ausboss d37e0cd026 Merge pull request #366 from ausboss/docs/skill-example-count
Agent skill: Person Swap page now has 4 examples
2026-11-17 11:17:04 -06:00
ausboss 38bdddded8 Keep tool attribution off commits and PRs 2026-11-17 17:03:06 +00:00
ausboss f0f6ca9f0c Check names as text before the disk and keep paths out of errors
LoRA routes match a name against ComfyUI's list before any lookup.
Image Folder refuses drive letters and control characters anywhere in a
name, checks the joined path before resolving it, and sends a hash in
place of each picture's size and time. Library errors keep their kind
and drop their words when they name a server path.
2026-11-17 17:03:06 +00:00
ausboss d47a6743e3 Release 2.26.3 2026-11-17 16:38:19 +00:00
ausboss ab8389d598 Match new content to the picture beside it when Tone match is on
Skin painted where a shirt was has no before of its own to be read
against, so Tone match left it as painted. It is now compared with the
untouched picture right beside it and matched where the two look alike.
Something different from what is beside it is still left as painted.
2026-11-16 23:19:08 -06:00
ausboss 5b10b3a23f Leave new content as painted when Tone match is on
When the painted area held something new, the inside reading stood down
and the soft edge was read instead. A model that repaints the edge too
puts the new colour there, so that reading took the new colour for drift
and shifted the whole patch the other way: a yellow swimsuit over skin
came back with blue skin and a blue wall.

New content now holds at a zero shift. The edge is read only when the
rim is too small to judge.
2026-11-16 21:45:28 -06:00
ausboss f2d966afd1 Read the inpaint's tone drift at the size the model painted
The reading inside the painted area ran at the pasted size. On a large
picture that made the stitch several times slower, and its 32 px rim was a
sliver at the very edge of what the model painted, where the colour drifts
least.

It is now taken at the model's size and the rim is found with one pass
along each axis. A 3072 px crop reads in 2.6 s instead of 16 s on a CPU, and
a picture of any size is read the same way.
2026-11-16 20:20:23 -06:00
ausboss 182abca56f Agent skill: Person Swap page now has 4 examples 2026-11-16 19:50:23 -06:00
ausboss c1c9831378 Read an inpaint's tone drift inside the painted area
Tone match on Stitch Inpaint barely moved the colour of an inpaint. The
drift was read from the soft edge of the patch, where the sampler had
mostly kept the original, so only a fraction of it was measured.

An inpaint is now read just inside the fully painted area: the middle
colour change of the same pixels in a 32 px rim. It is used when at least
half of those pixels agree and the change is 20 LAB or less; new content
keeps the old reading and is left as painted. Outpaints, blend in and
Tone match 0 are unchanged.

Fixes #361
2026-11-16 18:59:55 -06:00
ausboss 6418940761 Merge branch 'main' of https://github.com/ausboss/ComfyUI-AusBoss into fix/h3-writer-video-jobs
# Conflicts:
#	CHANGELOG.md
2026-11-16 14:09:31 -06:00
ausboss 72af858975 Merge main into fix/looks-line-same-line 2026-11-16 14:09:24 -06:00
ausboss 80e5221403 Merge pull request #364 from ausboss/docs/agent-skill
Add an agent skill for the video workflows
2026-11-16 14:08:32 -06:00
ausboss f658ac58b0 Add an agent skill for the video workflows
npx skills add ausboss/ComfyUI-AusBoss installs skills/ausboss-workflows:
how to write the words for the MiniMax H3 Pika Person Swap and Pika Remix
workflows, which model files to get, and how to run a workflow in ComfyUI.
The folder stays out of the Registry archive.
2026-11-16 13:55:12 -06:00
ausboss adb1eaacc4 H3 Prompt Writer: read a swap's looks sentence on the same line, and clothes on their own line
Both were dropped without a message, so the swap ran with no description of
the new person and the clip often came back unchanged.
2026-11-16 12:25:33 -06:00
ausboss b0f8b5ec55 H3 Prompt Writer: a Chinese or Japanese line keeps its own full stop
Spoken words ending in 。 got a second full stop ('。.'), and words ending
in a full-width comma got ',.'. Those count as line ends now, and a line
in Chinese or Japanese that needs a stop gets 。.
2026-11-16 12:25:19 -06:00
ausboss a3984bf656 H3 Prompt Writer: every line in a row is spoken, and a looks line keeps only the looks
A line holding two quotes, like '"Get a job." @1 looks up and says "What?"'
or '@1 says "Hi" and @2 says "Bye"', was one moment, and only its first
quote reached the prompt. A quote followed by an @ (or by 'and @2') now ends
the moment.

A swap's '@1 looks like' line took the whole line as the appearance, so a
later sentence such as 'The trees behind @1 stay the same.' went into the
description with a raw @1. A sentence there that names an @ again is read
as its own script line.

Spoken words that end in a comma ('"Hi," she says') end in a full stop
instead of ',.'.
2026-11-16 11:50:03 -06:00
ausboss 72543c0b35 Add a Clip length limits fold to the clip node face
min_seconds and max_seconds get a place on the face: a fold under Crop,
pad & resize, built like it and closed by default. The closed header shows
the limits ("5 – 8 s", "from 5 s", "up to 8 s" or "off"); open, it holds
Shortest and Longest as scrub inputs in seconds. Typing one past the other
moves the other along, so the shortest never sits above the longest.
2026-11-16 11:42:12 -06:00
ausboss b2afb6c7a7 Add a clip window for App-mode forms and min/max clip seconds
Video Crop + Rotate + Pad -> Clip gets two appended optional inputs,
min_seconds and max_seconds (0 = no limit). After the window is resolved
the run keeps its length inside them: a longer pick is cut, a shorter one
grows (the start moves back where the video ends first), and a video
shorter than the min is used whole. Fixed frames still wins. Both are in
IS_CHANGED, and nothing changes while both are 0.

The node's timeline obeys the limits (timeline_math.mjs limitClipSeconds
mirrors the backend rule), and a new hidden DOM widget, clip_window, shows
only the part of the video that gets used: a strip of pictures with a box
to drag and edges that stop at the limits. js/app_mode lends it to a form
that lists it; on the graph the node's face is unchanged.
2026-11-16 10:36:56 -06:00
ausboss 232e1dcdb7 H3 Prompt Writer: more video jobs work, carry a line across a cut
- Copy its moves with no person picture keeps the video's own person and
  takes its length from the video.
- Change something with a place or style picture restyles the video from
  the picture, and an empty clip no longer gets a made-up person.
- A thing picture that the lines make do the action takes the moves in its
  own look; a held or worn thing stays a prop.
- Words ending in "..." carry across the next cut once, or end the clip
  mid-sentence on the last line.
- Clips can be 4 seconds long.
- The job lists on the chips are the node's own menu and take a click.
2026-11-15 20:05:06 -06:00
ausboss ab67a1f77f Copy the original picture by default with optional edits in settings 2026-11-15 19:05:26 -06:00
ausboss 2af3fd9c83 Fix crop image clipboard copies including editor controls 2026-11-15 16:36:14 -06:00
ausboss 9986ded109 Merge pull request #356 from ausboss/fix/cache-guard-version-order
Ask for a reload only when the pack is newer than the page
2026-11-14 18:00:18 -06:00
ausboss 197ac04a8c Ask for a reload only when the pack is newer than the page
The update guard asked for a reload whenever the server's version and the
page's differed. After the Manager switches the pack on disk, the server
keeps reporting the old version until ComfyUI restarts, so a reload in
between loads the new files and the message said the page was older when
it was newer.

Now the guard speaks only when the server's version is the newer one, and
versions compare part by part as numbers. A version that is not three
plain numbers, such as "unknown", stays silent.

A page newer than the server stays silent rather than asking for a
restart: from two version numbers it cannot be told apart from a downgrade
with the tab left open, which needs a reload, and the Manager already asks
for its own restart after a switch.
2026-11-14 17:47:11 -06:00
ausboss be2a2a1444 Merge pull request #355 from ausboss/release/2.26.2
Release 2.26.2
2026-11-14 10:58:10 -06:00
ausboss 76eb4fc7e7 Release 2.26.2 2026-11-14 10:57:05 -06:00
ausboss 057f2bd05a Keep refused file names, script addresses and held runs off the disk
Three findings from the Comfy Registry's review of 2.25.2, all still in
2.26.1:

- The change check of Load Image, Load Image + Pad, Image Crop + Rotate +
  Pad and both Video Crop + Rotate + Pad nodes handed a value its resolver
  had refused to os.stat and Path.resolve. stable_file_fingerprint now
  opens only a Path a resolver returned; a refused value is hashed as text.
- The script version tagging joined the request's address to the js folder
  and resolved it before checking it. It now looks the address up in a
  list of the pack's scripts made at startup.
- Save Image's keep route read the run's list from a JSON file in the temp
  folder, which takes uploads, and built the copy source from its
  extension, so a planted list could copy a server file into output. Runs
  now stay in memory (the last 256), held pictures are named from the
  token, their number and Save Image's own formats, must sit directly in
  the held folder, and a run holds at most 10,000 pictures.
2026-11-14 10:56:27 -06:00
ausboss 172252ab02 Merge pull request #353 from ausboss/release/2.26.1
Release 2.26.1
2026-11-14 07:09:37 -06:00
ausboss ebc81ea57e Release 2.26.1 2026-11-14 07:08:54 -06:00
ausboss bc235e96e5 Merge pull request #352 from ausboss/fix/no-home-path-expansion
Stop expanding ~ paths and opening a typed LaMa model path
2026-11-14 06:53:14 -06:00
ausboss 6572b49386 Stop expanding "~" paths and opening a typed LaMa model path
Image Folder compared a pasted "~/..." path after expanding it; only a
path written out in full is compared now. LaMa Inpaint resolved a typed
path when ComfyUI's folder list was missing; it only takes a name from
models/lama now. Neither could read outside ComfyUI's folders, but both
read like it to a code scan.
2026-11-14 06:28:13 -06:00
ausboss d593e01fc9 Merge pull request #351 from ausboss/release/2.26.0
Release 2.26.0
2026-11-14 06:21:08 -06:00
ausboss 009aa95d98 Merge remote-tracking branch 'origin/main' into release/2.26.0 2026-11-14 06:12:49 -06:00
ausboss b61b3efc94 Merge pull request #350 from ausboss/feat/clip-timing
Clip timing as Start, Duration and Ends at, on the clip node, Load Video and Load Audio
2026-11-14 05:58:07 -06:00
ausboss 6cfed25a8e Timing wording follows the new boxes
Backend tooltips and descriptions, the README and the help pages say
Start, Duration and Ends at where they still said IN, OUT, Length or
Max length. Load Video's help no longer says a typed 0 runs to the end:
Whole video does that.

Load Video's timing card refreshes when a wire is connected or removed.
The old Length switch function is gone from the timing card.
2026-11-14 05:42:17 -06:00
ausboss 27e175aa08 Release 2.26.0 2026-11-14 05:31:40 -06:00
ausboss 6224bae13c Timing boxes: App mode fields, Duration 0, one link reader
Every nth, the frame limit and the audio Duration are hidden by the
widget card again, so App mode can still show them as fields.

Load Audio: an empty or 0 Duration runs to the end of the file, and a
box whose linked value is only known at run time stays empty. The rules
for what a pick stores are in audio_window.mjs with tests.

The shared link reader asks the frontend for an input's link before
reading the link table, and Layout Boxes and H3's clip lookup use it
alone.
2026-11-14 05:28:02 -06:00
ausboss bd49afae19 Merge main: keep both sets of Unreleased entries 2026-11-14 05:28:02 -06:00
ausboss 13e4d73dbd Merge pull request #347 from ausboss/feat/app-mode-cards
Make App mode work with AusBoss nodes: card fields, found models, clip upload
2026-11-14 05:17:16 -06:00
ausboss 37584519e8 Merge pull request #349 from ausboss/fix/lora-in-missing-models
List missing LoRAs in ComfyUI's missing-models list
2026-11-14 05:16:45 -06:00
ausboss 1ed921b6fb Load Video and Load Audio on Start, Duration and Ends at
Load Video uses the clip node's timing card: Start, Duration and Ends at
replace the IN/OUT fields and the Limit row. Its face reads the frame
count from the file, so a 247-frame clip no longer shows 248.

Load Audio gets the same three boxes in place of IN/OUT and Max length;
the Duration is the max_seconds widget, so saved values are unchanged.

One linked-number reader (linkOrigin) follows Reroutes, subgraphs and
older Primitive nodes for the clip node, both loaders and Layout Boxes.
2026-11-14 04:07:29 -06:00
ausboss 15e5803a06 List LoRA Loader's missing files in ComfyUI's missing-models list
ComfyUI builds its missing-models list (the Issues panel and Download all)
from list widgets only. LoRA Loader keeps its files in the rows' text, so a
LoRA a workflow needs was never listed, and Download all then Run stopped on
'missing LoRA file'. Each row that needs a file now gets a hidden list widget
holding its name: kept out of the saved workflow and the prompt, with no
socket, made again from the rows whenever they change. A replacement picked
in the Issues panel goes back to its row.
2026-11-14 03:57:14 -06:00
ausboss a0327f6ddd Clip timing as Start, Duration and Ends at
The clip node's Length on/off switch is replaced by three boxes. Dragging
the start moves the clip, dragging the end or typing a Duration changes
its length, and a seconds | frames switch picks the units. Extra details
moved into hover text, and a note shows only when something needs fixing.

With a linked frame rate, the latest start was worked out on the source
frame grid, so a typed start of 60 settled on 7. It now uses the output
rate. A rate typed inside a subgraph is followed, so Person Swap shows its
clip length before a run. A cap the video cannot fill says so, and Ends
at no longer runs past the video's last frame.

H3 Prompt Writer shows how many of the clip's frames H3 makes. The Crop +
Rotate + Pad panel rows fill the node's width instead of stopping at
460 px, and the size line drops its empty warning row.

Frontend only: inputs, outputs and saved values are unchanged.
2026-11-14 03:27:00 -06:00
ausboss e65612bb28 Merge main: keep the tile snap entry and the App mode entries in Unreleased 2026-11-14 02:55:58 -06:00
ausboss 11d79b252d Merge pull request #348 from ausboss/fix/tile-snap-visible-edge
Snap tiles by their visible card
2026-11-14 02:52:00 -06:00
ausboss 7e5cadaa06 Snap tiles by their visible card
A frameless tile (link, title or note tile) draws a card inside a wider
transparent node. Snap into line and Line up measured the node, so tiles
lined up with a gap around them. A tile also moves itself and keeps its
pointer moves to itself, so Snap into line never saw a tile being dragged.

The tile now names its card as its outline, and its drag reports each
move to Snap into line once the tile is placed. The move itself still
stops at the tile: letting it through made Nodes 2.0 pan the canvas.
2026-11-14 01:59:46 -06:00
ausboss 94d302e112 Contributor guide: App mode needs upload flags on file lists 2026-11-13 23:15:34 -06:00
ausboss fb26f3ae06 Let the video crop nodes take uploads in App mode
Their video list did not carry video_upload, so in an App mode form the
clip field was a bare list with no way to upload a clip, while the picture
field next to it had a picker and an Upload button. Both video crop nodes
now declare the flag, as Load Video does. ComfyUI adds its upload button to
the node, which the crop panel already hides, so the node face is unchanged.
2026-11-13 21:58:15 -06:00
ausboss 11638b0557 Pick a model the user already has in a subfolder without a click
A workflow saved with a bare model name opens with that loader red when
the user keeps the file in a subfolder. The Guide already found the copy
and offered Use it; App mode shows no Guide, so the form opened with
"2 issues found" and Run blocked. Now the Guide points the loaders at the
copy as the workflow opens, when there is exactly one, and says so in a
toast. Two copies in different subfolders still get the Use it button.
Setting AusBoss.Models.PickFoundCopy (on by default) turns it off.
2026-11-13 19:41:17 -06:00
ausboss ad81fbcca1 Show card widgets as real controls in App mode
App mode reads the same hidden flag the pack's cards set on the widgets
they replace, so every field from a carded node (Load Image, the video
loaders, H3 Prompt Writer) drew an empty row in the form. While the open
workflow is in App mode, the widgets its form lists are now shown; back in
the graph they are hidden again, so node faces do not change.

showWidget also stops leaving computeSize, computeLayoutSize and draw
behind as own undefined properties: the frontend took those for a
custom-drawn widget and picked the legacy renderer.
2026-11-13 19:04:50 -06:00
ausboss 9cc91ffba8 Merge pull request #346 from ausboss/fix/playhead-readout-hint
Release 2.25.3
2026-11-13 15:15:54 -06:00
ausboss 0450466422 Release 2.25.3 2026-11-13 15:15:00 -06:00
ausboss d5442cd659 Explain the video clip's frame readout in plain words
The readout beside Play (fr 52 · 0:02.17) now says on hover which frame
the picture shows and how many seconds into the video it is, and the
help page explains it.
2026-11-13 15:12:53 -06:00
ausboss 9a1096149a Merge pull request #345 from ausboss/release/2.25.2
Release 2.25.2
2026-11-13 10:12:14 -06:00
ausboss 0401d9dd34 Release 2.25.2 2026-11-13 10:11:16 -06:00
ausboss 8961827079 Merge pull request #343 from ausboss/fix/wheel-in-text-box
Zoom the graph over a text box that has nothing to scroll
2026-11-13 10:11:06 -06:00
ausboss dea2eac8cd Merge pull request #344 from ausboss/fix/trim-in-past-length
Let the clip's IN handle drag when the Length covers the whole clip
2026-11-13 10:10:51 -06:00
ausboss 3c1eeaa486 Let the clip's IN handle drag when the Length covers the whole clip
A Length as long as the clip or longer locked IN at frame 0, and the only
way to trim the start was to turn Length off. A workflow that sets a
Length as an upper limit (240 frames, say) hit this with every shorter
clip. Now such a Length only caps the clip: the clip's own end is OUT and
IN moves over the whole clip. A Length shorter than the clip still stops
IN where OUT meets the end, as before. The row reads "= the whole clip"
and the tooltips say what dragging does.

Every IN this allows was already reachable with Length off; the backend
runs each one (checked on a 116-frame clip with Length 240: IN at 0,
1.83 s, 4.5 s and the last frame all run).
2026-11-13 10:08:47 -06:00
ausboss cf0eec8d31 Zoom the graph over a text box that has nothing to scroll
A text box on one of the pack's nodes kept the mouse wheel whenever the
cursor was in it, even when it was empty, so the graph stopped zooming
until you clicked away. A box now keeps the wheel only while it can
still scroll that way, typed in or not, as ComfyUI's own text boxes do.

Ctrl + wheel and trackpad pinch always zoom the graph; over a long text
box or list they zoomed the whole page.

The Callout editor no longer stops the wheel; the shared rule already
lets its text scroll.
2026-11-13 02:48:54 -06:00
ausboss 8618d8ca56 Merge pull request #342 from ausboss/release/2.25.1
Release 2.25.1
2026-11-13 00:52:23 -06:00
ausboss 46dde36185 Release 2.25.1 2026-11-13 00:50:15 -06:00
ausboss a29ca76fe8 Merge pull request #341 from ausboss/feat/edit-lock-tint
Edit Lock Restore: take out the pink tint the edit model adds
2026-11-13 00:46:16 -06:00
ausboss 2908eac20c Edit Lock Restore: take out the pink tint the edit model adds
MiniMax H3 Image makes every edit a little pinker, bluer and lighter
over the whole picture (Lab a +2 to +7 at 16 MP). Edit Lock removed it
where it locked, but when it stepped aside (new hair color, new
background, rain) the tint stayed.

Edit Lock Restore gets an optional remove_tint switch, on by default.
It lines the decode up with the original, reads the even Lab shift on
the part the edit left alone, and subtracts it from the whole picture
before the paste. A shift is only taken out when it looks like the
model's tint, so golden hour, red light and restyles pass untouched.

On 21 real edits at 16 MP: taken out on the 5 tinted ones (a +2.6 to
+6.5 down to +0.4 or less), left alone on the other 16. A different
sampler or less compressed weights (bf16 DiT, int8 text encoder) did
not remove it.
2026-11-13 00:44:24 -06:00
ausboss 1276d95708 Load Audio: Clean up switch for voice recordings
- New optional clean_up input (off by default, so saved workflows run
  as before). On, the sound that comes out is one channel, with rumble
  and mains hum under 80 Hz taken out, hiss turned down by up to 12 dB
  from a noise print of the quietest moments, the quiet start and end
  cut (0.1 s kept before the first sound, 0.2 s after the last), and the
  volume set to -18 LUFS with a look-ahead limiter that keeps peaks under
  -1 dBFS.
- It runs after the start/end/max trim, so seconds is the length of the
  sound handed on.
- Torch only, at the file's own sample rate. No new dependency.
- The card gets a Clean up off | on row; older saves, which hand the new
  input the upload button's empty value, open with it off.
2026-11-12 22:17:32 -06:00
ausboss 39a7599fd9 Merge pull request #339 from ausboss/release/2.25.0
Release 2.25.0
2026-11-12 12:14:52 -06:00
ausboss c4e519565b Release 2.25.0 2026-11-12 12:07:14 -06:00
ausboss f18b8f6ca3 Merge pull request #327 from ausboss/feat/load-image
Load Image: a loader that also sets the size
2026-11-12 11:54:26 -06:00
ausboss 64ab3e9761 Load Image: crop from a side, crop without resizing, and a picture preview
- Keep (crop_from) picks the part of the picture a crop keeps: the
  center, a side or a corner. Crop to fill used to cut from the middle
  only.
- Two more Size choices that only cut and never resize: crop takes a
  width x height piece, and crop to ratio takes the largest piece of a
  shape such as 16:9. Ratio lists 13 shapes, or takes the shape from
  the width and height boxes. Round to rounds these down so the piece
  stays inside the picture.
- Two small pictures on the node show the file going in, with the kept
  part lit and the cut part dark, and the picture coming out, both on
  one scale. Between them the node names the shape and what happens
  ("3:4 -> 1:1", "77% size", "cuts 449 px of height"). A click on the
  first picture picks the part to keep.

The browser repeats the new arithmetic, and the shared table of cases
(now 469) holds it to the backend's answers.
2026-11-12 11:33:12 -06:00
ausboss 065f2cb14c Merge main: Load Image stays in Unreleased above the 2.24.0 section 2026-11-12 10:37:50 -06:00
ausboss 3d99ddd35a Merge pull request #338 from ausboss/fix/preview-slow-link
Save Image: a small picture on the node, a Save row, and no stale picture on a slow link
2026-11-12 10:37:38 -06:00
ausboss 224b4af1da Merge remote-tracking branch 'origin/main' into fix/preview-slow-link
# Conflicts:
#	CHANGELOG.md
2026-11-12 10:36:36 -06:00
ausboss 0a7177b151 Merge pull request #337 from ausboss/feat/callout-info-card
Callout: Info card style with a title, rows and small print
2026-11-12 10:34:40 -06:00
ausboss b31561d1a0 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	CHANGELOG.md
2026-11-12 10:33:54 -06:00
ausboss ba4ab486c3 Merge pull request #336 from ausboss/feat/clear-vram-menu
Clear VRAM on the canvas right-click menu
2026-11-12 10:33:34 -06:00
ausboss 4603256ebf Save Image: a row over held pictures with a solid Save button
With Auto save off the only way to save was a small SAVE label in the
corner of the preview bar, easy to miss.

A row between the bar and the picture now says "Not saved yet" and holds
a solid button: Save picture, Save all 4, Save this one, Save the rest.
After a save it says what is saved, with the file's name for one picture.
The row shows only while the node holds pictures, takes its own room so
the picture keeps its floor, and stays with the preview off.

The button is primaryAction in the shared panel controls; the wording is
keepWords, with a test.
2026-11-12 10:24:27 -06:00
ausboss 52b23691dc Save Image shows a small copy of each picture on its face
The node's face loaded the whole saved file: 31 MB for a 9232 x 4608
sheet, where the panel draws a few hundred pixels of it. On a 2.8 MB/s
link that took half a minute.

Save Image now writes a WebP copy of each picture, at most 2048 pixels on
the long side, into the temp folder (ausboss_preview) and names them in
its result. The panel shows that copy and goes back to the file itself
when the copy is gone, as after a restart. The queue still lists the
saved file, and preview off writes no copy.

Same link, same picture: the new picture shows 0.3 s after the run
(0.2 MB), where it took 32.6 s.
2026-11-12 10:13:23 -06:00
ausboss df773658da Save Image shows the new picture when it loads slowly
The frontend loads a node's result into node.imgs with a time limit: two
tries of about 8 seconds. A picture that takes longer is dropped and
node.imgs keeps the run before. The preview panel preferred node.imgs, so
a 31 MB sheet over a 2.8 MB/s link never showed; the panel stayed on the
older picture.

The panel now notes which output record node.imgs was loaded for and uses
the stored output when that is not the current one. While a new picture
loads, the one before dims after a moment.
2026-11-12 10:01:38 -06:00
ausboss d4636bb5e3 Callout: Info card style with a title, rows and small print
Right-click a Callout and pick Info card for a small card: the first line
is its title (a clock, info, warning, bulb or tick emoji at its start is
drawn as a line icon), a line with a | is a row with the label on the left
and the value on the right, a row in bold is drawn in teal, and small
print is a grey line. An empty note starts with sample text.

The card look is a node property and the text is the note's own text, so
an Info card saves as a plain Callout: an older pack shows the same text
as a note with its rows written out. A plain callout never reads | as a
row, so no note written before changes.
2026-11-12 08:21:31 -06:00
ausboss 83f59cac93 Clear VRAM on the canvas right-click menu, with a setting to hide it
Right-clicking the empty canvas offers Clear VRAM, which sends ComfyUI's
own free request (unload models and free memory) and shows a toast with
the result. The setting AusBoss.Memory.ClearVramMenu (on by default)
hides the entry, and so does ComfyUI's Comfy.Memory.AllowManualUnload.
2026-11-12 07:19:25 -06:00
ausboss cfbc42799a Merge main so Load Image and Edit Lock share one changelog section 2026-11-11 17:08:23 -06:00
ausboss b4657e2b58 Load Image: a loader that also sets the size
A new node, Load Image. It loads a picture and sets its size in the
same node, so a workflow needs no resize node and no size node after
its loader.

- Size: off, megapixels, longest side, scale, fit inside, or crop to
  fill. Each choice shows only the numbers it uses. Round to rounds
  the result to a multiple. Under More: the resize method, and Enlarge,
  which when off only ever makes a picture smaller.
- Arrows under the file picker step through the input folder, with
  the picture's place in the list beside them.
- The node shows the size going in and the size coming out before a
  run. The browser repeats the backend's arithmetic, and a table of
  252 cases holds the two to the same answers.
- Outputs: image, mask, width, height, filename, original_width,
  original_height. The mask is the picture's transparency, as the
  stock loader gives it, at the new size.
- The picture on the node is ComfyUI's own preview, so the mask editor
  and clipspace work as they do on the stock loader.
- With Size off the pixels are the file's own.

Mask by Touch and the run check know the new loader as a source.
2026-11-10 17:42:00 -06:00
353 changed files with 38358 additions and 2066 deletions
+6
View File
@@ -0,0 +1,6 @@
{
"attribution": {
"commit": "",
"pr": ""
}
}
+4
View File
@@ -24,6 +24,10 @@ 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/
+10 -2
View File
@@ -13,7 +13,11 @@ 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.
# 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.
#
# 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
@@ -31,6 +35,7 @@ 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
@@ -117,7 +122,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 and Nodes 2.0
- name: Every node's face comes up, classic, Nodes 2.0 and a privacy browser
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 &
@@ -125,6 +130,9 @@ 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() }}
+759
View File
@@ -2,6 +2,765 @@
All notable changes to ComfyUI-AusBoss are documented here.
## 2.30.0 - 2026-11-28
- **H3 Prompt Writer 🆎 has a gear menu.** The gear at the top right of the
node holds two things. Sockets picks whether the node shows only the
sockets in use or all of them. Under it are the four things the model on
clip is asked: describe a new person, fill in the next moments, hear the
place, and tidy up my lines. Each can be edited, and the edit is saved in
the node, so a shared workflow asks the same. Back to built-in undoes it,
and Reset puts the sockets and all four back. The editor checks with you
before Esc throws away your typing, and before Save keeps a wording that
lost a name the node fills in, such as {lines}.
- **Mask by Touch 🆎 can use RMBG-3.0 for soft edges.** With Bria's
RMBG-3.0 files in place, Fine edges offers RMBG-3.0 next to BiRefNet, and
Subject and Background use it too. It keeps loose hair, fur and lace that
BiRefNet cuts hard, at about 14 GB of files and about 2 seconds a picture
once loaded. Its licence is non-commercial. Fine edges still starts at off,
and Subject and Background then use BiRefNet. The ? page says where to get
the files.
- **H3 Prompt Writer 🆎 shows how it read a swap.** A small "Read as" line
under the script says who each new person replaces, as you type. Click it
to open the full reading: the Ref2VA tab lists the cast lines the writer
sends to H3, and the Plain tab says the same in everyday words. Words a
swap can't use, such as "make the camera spin", show in amber as not
used, and a line the writer would refuse says why before you run it. The
writer also reads more ways of saying it: a description right after the
picture ("replaced by @1, a game character with orange hair"), names
("Elon is @1"), clothes after "and wears", and one line per person when
two people swap. Before, some of those words were dropped or the wrong
person was replaced.
- **Undo takes back a drag on a node's face as its own step.** Moving a
moment on H3 Prompt Writer's timeline, picking a picture's job from its
chip, dragging Strength Curve's points, and picking the crop side or the
next file on Load Image's strip were never kept as steps of their own.
One Ctrl+Z took back the change before them too, and the drag could not
be brought back. Each one is its own step now.
- **H3 Prompt Writer 🆎 shows the script's problems when the clip sets the
length.** With copy its moves, swap the person, new voice or change
something, a mistake such as `@5` now shows under the script, as it does
for the other jobs. Before, the node said nothing and the run stopped.
- **H3 Prompt Writer 🆎 speaks a line whose closing quote is missing.**
`He says "Wait for me` is spoken to the end of the line, the way the
script box already colours it. Before, the words went in as plain action.
- **H3 Prompt Writer 🆎 asks you to change a second start or end picture.**
Two pictures set to start on it, or two set to end on it, now say which
one to change. Before, the second one was left out of the prompt without
a word.
- **H3 Prompt Writer 🆎's picture chips stay on one line.** With four
pictures and a video plugged in, the video chip dropped onto the Length
row, where it was hard to click. The chips now share their row: on a
narrow node the longest jobs are cut short first, and pointing at a chip
shows its whole job.
- **H3 Prompt Writer 🆎 says when a style picture is used like a thing.** A
line such as "@1 wears @3" with Picture 3 set to style now shows a note
under the timeline: a style is a look, so write "in the style of @3" or
give the picture another job. The run still goes ahead.
- **H3 Prompt Writer 🆎 gives each person named in words their own line.**
With `A barista … says "…"` and `The customer … says "…"`, both lines
went to the person in the picture. Each one now says their own line.
- **H3 Prompt Writer 🆎 says a shout typed without quotes.** `he yells wait`
is spoken now. Before, it was read as something that happens, and nothing
was said.
- **H3 Prompt Writer 🆎 keeps how a line is said.** `@1 whispers "Stay
quiet."`, `shouts`, `sings`, `yells`, `mutters` and `asks` all reached
the model as "says". The word you typed is kept now, and so are words
between it and the line, as in `says quietly "Hello."`.
- **H3 Prompt Writer 🆎 reads "Close-up of her boots" as a framing.** After
a blank line, a framing typed without "a" in front ("Close-up of...",
"Wide shot of...", "POV from...") was sent to H3 as a cut to a new place,
and the person could come back in other clothes. It is now a cut to that
framing in the same place, as "a close-up of..." already was.
- **H3 Prompt Writer 🆎 ignores chat talk from its small model.** When the
model on clip answered "Sure! Here are the next moments:" or "I'm sorry,
but I can't help with that", those words became a moment in the clip or
its sound. They are left out now, and so are labels such as "Moment 2:"
in front of a line.
- **H3 Prompt Writer 🆎 keeps what someone does after they speak.** A line
such as `@1 says "Hi" and waves.` went to H3 as "and waves." with nobody
doing it. The writer now puts the person back and keeps the order: the
line is said, then @1 waves. Words about how a line is said, like
"slowly" or "to the camera", stay with the speaker too. A sign's words
("a sign reading "CLOSED"") end their sentence, and bold or italic marks
pasted with a script (`**@1**`) no longer reach the prompt.
- **H3 Prompt Writer 🆎 hears a line in single quotes with an apostrophe.**
"She says 'I don't know.'" was written as plain text, so nobody spoke it.
The words are now a spoken line, as they are in double quotes.
- **H3 Prompt Writer 🆎: "none" in Sound turns the sound off.** Typing none,
off, silent or no sound in Sound wrote the word "None." as the clip's
sound. It now means no sound of the place, and the music you typed stays.
The same words in Music mean no music.
- **H3 Prompt Writer 🆎: clearer timeline and messages.** A 4 s clip shows a
4 s bar. The note under a clip that H3 shortens says how much is left
out. `@5` says there are four pictures, and a line that names a missing
picture says to connect it or turn it on.
- **Long text boxes scroll with the mouse wheel in Nodes 2.0.** In the new
node view, turning the wheel over a text box with more lines than fit
zoomed the graph and the text stayed put, even while typing in it. The
box now scrolls first, and the graph zooms once the text is at its top or
bottom, as in the classic view. This covers Text 🆎, Text Lines 🆎,
Prompt Variations 🆎, Krea 2 Encode 🆎 and H3 Prompt Writer 🆎.
- **Mask Refine 🆎's guided and matting edges follow the picture.** Both
edge modes now look further from the mask's edge and snap to the real
edge in the guide image, so hair and thin parts a rough mask missed come
back. Two new settings under More, Detail range and Fix threshold, tune
them. Workflows that use guided or matting will give a cleaner, different
edge after updating. The node can also run on its own now, to check a
mask before the rest of the graph. Thanks to kajan988.
- **LoRA Loader 🆎 leaves out a skipped LoRA's trigger words on a flat
curve too.** With Stop on missing LoRA off, a row whose file is missing is
skipped and its trigger words stay out of `triggers`. That broke when the
row followed a Strength Curve that holds one value the whole run: the LoRA
was skipped, but its words still reached the prompt. They stay out now,
as they already did with no curve or a curve that moves.
- **H3 Prompt Writer 🆎 shows only the sockets you use.** A new node has
five inputs and four outputs, where it had nine and fourteen. Connect a
picture and the next picture socket appears, and an output appears once
its input is connected. The picture chips under the words do the same: a
chip shows for each picture or video you plugged in. Saved workflows are
unchanged: every wire stays where it was and the node sends the same
things. To see every socket and chip all the time, turn on **Settings →
🆎 AusBoss → H3 Prompt Writer → Show every socket**.
- **H3 Prompt Writer 🆎: the grey hints in Sound and Music read as examples.**
They now say `(e.g. rain on a window)` and `(e.g. slow piano)` in
italics, so an empty box no longer looks filled in. Every one-line text
box in the pack shows its hint in italics.
## 2.29.0 - 2026-11-27
- **H3 Prompt Writer 🆎 can tidy up your lines.** Turn on **More → Tidy up
my lines** with a small text model such as Qwen3-VL 8B on `clip`, and it
fixes spelling, writes short sentences, and puts each spoken line right
after whoever says it before the node reads them. Your quoted words are
never rewritten: they stay exactly as typed. Off by default.
- **Load Audio 🆎: Clean up.** Turn on **Clean up** for a voice recording
and it comes out as one channel, with the quiet bits at the start and end
cut, less hum and hiss, and an even volume that never clips. A video model
that copies the sound it is given copies its noise too, so this helps a
phone recording. It is off by default, so saved workflows are unchanged.
- **H3 Prompt Writer 🆎 keeps to what you wrote.** It lays your notes out
for H3 and adds no sounds or settings you didn't type. Notes are read more
carefully too: "muted colours" no longer turns the sound off, "First
person view" keeps its first word, a shirt or sign that says something
stays written on it, and a "no music" said inside quotes stays part of
the line.
- **H3 Prompt Writer 🆎 follows your layout more closely.** A `camera:` or
`sound:` line belongs to the shot it is typed under, `Shot 2:` on its own
line starts the next shot, and two people quoted in one sentence each get
their line. Single quotes after "says" count as speech, "in voiceover"
after a quote keeps the lips closed, `Cut back to` returns to a place,
and `Start on black.` works. A number such as "7 seconds remain" stays
part of the action, and two people are no longer placed left and right
unless the script says where they stand. With two or more people, a
spoken line reaches H3 as you typed it.
- **New node: Strength Curve 🆎.** Draw how strong something should be
from the start of a run to the end, and wire it into a node that follows
it step by step. Drag the points or start from a preset (flat, fade out,
fade in, ease out, ease in); Top and Bottom set the strength range.
- **LoRA Loader 🆎 rows can follow a strength curve.** A new `curve` input
takes a Strength Curve, and each row gets a curve mark: rows you mark run
at their strength times the curve at every step, so a style LoRA can fade
out before the last steps. It works with every model file, fp8 and int8
included.
- **Krea 2 Encode 🆎 can change the reference's strength over the run.** A
new `reference_curve` input takes a Strength Curve: 1 follows the
reference as before, 0 ignores it. It also works with Krea 2 Outpaint
Model Patch 🆎.
- **New node: Film Grain 🆎.** Adds film grain to a picture or a video.
The grain is strongest in the midtones and gentler in deep shadows and
highlights, as on film. Size, roughness and colour set its look, it moves
from frame to frame on a video (or stays put), an optional mask limits
where, and the same seed gives the same grain.
- **Film Grain has an Auto switch.** With Auto on, the node picks the grain
for the picture: the same look on a small or a big one (the size follows the
picture's size), and an amount that matches the grain the picture already
has. A clean render starts at the normal 0.25. Amount and Size then count as
multipliers ("1 × = Auto's pick"), with the real value in small type beside
each box. Auto on and Auto off keep their own numbers, and Auto starts off,
so saved workflows behave as before.
- **Film Grain can copy another picture's grain.** Wire a picture whose grain
you like into `grain_from` and switch Auto on (it reads "match"). The node
reads that picture's grain, how strong, how big and how colourful, and adds
grain like it; Amount, Size and Color then count from the match ("1 × = the
match"), with the real value beside each box. The picture to copy from is
scaled to your picture's size first, so the grain matches at the same
viewing size, and only its plainest patches are read. Roughness stays yours.
- **Film Grain, Keep Detail and Cut Out show a live preview.** After one run,
the picture on the node redraws while you drag a value, with a "not run yet"
tag until you queue. A Fit | 100% switch left of Preview shows the whole
picture or real pixels; at 100% dragging the picture moves around it.
- **New node: Cut Out 🆎.** Turns a picture and a mask into a cut-out with a
see-through background, ready to save as a PNG. Clean edges takes the old
background's colour out of hair and soft edges so there is no halo, and
fully kept pixels stay exactly as they were. Grow, feather, haze and
solid-core levels, and smoothing over video frames, are on the card.
- **New node: Keep Detail 🆎.** Puts the original picture's fine detail
back on an edit that came out too smooth. The edit keeps its shapes,
light and colour; Light only never shifts a colour. The two pictures must
line up.
- **Check layout 🆎 shows what makes a workflow hard to read.** Right-click
the canvas or use the command palette. It lists overlapping nodes and
groups, wires that run backwards or hide behind a node, nodes just under a
preview that grows when it runs, nodes outside every group, a saved zoom
too small to read and a missing Workflow Note, inside subgraphs too. Click
an entry to jump to it. Nothing is moved.
- **The example workflows are tidied so Check layout finds nothing.** Only
node and group positions and sizes, and reroute spots, changed. What each
workflow does is the same.
- **Frame Interpolate 🆎 holds cuts between two shots of the same place.**
It used to count a cut only when the frame changed more than **Scene
cut**, and two shots of one place in the same light can change less
than fast movement inside one shot, so it mixed those shots together
for a frame or two. A change that jumps out from the frames around it
now counts as a cut too. **Scene cut** still works as before, and `0`
still turns cut finding off.
- **Latent Size 🆎: pick which ratio chips show.** The gear's Ratio chips
row opens a list of every ratio with its size. Switch each on or off,
remove one, add your own such as 21:9, or reset to the shipped list.
5:4 and 21:9 now come in the list, switched off. A chip keeps the name
it was given, so 21:9 no longer reads 7:3.
- **Edit Lock 🆎 says what is wrong when the VAE and model don't match.**
The readout used to blame the VAE alone. It now says either file can be
the wrong one, gives the two channel counts it compared, and points to
the model and VAE in the workflow's notes. A GGUF or other converted
model is a common cause.
## 2.28.1 - 2026-11-25
- **Image Resize 🆎 shows Fit only when it is used.** Fit, and Fill under
pad, now show only for a Width × height target. The other targets take
their shape from the picture and always fit it, so those rows did
nothing there.
- **Photo Camera 🆎's More fold opens.** Crop margin and 360 width sat in
a fold with no header, so nothing could open them. The card now has a
More row that shows them.
## 2.28.0 - 2026-11-24
- **New node: Photo Camera 🆎.** It works out the camera your photo was
taken with, so a 3D model of the person lines up with the photo. Wire in
the photo, the person's mask and the photo's lens width (MoGe measures
it). It hands Pixal3D the crop's lens, the 3D viewer your photo's own
view, and where the photo goes on a 360 canvas so the 360 lines up
behind the model.
- **The 3D viewer can cut the front or back off a model.** Cut front and
Cut back on the 360 strip's Model tab take away part of the model as the
camera sees it, such as the inside of a hat that should sit behind the
head. Pause for Shot 🆎 gets an optional `mesh` input and output that cut
the run's model the same way, so the shot matches the viewer.
- **Pause for Shot 🆎 keeps the viewer's 360 settings on runs that don't
pause.** With Pause on *run through*, the backdrop now uses the Turn,
Tilt, Shadow and the rest saved on the viewer, as a paused run does.
Before, such a run used the 360 unturned.
- **Layout Boxes 🆎 says the boxes as sentences for any prompt.** A new
`placement` output writes each box as a plain sentence: what goes there
and where, such as `The words "FRESH" in bold black letters, placed top
left, from 6% to 52% across and 6% to 25% down.` Add it to the prompt of
a model that has no box input, and the things land where you drew them.
- **Color Match 🆎 can fix an edit that looks pasted on.** A new method,
`kept`, takes the picture from before the edit as reference. It learns how
the model shifted the parts it was meant to keep (darker, more contrast,
more colour) and undoes that, so a new word or object sits in the same
tone as the rest. New things keep their own colours.
- **Save Image 🆎 can write Civitai info.** Pick **Civitai** in the Embed
switch (Off | On | Civitai) and a saved picture also carries its prompt,
settings and the fingerprints of its model and LoRAs in the form
civitai.com reads first.
An upload then shows its prompt, lists its resources and gets the ComfyUI
tool and txt2img or img2img technique tags, including for
Krea 2, Qwen Image 2.1 and prompts inside subgraphs, where Civitai found no
prompt and flagged the upload "Unable to Verify AI Generation". It is off
by default, because Civitai then shows those settings in place of the
ComfyUI workflow; 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.
- **WebP pictures from Save Image 🆎 and Save Video 🆎 carry the workflow the
way ComfyUI's own WebP does.** ComfyUI could not read the workflow back
out of Save Image's WebP files, and civitai.com did not see them as
ComfyUI pictures at all. They now use core ComfyUI's layout, so a WebP
drags back into ComfyUI with its full graph and Civitai reads its prompt.
Save Video's animated `webp` now embeds the workflow too, as core's
animated WebP does; its Embed workflow row shows for `webp`.
- **LoRA Loader 🆎 can fetch Civitai info for every LoRA at once.** A new
**Fetch all LoRAs** button in a LoRA's info card (also in the gear menu) looks
up each LoRA in the stack that has no Civitai info yet, one at a time
with a short pause, and saves its info and picture the same way the
one-LoRA button does. The bottom of the node shows how far it is
(`Civitai 12 / 44 · Stop`); click it to stop. It follows the Civitai
picture setting, never replaces a picture, and slows down or stops when
Civitai asks it to.
- **Image Toolbox can cut a piece of your own size.** Pick the new job
**cut a piece**, set the width and height in pixels, pick where it sits
(a corner, an edge or the centre) and move it right or down from there.
The piece comes out of the first output, and the rest of the picture out
of a new second output, `rest`. A piece as tall as the picture, against
its left or right edge, leaves the strip beside it, so one node splits a
picture into two parts of different sizes. Width or height 0 takes the
picture's full width or height.
## 2.27.0 - 2026-11-23
- **Video Crop + Rotate + Pad → Clip 🆎 can put a clip window in an App-mode
form.** List the node's `clip_window` field and the form shows the video,
playing only the part that gets used, over a strip of pictures with a box
over that part: drag the box to pick where the clip starts, drag an edge to
shorten it. Two new inputs, `min_seconds` and `max_seconds`, keep the clip's
length in a range; the edges stop there, on the node's timeline too, and a
run keeps to them. A video shorter than the minimum is used whole. Both are
0 (no limit) by default and are set in a new **Clip length limits** fold
under Crop, pad & resize, closed unless you open it.
- **New node: Pause for Shot 🆎.** It stops a run right after the 3D
viewer so you can frame your shot on the model that run just made, then
**Continue** carries on with the camera exactly as the viewer shows it.
Nothing before the pause runs again. Wire in a 360 picture and it shows
behind the model while you frame, and the node hands on the part of it
the camera sees, with an optional floor shadow under the model.
- **ComfyUI's 3D viewers get Blender keys, shape chips and a 360 strip.**
With the mouse over a viewer, G, R and S move, turn and size the model,
as in Blender. Preview 3D (Advanced) and Save 3D (Advanced) get the shape
chips from Latent Size above their width and height. Press N for a strip
that turns the 360 background and changes the model's light and colours.
The axis gizmo moves to the top-right corner, with zoom, pan and grid
tools under it.
- **The 3D viewer's floor grid is under the model's feet.** It used to run
through the middle of many models, such as a person built by TRELLIS 2.
Now it sits at the model's lowest point, where the floor shadow goes.
The pictures a run takes from the viewer stay exactly as before.
- **The step preview of a video now moves.** With **Preview steps** on in
Save Video, or a Step Preview node in the workflow, a video model such as
MiniMax H3 shows a few frames of the clip after each step, about one per
second, playing in a loop. You see the motion and the shots take shape,
not only the first frame, and can stop a clip that is going wrong. It
costs next to nothing: a 5 second H3 clip took 53.8 s with it, 53.6 s
with no step pictures at all.
- **The picture and video picker shows every file, in folders.** The list
used to stop at 400 files and ask you to type to narrow it. Now you can
scroll through all of them, open folders, and go back up with `..`.
Typing still searches every folder. The picker opens in the folder of the
file you picked, with that file highlighted. Thanks to TWIISTED-STUDIOS.
- **Switch names show in full again.** Workflow Switches cut its names down to
a letter or two ("Per…" for "Blur the person"), and other node cards lost
their row layout, once a Callout had been on the canvas. The Callout now
keeps its styles to its own cards.
## 2.26.7 - 2026-11-21
- **An old copy of the pack that keeps loading now says so in the browser.**
With an old git clone in `custom_nodes/ComfyUI-AusBoss` and a newer
Manager install in `custom_nodes/ausboss-nodes`, the old clone loads,
because copies from before 2.24.0 cannot step aside. Every node added
since, such as Edit Lock, then shows as missing, and updating does not
help. The newer copy now shows a message in ComfyUI that names the old
folder to delete. Before, the only sign was a line in the console.
- **Workflow Note: a missing AusBoss node asks for an update, not a GitHub
clone.** When a workflow needs an AusBoss node your version doesn't have,
the note's AusBoss row now shows **Update**. It opens ComfyUI-Manager's
updates list and says to restart afterwards. Before, the row showed
**Get it**, which opened GitHub, and cloning from there added a second
copy of the pack. **Detect from this workflow** now lists the pack as
AusBoss nodes with its Comfy Registry link, whatever folder it is in.
- **LoRA Loader: set a LoRA's strength with a wire.** Drag a number wire,
from a slider or a Float node, onto any row and that row's strength follows
it. The row's box turns dashed teal and shows the number coming in; click
it to find the source, or right-click the row to unlink. The CLIP strength
keeps its ratio to the model strength (#388).
- **Node faces show Chinese when ComfyUI's language is Chinese.** The
labels, buttons, choices and tooltips the pack draws on its nodes, such as
the cards on FlashVSR and Image Resize, H3 Prompt Writer, Workflow Switches
and the video and image crop faces, now follow Settings > Language
(Chinese, in Simplified characters). Reload the page after changing the language. Nothing
saved in a workflow changes, and text with no Chinese yet stays English.
H3 Prompt Writer's socket names are translated too.
- **H3 Prompt Writer: see and change the full prompt.** A new **Full
prompt** tab at the top of the node shows the prompt it wrote on its last
run. Edit it there, for example to take out one camera move, and H3 gets
your text as it is. An amber dot shows an edit is being sent, and **Reset
to written** goes back to the node's own prompt. The **Simple** tab works
as before and stays the default.
- **Latent Size's ratio chips keep your megapixels.** Clicking a ratio chip
now changes the shape at the size you set, instead of jumping back to about
one megapixel. The old jump is still in the gear: turn off **Chips keep
current budget**. The setting is kept in the browser, so a private window
forgot it every time; it now starts on.
- **The pack loads on Python 3.10 again.** On a 3.10 install, such as some
Stability Matrix setups, the whole pack failed to load with
`No module named 'tomllib'`. It now loads there with nothing extra to
install (#387).
- **Workflow Note finds models in Stability Matrix's shared folders.**
A row whose folder uses an old name, `clip` or `unet`, was never checked
("This install has no model folder") even with the file in place. Those
rows are now checked like `text_encoders` and `diffusion_models`, the
names ComfyUI files them under. When the install also reads a kind of
model from a folder with a different name, such as Stability Matrix's
`Data/Models/Lora`, the card names that folder under the usual one, so
you know where your files are found and where a new one can go (#386).
## 2.26.6 - 2026-11-20
- **Image Toolbox's help page says what happens with too many pieces.**
Asking for more pieces than the picture is wide in pixels gives one piece
per pixel column, so fewer pieces than asked for. The page now says so.
## 2.26.5 - 2026-11-20
- **New node: Image Toolbox.** Small picture jobs in one node: pick the job
from a list. Its first job, split sheet at gaps, cuts a row of pictures
such as a character sheet's four views into separate pictures. Each cut
goes to the gap between two pictures instead of an equal share of the
width, so no piece gets part of its neighbour's sleeve. The pieces come out
as one batch of the same size, padded with the sheet's backdrop colour.
- **Box edits on big photos start much sooner.** Crop For Inpaint,
Image Crop + Rotate + Pad and Stitch Inpaint grew and softened their
masks across the whole picture, even when the box was small or there was
nothing to do. On a 17 MP photo that took about 5 seconds before the
model started. The work now covers only the area around the mask:
Crop For Inpaint went from 3.1 s to 0.14 s, and Image Crop + Rotate + Pad
with nothing to do from 2.2 s to 0.5 s. The results are the same pixels.
- **Stitch Inpaint can paste past the box.** Edit models that redraw the
whole crop, such as MiniMax H3 Image, often draw a new boot, a plate rim
or a collar a little past the box, and the paste cut it off at the box's
edge. Turn on the new **Follow changes** switch: the paste then grows to
every change that touches the box, and fades out before the edge of the
crop. It first undoes the small zoom or shift such a model can draw, so
the wall or table around the edit lines up again. When the model redrew
nearly everything around the box, the paste stays the box. It is off by
default, so saved workflows paste exactly as before.
- **LoRA Loader's + LoRA list opens with its folders folded.** A big LoRA
folder now opens as a short list of top folders. **Open all** and
**Fold all** beside the search box open or fold every folder at once,
and **Alt**- or **Shift**-click on a folder's arrow does the same for
that folder and every folder inside it. **Left** on a highlighted file
folds the folder it is in and moves up to it. To keep the old way, where
the list opens as you left it, set **Settings → 🆎 AusBoss → LoRA Loader
→ Picker folders** to **Remember my folds**.
## 2.26.4 - 2026-11-18
- **A video upload stops at 4 GB.** Dropping a video on Load Video had no
size limit, so a huge file could fill the input folder. An upload over
4 GB is now refused with a message, and the partly saved file is removed.
- **Image Crop + Rotate + Pad shows your picture in every browser.** Some
browsers and privacy add-ons (Firefox's fingerprint protection, Brave
Shields, canvas blockers) blank a picture when a page reads its pixels.
The node read that as a fully see-through picture and drew an empty stage,
although the size line and the run were right. It now checks first and,
where reads are blocked, draws the picture as it is; only the teal tint
over see-through parts is missing there.
- **Image Compare A/B always rests on the same picture.** While the
pointer is away, a new node shows B, the "after" picture. To show A
instead, right-click the node; the choice is saved with the workflow.
Earlier versions worked the side out from the links on every run, and a
workflow whose "before" came out of a switch showed the before. A
workflow saved by an earlier version keeps showing the picture it did.
- **Layout Boxes 🆎 places people for MiniMax H3 Image.** A new
`h3_prompt` output says the boxes in words: who goes where, how big, and
who stands beside whom. Describe each person in their box by their
picture and what they do, such as "the man from <Picture 2>, sitting on
the couch"; the scene on `background` is `<Picture 1>`. Places are said in
words only, because H3 Image draws numbers from a prompt onto the picture.
- **H3 Prompt Writer's Camera says "from the video" when the video sets
the camera.** With a clip wired to copy its moves, swap the person, give it
a new voice or change something, the first Camera choice now reads "from
the video": the camera does what it does in the clip. It is the same
choice as "as typed", so saved workflows are unchanged.
- **A picture whose name starts with a space now shows its preview.** The
name was trimmed before the preview was asked for, so Image Crop + Rotate
+ Pad and the other nodes that share that code looked for a file that
did not exist.
## 2.26.3 - 2026-11-17
- **Tone match now works on inpaints.** On a Crop For Inpaint 🆎 crop,
Stitch Inpaint 🆎 read the colour shift in the soft edge around the
painted area. Workflows such as Krea 2 Inpaint Masked let the model paint
a little wider than that edge, so the edge came back close to your picture
and the slider hardly did anything: in a test on skin it took off a
third of the shift at 1. It is now read just inside the painted area and
takes off more than half, on a picture of any size. A workflow that already had Tone match on for
an inpaint gives a slightly different picture, closer to the original's
colour. When the painted area holds something new, it is matched to your
picture right beside it where the two look alike, such as new skin where
a shirt was. Something different from what is beside it, such as a
swimsuit over skin, is left as painted; before, Tone match could tint the
whole patch with the opposite colour. Outpaints, blend in and Tone match 0
are unchanged.
- **Copy a crop node's picture without its handles.** Right-click the picture
on Image Crop + Rotate + Pad and choose Copy image. By default it copies
the original picture. To include crop, rotation, padding and resize, turn
on Copy with crop, rotation and padding in the gear menu. Editing controls
and guides are never copied. Open image provides a clean
picture to copy with the browser on plain HTTP addresses too.
- **H3 Prompt Writer: a swap reads the new person's looks however you type
them.** `@1 looks like ...` on the same line as the swap sentence, and
clothes on a line of their own (`@1 is wearing a black suit.`), were
left out of the prompt without a word, and the clip often came back
unchanged. Both are now used.
- **H3 Prompt Writer no longer drops lines.** When one line held two
people talking, like `The phone says: "Get a job." @1 looks up and says:
"What?"`, only the first words reached the prompt. Each quote is its own
moment now. A swap's `@1 looks like` line also keeps only the looks: a
sentence after it that names an `@` again, like `The trees behind @1 stay
the same.`, is read as its own line instead of going into the description
with a raw `@1`. `"Hi," she says` is spoken as "Hi." instead of "Hi,.",
and a Chinese or Japanese line keeps its own full stop: "。", not "。.".
- **H3 Prompt Writer can carry a line across a cut.** End the words with
`...` and the person keeps talking into the next shot, without saying the
words twice. On the last line, `...` lets the clip end mid-sentence. A line
too long for its shot carries on the same way instead of a warning.
- **H3 Prompt Writer makes 4-second clips.** The shortest length went from
5 to 4 seconds.
- **H3 Prompt Writer can put the person from your video somewhere new.** With
Copy its moves and no person picture, the person in the video keeps their
own look and moves. Give a picture the job place and type `He dances in @1.`
Before, the node asked for a person picture and stopped. Copy its moves
also takes its length from the video now, like Swap, Change something and
New voice.
- **H3 Prompt Writer can restyle a video from a picture.** With Change
something and a style or place picture, the look comes from the picture
instead of the video. Type `It looks like @1.` A clip with nobody in it,
like an empty hallway, no longer gets a made-up person in its prompt.
- **H3 Prompt Writer can make a thing do the moves.** With Copy its moves or
Swap the person and no person picture, a thing picture your lines make do
the action (a cartoon hand, a toy) takes the moves in its own look. A thing
that is held or worn stays a prop.
- **H3 Prompt Writer's job lists take a click again.** Picking a job from a
chip's list closed the list without changing the job.
- **H3 Prompt Writer's job lists match the node.** The pick list on each
picture and on the video opens under its chip in the node's own colours
and grows with the zoom. Before, it was the browser's small plain list.
- **An AI agent can now learn the video workflows from the repository.**
`npx skills add ausboss/ComfyUI-AusBoss` gives your agent a skill for the
MiniMax H3 Pika Person Swap and Pika Remix workflows: how to write the
words, which model files to get, and how to run a workflow in your
ComfyUI. The same page is at https://ausboss-examples.vercel.app/skill.md.
- **The "AusBoss was updated" message no longer asks for a reload by
mistake.** After the Manager switched the pack to another version, a
page reload before ComfyUI restarted brought up the message, telling you
the page was older than the pack when it was newer. A restart was what
was needed. Now the message only comes up when the pack really is newer
than the page, and versions such as 2.25.10 and 2.25.9 are compared as
numbers.
- **LoRA routes only open files on ComfyUI's LoRA list.** The LoRA
Loader's info, hash and preview routes used to hand the name they were
given to ComfyUI's file lookup and check the answer afterwards. Now the
name is matched against the list first, and a name that is not on it is
refused before anything on disk is looked up.
- **Image Folder 🆎 checks a folder or picture name as text before the
disk.** A drive letter in the middle of a name, or a control character,
is refused like `..`, and the joined path is checked before it is
resolved as well as after. The list no longer sends each picture's size
and time; the thumbnail's cache tag is a short hash instead.
- **Error messages no longer pass on server paths.** When a model,
decoder or encoder fails, its message can name a file on the server's
disk. SAM 3 masks, LoRA loading and video saving now keep the kind of
error and drop its words when they name a path, since node errors reach
the browser and stay in the history.
## 2.26.2 - 2026-11-14
- **Loaders never look up a file name they refused.** Before each run,
Load Image 🆎, Load Image + Pad 🆎, Image Crop + Rotate + Pad 🆎 and both
Video Crop + Rotate + Pad nodes check whether their file changed. When the
name was one they do not accept, such as a whole path or a network share,
that check still looked it up on disk. On Windows, looking up a share
contacts its server and hands it the computer's login. Now a refused name
is only compared as text.
- **The pack's scripts are found without looking up the address.** The pack
tags its scripts with a version as the browser asks for them. It found
each one by joining the address the browser sent to its own folder and
looking the result up on disk, and only then checked that the file was
its own. Now it looks the address up in a list of its scripts made when
ComfyUI starts, so no address reaches the disk.
- **Save Image's Save button copies only pictures it holds.** With Auto
save off, the list of a run's held pictures was a file in ComfyUI's temp
folder. That folder takes uploads, so a planted list could copy another
file on the server into the output folder. The list now stays in
ComfyUI's memory, and a held picture is found only by its run, its number
and one of Save Image's formats. The Save button works for the last 256
runs, up to 10,000 pictures each; held pictures still go when ComfyUI
restarts, as before.
## 2.26.1 - 2026-11-14
- **A path that starts with `~` is no longer expanded.** Image Folder used
to turn a pasted `~/...` path into a full one before checking that it sits
inside ComfyUI's folders; now only a path written out in full is checked.
LaMa Inpaint only opens a model from ComfyUI's `models/lama` list. Nothing
outside those folders could be read before either; this removes the code
that looked as if it could.
## 2.26.0 - 2026-11-14
- **Missing LoRAs show in ComfyUI's missing-models list.** When a workflow
needs a LoRA you don't have, ComfyUI's Issues panel now lists it with the
other missing models, so **Download all** fetches it too. Before, the
list skipped every LoRA in a LoRA Loader 🆎, and Run then stopped on
"missing LoRA file". A LoRA that moved to another folder, or a row that is
switched off, is not listed.
- **Link tiles and title tiles snap by the edge you see.** A tile draws a
card inside a wider see-through frame, and Snap into line used that frame,
so tiles lined up with a gap around them, and a tile you dragged never
snapped at all. Now a dragged tile lines up, and other nodes line up with
it, by the card's own edges.
- **Cards work in App mode.** App mode is ComfyUI's simple form view of a
workflow: a few labelled fields and a Run button. A field from a node
with a card (a picture or video loader, H3 Prompt Writer) used to show
as an empty row there. Now it shows a real control: a file list with an
upload button, a video list, a text box. Back in the graph, the node
looks the same as before.
- **The video crop nodes take uploads in App mode.** Video Crop + Rotate +
Pad and its Clip version now tell ComfyUI that their video list takes
uploads, as the picture nodes do. In App mode the clip field gets the same
picker as a picture field: your videos as thumbnails, an Upload button and
a folder button. On the node itself nothing changes.
- **Models you already have are picked for you.** When a workflow asks for
a model file you keep in a subfolder (`minimax-h3/model.safetensors`),
ComfyUI used to mark its loader red until you clicked **Use it** on the
workflow's Guide. Now the Guide switches the loader to your copy as the
workflow opens and says so in a short message. That matters most in App
mode, which shows no Guide to click. With two copies in different
subfolders it still asks. Turn it off in Settings, 🆎 AusBoss, Models.
- **The video clip's timing is three boxes: Start, Duration, Ends at.** On
Video Crop + Rotate + Pad (Clip), the Length on/off switch is gone. Drag
the start to move the clip, drag the end or type a Duration to change how
long it is, and switch between seconds and frames. Details sit in hover
text; a short note shows only when something needs fixing, with a button
to fix it. Saved workflows open with the same values and run the same.
- **A linked frame rate no longer stops the clip's start too early.** With
a rate wired in, a typed start of frame 60 used to settle on frame 7; it
now lands where you put it, and the start handle stops only where the
Duration no longer fits. A rate set inside a subgraph now counts as
known, so the clip shows its length before you run.
- **Linked clip lengths say where they come from.** A box set by another
node shows a **linked** button that jumps to that node. A cap that the
video cannot fill says how many frames you get, and a count only known
when the graph runs shows the room left after the start.
- **H3 Prompt Writer says how much of the clip H3 uses.** When the video
comes from the clip node, it shows how many of the clip's frames H3
makes and where in the video that stops, and which Durations use all of
it.
- **Crop + Rotate + Pad panels fill the node's width.** The rows under the
picture used to stop at 460 px and sit in the middle of a wide node.
- **Load Video uses the same timing boxes as the clip node.** Start,
Duration and Ends at replace the IN and OUT fields and the separate
Limit row, with the same seconds | frames switch. Saved workflows open
with the same values and run the same.
- **Load Video counts the frames the file really has.** The face used to
work the count out from the length and could say one frame too many (248
for a 247-frame clip); it now reads it from the file.
- **Load Audio has Start, Duration and Ends at boxes.** They replace the IN
and OUT times and the separate Max length row, so the red "cut" stripe is
gone: the Duration is the length you get.
- **A number wired through a Reroute or a subgraph now shows on the face.**
The clip node, Load Video, Load Audio and Layout Boxes read a linked
number the same way, so it no longer drops out behind a Reroute, a
subgraph or an older Primitive node.
## 2.25.3 - 2026-11-13
- **The video clip's frame readout explains itself.** On Video Crop + Rotate
+ Pad (Clip), the small `fr 52 · 0:02.17` beside Play now says in plain
words, when you point at it, which frame the picture shows and how many
seconds into the video it is. The help page explains it too.
## 2.25.2 - 2026-11-13
- **The video clip's IN handle always drags.** On Video Crop + Rotate + Pad
(Clip), a Length as long as the clip or longer used to lock IN, and the
only way to trim the start was to turn Length off. Now IN drags anyway:
the Length then only caps the clip, and the clip's own end is OUT. A
Length shorter than the clip works as before.
## 2.25.1 - 2026-11-13
- **Edit Lock Restore 🆎 takes out the pink tint.** MiniMax H3 Image gives
every edit a faint pink, slightly lighter tint over the whole picture.
Edit Lock already removed it wherever it locked, but when it stepped
aside (a new hair color, a new background, rain) the tint stayed. A new
**Remove tint** switch, on by default, reads the tint from the part of
the picture the edit left alone and takes it out of the whole picture.
Edits meant to recolor everything, such as golden hour or red light, are
left as they are. Turn it off to get the old behavior.
## 2.25.0 - 2026-11-12
- **New node: Load Image.** Loads a picture and sets its size in the same
node, so a workflow needs no resize node after its loader. Size can be a
megapixel count, a longest side, a scale, a box the picture fits inside, or
a box it fills by cropping, rounded to a multiple you choose. It can also
cut a piece or a shape such as 16:9 out of the picture without resizing,
and you pick which part is kept: the center, a side or a corner. Arrows
step through the pictures in the input folder. Two small pictures on the
node show what goes in and what comes out, with both sizes and what is
cut off, before you run. It also gives the file's name and its original
size. With Size off the picture comes out exactly as the file has it.
- **Clear VRAM from the right-click menu.** Right-click the empty canvas
and pick **Clear VRAM 🆎** to unload every model and free memory on the
ComfyUI server, the same as ComfyUI's own "Unload Models and Execution
Cache". A short message says when it is done. Turn the entry off in
Settings, 🆎 AusBoss, Memory.
- **Callout 🆎: Info card.** Right-click a Callout and pick **Info card**
for a small card with a title, a list of labels and values, and small
print, such as a table of run times. Write a row as `label | value`; a
row in **bold** is drawn in teal so the one to pick stands out. The first
line is the title, and a ⏱️ ℹ️ ⚠️ 💡 or ✅ at its start becomes a small
icon. An older pack shows the card as a plain note with its rows written
out.
- **Save Image shows big pictures at once.** The node now shows a small
copy of each picture, a few hundred kilobytes, where it used to load the
whole file. A 30 MB sheet on a ComfyUI opened from another computer took
half a minute to show, or never did; it now shows as the run ends. The
saved file is the same full-size file as before.
- **Save Image: the Save button is hard to miss.** With **Auto save** off,
a row over the picture now says **Not saved yet** and holds a solid
**Save picture** button. Before, it was a small SAVE label in the corner.
With several pictures the button reads **Save all 4**, or **Save this
one** when the arrows are on one picture. After a save the row says the
name the picture was saved under.
- **A picture that loads slowly no longer leaves the old one up.** When a
result took more than about 16 seconds to reach the browser, the node
kept the picture from the run before. Now the new picture always shows,
and the old one dims while the new one loads. This fixes Select Frame,
Mask Refine, Mask by Name and LaMa Inpaint as well as Save Image.
## 2.24.0 - 2026-11-12
- **New node: Edit Lock.** Keeps every part of your picture that an edit
+20 -5
View File
@@ -150,6 +150,13 @@ 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
@@ -193,7 +200,7 @@ 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 or a field being typed in,
keeps it only for a box that can still scroll, typed in or not,
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
@@ -210,8 +217,7 @@ 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 exceptions: the Seed card's seed (typed) and Load
Video's trim timecodes (typed).
line. Known, deliberate exception: the Seed card's seed (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
@@ -234,6 +240,13 @@ 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`
@@ -324,7 +337,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
node scripts/dev/face_smoke.mjs <chrome port> # and again with --vue, and --blocked-reads
```
- `test_comfy_core_contract.py` reads the pack's own source for everything
@@ -335,7 +348,9 @@ 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.
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.
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
+70 -7
View File
@@ -38,17 +38,27 @@ 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
git clone https://github.com/ausboss/ComfyUI-AusBoss.git ausboss-nodes
```
Restart ComfyUI and search the node library for **AusBoss**.
Install it one way, not both. Manager puts the pack in `custom_nodes/ausboss-nodes` and a clone in `custom_nodes/ComfyUI-AusBoss`. They are the same pack, so if both folders are there, delete one. The console says which copy it skipped.
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,6 +90,12 @@ 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.
@@ -120,10 +136,26 @@ 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.
@@ -174,13 +206,13 @@ 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. 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.
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.
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 IN and OUT handles to keep only the part you want, or type the times. Press play to hear just that part. Set **Max length** to the longest sound the next step can take, such as a video's length: anything past it turns red and is cut off, so you see what comes out before you run. Click the red length next to OUT to move OUT to the cut.
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).
@@ -190,7 +222,7 @@ Picks one frame from a video, then gives you the same rotate, crop and pad contr
### 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 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.
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.
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.
@@ -208,7 +240,7 @@ 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 unrelated shots. 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 shots together, even when both shots show the same place. 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.
@@ -300,12 +332,16 @@ 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.
@@ -321,6 +357,29 @@ 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.
@@ -341,6 +400,8 @@ 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
@@ -454,6 +515,7 @@ 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.
@@ -468,6 +530,7 @@ People who download your workflow get the nodes through ComfyUI-Manager's missin
- **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.
- **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.
@@ -480,7 +543,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 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.
- 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.
- 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.
+23 -5
View File
@@ -11,7 +11,6 @@ of taking the whole pack down, so one broken node never hides the rest.
import importlib
import os
import tomllib
import traceback
# One entry per file in nodes/, kept alphabetical. The order has no
@@ -22,7 +21,9 @@ 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",
@@ -31,12 +32,15 @@ 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",
@@ -44,6 +48,8 @@ NODE_MODULES = [
"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",
@@ -55,6 +61,7 @@ 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",
@@ -91,8 +98,10 @@ 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.
WEB_DIRECTORY = None if _other_copy else "./js"
# 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"
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY"]
@@ -100,9 +109,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")
with open(pyproject, "rb") as f:
version = tomllib.load(f).get("project", {}).get("version")
version = read_project(pyproject).get("version")
return version if isinstance(version, str) and version.strip() else "unknown"
except Exception:
return "unknown"
@@ -142,6 +152,14 @@ def _print_second_copy():
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
+3 -3
View File
@@ -1,9 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" width="105" height="20" role="img" aria-label="release: v2.24.0">
<title>release: v2.24.0</title>
<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.24.0</text>
<text x="76.5" y="14">v2.30.0</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 425 B

After

Width:  |  Height:  |  Size: 425 B

+2 -1
View File
@@ -42,7 +42,8 @@ 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] [--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 |
| `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 |
| `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.

After

Width:  |  Height:  |  Size: 206 KiB

@@ -0,0 +1,993 @@
{
"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
}
@@ -520,7 +520,42 @@
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,
354
398
],
"size": [
460,
@@ -1947,7 +1947,7 @@
"type": "KSampler",
"pos": [
1100,
304
338
],
"size": [
460,
@@ -2325,7 +2325,7 @@
0,
0,
500,
428
470
],
"color": "#1d5560",
"flags": {}
@@ -2349,7 +2349,7 @@
1080,
0,
500,
586
620
],
"color": "#1d5560",
"flags": {}
@@ -2361,7 +2361,7 @@
1620,
0,
500,
529
620
],
"color": "#1d5560",
"flags": {}
@@ -2446,7 +2446,8 @@
"origin_slot": 0,
"target_id": 11,
"target_slot": 0,
"type": "CONDITIONING"
"type": "CONDITIONING",
"parentId": 1
},
{
"id": 34,
@@ -2553,7 +2554,19 @@
"type": "IMAGE"
}
],
"extra": {}
"extra": {},
"reroutes": [
{
"id": 1,
"pos": [
1060,
540
],
"linkIds": [
33
]
}
]
}
]
},
@@ -2566,7 +2579,92 @@
20
]
},
"frontendVersion": "1.53.6"
"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
}
]
},
"version": 0.4
}
@@ -2769,7 +2769,7 @@
"type": "KSampler",
"pos": [
1100,
546
646
],
"size": [
460,
@@ -3088,8 +3088,8 @@
"id": 37,
"type": "Reroute",
"pos": [
1100,
450
1082,
510
],
"size": [
75,
@@ -3150,7 +3150,7 @@
"id": 47,
"type": "Reroute",
"pos": [
1200,
1118,
450
],
"size": [
@@ -3214,7 +3214,7 @@
1080,
0,
500,
828
928
],
"color": "#1d5560",
"flags": {}
@@ -3226,7 +3226,7 @@
1620,
0,
500,
529
600
],
"color": "#1d5560",
"flags": {}
@@ -3466,7 +3466,8 @@
"type": "FLOAT"
}
],
"extra": {}
"extra": {},
"reroutes": []
}
]
},
@@ -3479,7 +3480,117 @@
96
]
},
"frontendVersion": "1.53.6"
"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
}
]
},
"version": 0.4
}
@@ -2183,7 +2183,7 @@
1080,
0,
500,
529
600
],
"color": "#1d5560",
"flags": {}
@@ -2375,7 +2375,8 @@
"type": "MASK"
}
],
"extra": {}
"extra": {},
"reroutes": []
}
]
},
@@ -2388,7 +2389,78 @@
20
]
},
"frontendVersion": "1.53.6"
"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
}
]
},
"version": 0.4
}
@@ -612,7 +612,7 @@
"type": "2f8cb72f-ebab-4ed9-bb0c-328a4e6493d9",
"pos": [
1020,
238
380
],
"size": [
240,
@@ -2180,7 +2180,7 @@
1080,
0,
500,
529
600
],
"color": "#1d5560",
"flags": {}
@@ -2372,7 +2372,8 @@
"type": "MASK"
}
],
"extra": {}
"extra": {},
"reroutes": []
}
]
},
@@ -2385,7 +2386,131 @@
20
]
},
"frontendVersion": "1.53.6"
"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
}
]
},
"version": 0.4
}
@@ -2785,7 +2785,7 @@
1080,
0,
500,
719
780
],
"color": "#1d5560",
"flags": {}
@@ -2990,7 +2990,8 @@
"origin_slot": 0,
"target_id": 19,
"target_slot": 0,
"type": "CONDITIONING"
"type": "CONDITIONING",
"parentId": 1
},
{
"id": 147,
@@ -2998,7 +2999,8 @@
"origin_slot": 1,
"target_id": 19,
"target_slot": 1,
"type": "CONDITIONING"
"type": "CONDITIONING",
"parentId": 2
},
{
"id": 148,
@@ -3065,7 +3067,29 @@
"type": "FLOAT"
}
],
"extra": {}
"extra": {},
"reroutes": [
{
"id": 1,
"pos": [
1080,
900
],
"linkIds": [
146
]
},
{
"id": 2,
"pos": [
1090,
900
],
"linkIds": [
147
]
}
]
}
]
},
@@ -3078,7 +3102,53 @@
25
]
},
"frontendVersion": "1.53.6"
"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
}
]
},
"version": 0.4
}
+30 -1
View File
@@ -1280,7 +1280,36 @@
60
]
},
"frontendVersion": "1.53.6"
"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
}
]
},
"version": 0.4
}
+58 -1
View File
@@ -1135,7 +1135,64 @@
60
]
},
"frontendVersion": "1.53.6"
"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
}
]
},
"version": 0.4
}
@@ -1679,7 +1679,8 @@
"origin_slot": 0,
"target_id": 72,
"target_slot": 1,
"type": "IMAGE"
"type": "IMAGE",
"parentId": 1
},
{
"id": 5,
@@ -1706,7 +1707,19 @@
"type": "STRING"
}
],
"extra": {}
"extra": {},
"reroutes": [
{
"id": 1,
"pos": [
1048,
676
],
"linkIds": [
6
]
}
]
},
{
"id": "fe7eddff-ee33-40d2-98aa-e25b894fc34e",
@@ -2713,7 +2726,8 @@
"origin_slot": 4,
"target_id": 66,
"target_slot": 2,
"type": "AUSBOSS_STITCHER"
"type": "AUSBOSS_STITCHER",
"parentId": 4
},
{
"id": 28,
@@ -2729,7 +2743,8 @@
"origin_slot": 0,
"target_id": 68,
"target_slot": 1,
"type": "IMAGE"
"type": "IMAGE",
"parentId": 2
},
{
"id": 30,
@@ -2780,7 +2795,51 @@
"type": "STRING"
}
],
"extra": {}
"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
]
}
]
}
]
},
@@ -2793,7 +2852,53 @@
27
]
},
"frontendVersion": "1.53.6"
"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
}
]
},
"version": 0.4
}
@@ -1025,7 +1025,7 @@
"type": "AUSBOSS_NODES_LoraLoader",
"pos": [
2288,
1040.0
1290
],
"size": [
440,
@@ -2005,9 +2005,9 @@
"title": "3 · Models",
"bounding": [
1968,
960.0,
960,
780,
500.0
540
],
"color": "#1d5560",
"flags": {
@@ -2550,7 +2550,7 @@
"type": "Reroute",
"pos": [
560,
676.0
640
],
"size": [
75,
@@ -2587,8 +2587,8 @@
"id": 25,
"type": "Reroute",
"pos": [
560,
772.0
580,
784
],
"size": [
75,
@@ -3094,7 +3094,8 @@
"origin_slot": 0,
"target_id": 26,
"target_slot": 3,
"type": "LATENT"
"type": "LATENT",
"parentId": 1
},
{
"id": 20,
@@ -3241,7 +3242,19 @@
"type": "IMAGE"
}
],
"extra": {}
"extra": {},
"reroutes": [
{
"id": 1,
"pos": [
1060,
640
],
"linkIds": [
25
]
}
]
},
{
"id": "f03669a3-61c2-44c8-ad63-bad928a695fa",
@@ -3828,7 +3841,8 @@
"type": "MASK"
}
],
"extra": {}
"extra": {},
"reroutes": []
}
]
},
@@ -3841,7 +3855,106 @@
60
]
},
"frontendVersion": "1.53.6"
"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
}
]
},
"version": 0.4
}
@@ -921,8 +921,8 @@
"id": 11,
"type": "AUSBOSS_NODES_LoraLoader",
"pos": [
1808,
608
1468,
1072
],
"size": [
400,
@@ -2021,7 +2021,7 @@
"type": "Reroute",
"pos": [
560,
394
430
],
"size": [
75,
@@ -2059,7 +2059,7 @@
"type": "Reroute",
"pos": [
560,
460
360
],
"size": [
75,
@@ -2096,11 +2096,11 @@
"id": 20,
"type": "KSampler",
"pos": [
560,
640,
546
],
"size": [
460,
380,
262
],
"flags": {},
@@ -2607,7 +2607,8 @@
"type": "IMAGE"
}
],
"extra": {}
"extra": {},
"reroutes": []
}
]
},
@@ -2620,7 +2621,64 @@
60
]
},
"frontendVersion": "1.53.6"
"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
}
]
},
"version": 0.4
}
}
@@ -1816,7 +1816,8 @@
"type": "IMAGE"
}
],
"extra": {}
"extra": {},
"reroutes": []
},
{
"id": "a988ba93-208b-4af3-b721-61365d1292ac",
@@ -2612,7 +2613,8 @@
"type": "IMAGE"
}
],
"extra": {}
"extra": {},
"reroutes": []
}
]
},
@@ -2624,7 +2626,111 @@
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
@@ -0,0 +1,98 @@
// 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();
},
});
+20 -1
View File
@@ -49,6 +49,25 @@ 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;
@@ -58,7 +77,7 @@ async function check() {
try {
const installed = (await (await api.fetchApi("/ausboss/pack_version")).json())?.version;
const running = await runningVersion();
if (!installed || installed === "unknown" || !running || installed === running || installed === asked) return;
if (!serverIsNewer(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 : []);
+115 -23
View File
@@ -13,10 +13,12 @@ import { BRAND, chainCallback, keepDomWidgetWidthAuto } from "../shared/index.mj
import {
ARROW_ANGLE,
ARROW_CHOICES,
CARD_TEMPLATE,
DOUBLE_ARROWS,
arrowText,
fitFontSize,
parseBlocks,
parseCard,
pastedLink,
repointLinks,
targetId,
@@ -45,6 +47,10 @@ 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';
@@ -81,6 +87,20 @@ ${TILE_FACE_CSS}
.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;}
@@ -154,6 +174,25 @@ 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;
@@ -262,17 +301,79 @@ 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;
setTileFace(state.node, state.root, Boolean(state.card.dataset.tile), () => startEdit(state));
const blocks = parseBlocks(state.valueWidget.value);
// 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);
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) => {
@@ -280,21 +381,7 @@ 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"));
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", "↗"));
appendPieces(state, into, line);
if (line.small) point.append(into);
});
state.inner.append(point);
@@ -364,7 +451,7 @@ function fit(state) {
inner.style.fontSize = `${px}px`;
return inner.offsetHeight <= height && inner.scrollWidth <= width + 1;
};
const size = fitFontSize(fits);
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`;
}
@@ -453,7 +540,9 @@ function startEdit(state) {
const wrap = el("div", "ausboss-callout-editor");
const area = el("textarea", "ausboss-callout-edit");
area.value = state.valueWidget.value ?? "";
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.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.spellcheck = true;
const bar = el("div", "ausboss-callout-arrowbar");
bar.append(el("span", "", "Arrow"));
@@ -560,7 +649,6 @@ 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.
@@ -687,7 +775,7 @@ app.registerExtension({
const state = buildPanel(this);
if (!state) return;
renderText(state);
if (state.card.dataset.tile && Number.isFinite(saved?.size?.[1])) {
if ((state.card.dataset.tile || state.card.dataset.card !== undefined) && Number.isFinite(saved?.size?.[1])) {
this.setSize?.([this.size[0], saved.size[1]]);
}
});
@@ -699,14 +787,18 @@ 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"],["title","Title tile"],["youtube","Set YouTube link tile"],["discord","Set Discord link tile"]]) {
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 (style !== "plain") this.setSize?.([this.size[0], style === "title" ? 86 : 78]);
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();
}});
}
+12 -3
View File
@@ -5,7 +5,7 @@
// 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 focused text field, an editor) still keeps it.
// (a scrolling list, a long text box) keeps it while it can still scroll.
//
// 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
@@ -14,7 +14,7 @@
// under the pointer.
import { app } from "../../../scripts/app.js";
import {
dragCarriesFiles, graphDragStarts, panelHost, panelKeepsWheel, panelNeedsDropHelp, panelRoot,
dragCarriesFiles, graphDragStarts, panelHost, panelKeepsWheel, panelNeedsDropHelp, panelRoot, vueBoxKeepsWheel,
} from "../shared/canvas_passthrough.mjs";
import { showToast } from "../shared/index.mjs";
@@ -26,12 +26,20 @@ 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), activeElement: document.activeElement })) return;
if (panelKeepsWheel(target, event, { root, host: panelHost(target), styleOf: (el) => getComputedStyle(el) })) return;
event.preventDefault();
lgCanvas.processMouseWheel(event);
}
@@ -128,6 +136,7 @@ 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);
+53
View File
@@ -0,0 +1,53 @@
// 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 }];
},
});
+60 -9
View File
@@ -14,6 +14,10 @@ import {
compareBadges,
compareClip,
compareResultSide,
REST_PROPERTY,
savedRestSide,
SWITCH_CONTROL_INPUTS,
SWITCH_NODE_TYPES,
compareSizeLabel,
compareSwitchValue,
findComparePairs,
@@ -182,9 +186,15 @@ 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) => (graph?.getNodeById?.(id)?.inputs ?? []).map((input) => origin(input?.link)?.id),
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);
},
inside(id) {
const subgraph = graph?.getNodeById?.(id)?.subgraph;
if (!subgraph) return null;
@@ -195,18 +205,40 @@ function linkView(graph) {
}
// Which input holds the result, read from the graph the panel sits in.
function resultSide(node) {
function guessResultSide(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);
}
// Slide mode rests on the result while the pointer is away.
// 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.
function showResult(state) {
state.fraction = resultSide(state.node) === "B" ? 0 : 1;
state.fraction = restSide(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) {
@@ -433,10 +465,11 @@ app.registerExtension({
defaultValue: true,
category: ["🆎 AusBoss", "Image Compare", "Rest on the result"],
tooltip:
"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.",
"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.",
onChange(value) {
restOnResult = value !== false;
},
@@ -454,6 +487,9 @@ 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.
@@ -462,8 +498,12 @@ app.registerExtension({
Math.max(DEFAULT_NODE_SIZE[1], this.size?.[1] ?? 0),
]);
});
chainCallback(nodeType.prototype, "onConfigure", function () {
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;
queueMicrotask(() => {
if (!state || this.__ausbossCompare !== state || state.abort.signal.aborted) return;
state.showingB = this.properties?.ausboss_compare_side === "B";
@@ -482,8 +522,19 @@ 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 () {
+40 -1
View File
@@ -15,7 +15,38 @@ Right-click the Callout and choose **Title tile** to give your existing text a b
- 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.
## Writing
## 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
keep the text. **Esc** drops what you typed.
@@ -90,5 +121,13 @@ 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.
+16 -3
View File
@@ -2,8 +2,9 @@
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, and 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. 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
reduce color drift between frames.
## Controls
@@ -15,7 +16,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.
- **Method** (`method`): How the colors move. A line under it says what the picked one does.
- **lab** — per-channel mean/std shift in LAB. Perceptual and the safe
default: corrects overall casts and contrast without shifting
individual hues around.
@@ -24,6 +25,13 @@ 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
@@ -43,6 +51,11 @@ 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.
+15 -14
View File
@@ -20,10 +20,9 @@ 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 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.
- **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.
- **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.
@@ -132,11 +131,12 @@ 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 is the result
## Which picture shows when the pointer is away
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.
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.
## Outputs
@@ -152,12 +152,13 @@ network requests are made.
## Technical details
- While sliding, the outer 6% on either side snaps to a full image.
- 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).
- 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.
- 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.
+96
View File
@@ -0,0 +1,96 @@
# 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.
+29 -4
View File
@@ -1,6 +1,7 @@
# Edit Lock Restore
Puts your picture's own pixels back in every part the edit did not change.
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.
@@ -22,6 +23,14 @@ your picture pixel for pixel. Only the edit is new.
- **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
@@ -30,13 +39,15 @@ your picture pixel for pixel. Only the edit is new.
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".
was and left 18% to the edit". When the tint was taken out it adds a
sentence that says so.
## When nothing was locked
The picture passes through unchanged, the mask is all white, and the
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.
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
@@ -46,3 +57,17 @@ 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
@@ -0,0 +1,171 @@
# 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.
+44 -8
View File
@@ -24,12 +24,16 @@ frame are copied untouched, and only the true in-betweens are synthesized.
## Scene cuts
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.
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.
## Controls
@@ -40,8 +44,10 @@ disable detection and interpolate everything.
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`): Cut sensitivity from 0 to 1; `0.35`
suits most footage, `0` disables.
- **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`.
- **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.
@@ -55,3 +61,33 @@ disable detection and interpolate everything.
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.
+126 -20
View File
@@ -7,6 +7,28 @@ 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
@@ -23,10 +45,11 @@ 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.
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.
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 words box and the bar
@@ -84,31 +107,43 @@ from.
Connect a video, then pick what it is for:
- **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.
- **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.
- **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.
`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.
- **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** and turn on
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, **swap the person**, **change something** and **new voice**
use the incoming clip to set the frame count. **Length** says **From the clip**;
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.
@@ -132,11 +167,17 @@ 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: `@1 says "we are late."` Each person
keeps their own voice.
- **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.
- **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
@@ -150,6 +191,17 @@ 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.
@@ -158,14 +210,16 @@ they are.
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.
- **voice**: a clip of someone talking, about 10 seconds, plus words in quotes
in your script. It goes to whoever speaks first. It works with your own voice,
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,
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.
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).
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
@@ -195,19 +249,47 @@ 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, 5 to 15.
- **Camera** (`camera`): how the camera moves the whole way through.
- **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.
- **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. An empty slot shows as a faint `+ @3`.
for, on the picture chips under the bar. A chip shows once its picture is plugged in.
- **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
@@ -229,7 +311,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. |
| `clip` | input, optional | CLIP | A small text model that fills in a one-line idea, and tidies your lines when Tidy up is on. |
| `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. |
@@ -264,5 +346,29 @@ 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.
@@ -24,6 +24,15 @@ 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:
+76
View File
@@ -0,0 +1,76 @@
# 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
@@ -0,0 +1,99 @@
# 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,6 +39,11 @@ 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
@@ -69,3 +74,23 @@ 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.
+84 -1
View File
@@ -26,6 +26,60 @@ 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
@@ -149,11 +203,13 @@ 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` after them), so the wires move straight over. For the same boxes it
`mask`, `h3_prompt` and `placement` 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.
@@ -209,5 +265,32 @@ 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.
+40 -21
View File
@@ -5,37 +5,49 @@ 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. Drag the white **IN** and **OUT**
handles to set where it starts and stops, drag the bright part to slide it,
or click somewhere else on the wave to move it there. You can also type a time
under the wave, in seconds (`12.5`) or minutes and seconds (`1:02.5`).
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.
## Max length
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.
Set **Max length** to the longest sound the next step can take, such as the
length of the video you are making. The start stays where it is, and anything
past the limit turns red with a dashed line where it is cut. Next to OUT,
the node shows how long the sound that comes out is, such as `15.0 s`. It
turns red when part of your pick is cut; hold the mouse over it to see how
much, and click it to move OUT to the cut. Play stops at the cut, so what you
hear is what comes out. `0` means no limit.
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.
Max length can be wired. When the wire comes from a number node such as
Float 🆎, the wave shows the cut for that number; otherwise the length's tooltip says
`max wired` and the run still cuts the sound to the wired length.
## 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.
- **Max length** (`max_seconds`): the longest the sound may be, in seconds.
`0` means no limit.
- **IN** (`start_seconds`): where the sound starts.
- **OUT** (`end_seconds`): where the sound stops. `0` means the end of the
file.
- **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
@@ -49,4 +61,11 @@ Float 🆎, the wave shows the cut for that number; otherwise the length's toolt
- 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 four values above.
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
@@ -0,0 +1,108 @@
# 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.
+39 -43
View File
@@ -1,37 +1,33 @@
# Load Video
Loads a video from ComfyUI's input folder as an `IMAGE` frame batch plus its
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.
audio. The player shows the video; the timing card under it picks the part
that comes out.
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 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.
**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.
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.
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.
**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.
## Drop a video onto the node
@@ -48,21 +44,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.
- **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.
- **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.
- **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.
+93 -3
View File
@@ -134,6 +134,64 @@ 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
@@ -176,8 +234,15 @@ 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. Use the arrow beside a folder to collapse or expand it without
adding anything. Folded folders are remembered in this browser. Search
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
reveals matching files; clearing it brings back your folded view. You can
also fold folders while searching.
@@ -266,6 +331,14 @@ 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
@@ -308,6 +381,16 @@ 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,
@@ -328,10 +411,17 @@ 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. When a lookup fails,
menu → **Civitai lookup button** removes the button, and **Fetch all LoRAs**
with it. 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
+38
View File
@@ -195,6 +195,35 @@ 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
@@ -425,6 +454,15 @@ 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
@@ -0,0 +1,78 @@
# 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
@@ -0,0 +1,54 @@
# 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.
+16 -6
View File
@@ -6,6 +6,9 @@ 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
@@ -58,12 +61,19 @@ 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 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.
- `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`.
- **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`.
+3 -2
View File
@@ -2,10 +2,11 @@
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 uses its generated size near one megapixel. Enable **Chips keep current budget** in the gear to retain the current area.
- **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.
- **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 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.
- **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.
- **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
+55 -5
View File
@@ -41,10 +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 workflow** (`save_metadata`): **On** stores the prompt and
- **Embed** (`save_metadata`, `civitai_info`): **On** 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.
`--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
@@ -53,15 +61,19 @@ file's name. A caption on the `caption_text` input writes the paired `.txt`.
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 **SAVE**
button then sits over the picture: **SAVE ALL** keeps every picture of
the run, and with the arrows on one picture, **SAVE** keeps that one.
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.
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
**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
@@ -111,6 +123,44 @@ 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
+8 -6
View File
@@ -9,9 +9,10 @@ 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's first frame in
the player while it is being made, one step at a time, with a **STOP**
button on the player. Stop a clip that is going wrong after the first steps
**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
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.
@@ -77,13 +78,14 @@ 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. Neither carries
metadata, so an embedded workflow is not available for them.
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.
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` and `webp`,
*ignored* above), and the **Embed workflow** row disappears for `gif`,
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
+18 -1
View File
@@ -9,6 +9,10 @@ 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
@@ -65,4 +69,17 @@ 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 video models the step picture is the clip's first frame.
- 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.
+56 -3
View File
@@ -7,6 +7,43 @@ 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
@@ -155,9 +192,25 @@ 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 stitcher, which
has no source rectangle, gets a single global shift measured in its
blend band instead.
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.
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
@@ -0,0 +1,61 @@
# 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.
+75 -37
View File
@@ -9,33 +9,76 @@ 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
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, Length - and
settings - Fill, Feather, **Align**, Resize, Every nth, Frames for, Duration - and
fits the new clip to the lit ratio button, the way **Fit** is set. Rotation, crop,
padding, IN/OUT and the playhead start over.
padding, the clip's timing and the playhead start over.
- **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 scrubber previews the selected frames and stops at OUT. Press Play at OUT to start from IN again.
- **Timeline** (right under the preview and size line): 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
- **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
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
@@ -55,22 +98,16 @@ model that paints black regions.
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.
- **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.
- **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.
- **Every nth** (`every_nth`): Thin the batch. The `fps` output divides to match
every_nth, so the clip keeps real-time downstream; a Length counts the frames kept.
every_nth, so the clip keeps real-time downstream; a Duration 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.
OUT drags and the Length step through those counts.
Dragging the end and typing a Duration 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.
@@ -102,7 +139,7 @@ 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.
**Reset transform** in the editor resets rotation, crop, padding, fill, feather and
**Align**; it keeps the source, current frame, trim, Length, resize and stitch
**Align**; it keeps the source, current frame, trim, Duration, resize and stitch
settings. **Align** 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.
@@ -155,16 +192,17 @@ The node performs no remote network requests and does not rewrite the source vid
## Connected timing inputs
Five optional sockets sit on the left, above the editor:
Optional timing inputs:
| 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: 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. When the count is known, dragging IN 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: 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. |
| `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
@@ -177,17 +215,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 IN/OUT field on both
A connected start or end locks that handle and its box 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 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
`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
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 Length; the first change
Fixed frames number without a connection reads as a Duration; the first change
here turns it into one.
+12 -4
View File
@@ -60,12 +60,20 @@ 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 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.
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.
- **↻ 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.
+7
View File
@@ -17,6 +17,7 @@ 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`) |
@@ -27,11 +28,15 @@ help panel.
| 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`) |
@@ -45,6 +50,8 @@ help panel.
| 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) |
+68
View File
@@ -0,0 +1,68 @@
// 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
@@ -0,0 +1,177 @@
// 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
@@ -0,0 +1,14 @@
// 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);
},
});
+147 -26
View File
@@ -1,5 +1,5 @@
// The in-node preview panel for LaMa Inpaint, Mask Refine, Mask by Name,
// Select Frame and Save Image.
// Select Frame, Save Image, Film Grain, Cut Out and Keep Detail.
//
// 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,7 +14,7 @@
// switch lays each sampling step over the stage, with a Stop button on the
// bar (shared/step_preview.mjs).
import { panelSwitch } from "../shared/panel_controls.mjs";
import { panelSwitch, primaryAction } from "../shared/panel_controls.mjs";
import { api } from "../../../scripts/api.js";
import { app } from "../../../scripts/app.js";
import { isForeignRun } from "../shared/prompt_scope.mjs";
@@ -24,16 +24,20 @@ import { chainCallback, keepDomWidgetWidthAuto, notifyAusbossChange } from "../s
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, stepIndex, stepWithAll } from "../shared/picture_steps.mjs";
import { ALL, allLabel, gridShape, heldPlaces, keepIndex, keepWords, stepIndex, stepWithAll } from "../shared/picture_steps.mjs";
import { mountLive, takeStage } from "../shared/live_stage.mjs";
import { addStepConsumer, mountStepOverlay, showsStepsOn, stepRun, stopStepRun, watchSteps } from "../shared/step_preview.mjs";
import {
describeNodePreview,
describeSourcePreview,
lightPreviewQuery,
outputLocatorId,
outputRecordCount,
outputRecordQuery,
ownResultIsCurrent,
placeholderText,
staleText,
sourceFileWidget,
@@ -54,6 +58,9 @@ 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
@@ -118,6 +125,11 @@ 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.
@@ -126,9 +138,9 @@ const NODE_CONFIG = {
noun: "an image",
switchTitle: "Show the saved image here. The file is saved either way.",
steps: true,
tools: [
{ label: "SAVE", title: "Save what is showing: every picture, or the one the arrows picked.", action: keepHeld, held: 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.",
},
};
@@ -152,16 +164,22 @@ function ensureCss() {
.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-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-tool.keep{color:${T.brandInk};background:${T.brandSoft};}
.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};}
@@ -472,7 +490,7 @@ function syncPreviewMode(state, resize) {
if (resize) {
const node = state.node;
node.properties ??= {};
const floor = node.computeSize?.()[1] ?? (enabled ? PANEL_HEIGHT : OFF_HEIGHT);
const floor = node.computeSize?.()[1] ?? panelFloor(state);
if (!enabled) {
// Off: remember the height, then shrink to what is left.
const height = Number(node.size?.[1]);
@@ -509,7 +527,6 @@ function buildTools(state, tools, signal) {
tool.action(state);
}, { signal });
state.toolButtons[tool.label] = button;
if (tool.held) { button.hidden = true; state.keepButton = button; }
bar.append(button);
}
return bar;
@@ -538,6 +555,7 @@ function showMedia(state, kind) {
function clearMedia(state) {
state.img.removeAttribute("src");
state.stage.classList.remove("loading-image");
state.video.pause?.();
state.video.removeAttribute("src");
clearGrid(state);
@@ -578,6 +596,7 @@ function showGrid(state, 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;
}));
@@ -630,12 +649,30 @@ 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 = app.nodeOutputs?.[outputLocatorId(node)];
const query = outputRecordQuery(record, index);
const record = outputRecord(node);
const light = lightQuery(record, index);
const query = light ?? outputRecordQuery(record, index);
if (!query) return null;
if (!storedRand.has(record)) storedRand.set(record, app.getRandParam?.() ?? "");
return api.apiURL(`/view?${query}${app.getPreviewFormatParam?.() ?? ""}${storedRand.get(record)}`);
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;
}
// Several pictures from one run (a list, or a batch Save Image saved one by
@@ -679,23 +716,66 @@ function keepsAll(state, count) {
return count < 2 || showsAll(state, count) || !previewEnabled(state);
}
// The button says what a click will do: SAVE ALL over the grid, SAVE over
// one picture, SAVED once there is nothing left to keep there.
// 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 button = state.keepButton;
if (!button) return;
const row = state.keepRow;
if (!row) return;
const held = heldPictures(state);
button.hidden = !held.length || count < 1;
if (button.hidden) return;
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);
button.textContent = state.keeping ? "SAVING" : done ? "SAVED" : all && count > 1 ? "SAVE ALL" : "SAVE";
button.classList.toggle("keep", !done);
button.disabled = Boolean(state.keeping);
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;
@@ -729,6 +809,12 @@ async function keepHeld(state) {
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
@@ -770,6 +856,9 @@ function refresh(state) {
}
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);
@@ -798,7 +887,9 @@ function refresh(state) {
? describeSourcePreview(source)
: count > 1
? { kind: "url", url: storedResultUrl(state.node, state.index) }
: describeNodePreview(state.node, state.inputName, storedResultUrl(state.node));
: 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));
if (!described) {
clearMedia(state);
showPlaceholder(state, !!source);
@@ -820,6 +911,9 @@ 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");
}
@@ -842,8 +936,19 @@ 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,
@@ -851,6 +956,7 @@ function watchOwnResult(node, state) {
get: () => images,
set: (value) => {
images = value;
state.imgsFor = outputRecord(node);
if (state.alive) scheduleRefresh(state);
},
});
@@ -869,6 +975,8 @@ 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;
@@ -891,7 +999,7 @@ function buildPanel(node, config) {
const widget = node.addDOMWidget(WIDGET_NAME, "ausboss_input_preview", root, {
serialize: false,
hideOnZoom: false,
getMinHeight: () => (enabled() ? PANEL_HEIGHT : OFF_HEIGHT),
getMinHeight: () => panelFloor(node.__ausbossInputPreview, enabled()),
});
keepDomWidgetWidthAuto(widget);
// Not saved with the workflow either: options.serialize only keeps it out
@@ -903,7 +1011,7 @@ function buildPanel(node, config) {
// dragged taller. With the preview off the floor is the bar alone.
fillNodeHeight(widget, {
minWidth: () => previewMinWidth(node.__ausbossInputPreview),
minHeight: () => (enabled() ? PANEL_HEIGHT : OFF_HEIGHT),
minHeight: () => panelFloor(node.__ausbossInputPreview, enabled()),
minNodeSize: [PANEL_MIN_WIDTH, 90],
exactMinWidth: true,
});
@@ -934,6 +1042,7 @@ 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";
@@ -951,6 +1060,16 @@ 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") {
@@ -958,9 +1077,10 @@ function buildPanel(node, config) {
watcher.observe(stage);
abort.signal.addEventListener("abort", () => watcher.disconnect(), { once: true });
}
img.addEventListener("load", () => showMedia(state, "image"));
img.addEventListener("load", () => { stage.classList.remove("loading-image"); showMedia(state, "image"); });
img.addEventListener("error", () => {
if (img.getAttribute("src")) showPlaceholder(state, true);
stage.classList.remove("loading-image");
if (img.getAttribute("src") && !dropLightPreview(state)) showPlaceholder(state, true);
});
video.addEventListener("loadeddata", () => showMedia(state, "video"));
video.addEventListener("error", () => {
@@ -1065,6 +1185,7 @@ 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();
+329
View File
@@ -0,0 +1,329 @@
// 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();
},
});
+28 -13
View File
@@ -20,21 +20,36 @@ export function outputWindow(durationValue, startValue, endValue, maxValue = 0)
return { start, end, keepEnd, length: keepEnd - start, cut: Math.max(0, end - keepEnd) };
}
// "0:12.0" style, the way the IN and OUT fields write a time.
export function secondsLabel(value) {
const seconds = Math.max(0, finite(value));
if (seconds < 60) return `${seconds.toFixed(1)} s`;
const minutes = Math.floor(seconds / 60);
return `${minutes}:${(seconds - minutes * 60).toFixed(1).padStart(4, "0")}`;
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)) };
}
// The line between IN and OUT: what comes out, and what the max cuts off.
export function outputSummary(window, { maxFromLink = false } = {}) {
if (!window || window.length <= 0) return "";
const parts = [secondsLabel(window.length)];
if (window.cut > 0.005) parts.push(`cut ${secondsLabel(window.cut)}`);
if (maxFromLink) parts.push("max wired");
return parts.join(" · ");
// 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
+118 -110
View File
@@ -1,30 +1,35 @@
// Load Audio 🆎 - the wave, the trim and the player.
// Load Audio 🆎 - the wave, the timing and the player.
//
// The card above (js/widget_cards) holds Source and Max length. This panel
// draws the whole file as a wave: the part that comes out is bright, the
// part a Max length cuts off is red, and the rest is dim. Drag a handle to
// move IN or OUT, drag the middle to slide the pick, or click elsewhere to
// move it there. Play plays only what comes out. The widgets underneath
// (start_seconds, end_seconds, max_seconds) stay the source of truth.
// 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 { keepKeyInField } from "../shared/canvas_passthrough.mjs";
import { WIDGET_FRAME, fillNodeHeight } from "../shared/panel_layout.mjs";
import { formatTimecode, parseTimecode } from "../shared/timecode.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, outputSummary, outputWindow, secondsLabel, wavePeaks } from "./audio_window.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 22px play, IN/OUT and loop row.
const PANEL_MIN_HEIGHT = 64;
// 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;
@@ -50,26 +55,32 @@ function hideCoreAudio(node) {
}
}
// A wired Max length: the number the wire carries, when the far end is a
// node that shows it (Float, Integer, a Primitive). null when it can't be known.
function wiredMax(node) {
const input = node.inputs?.find((slot) => slot?.widget?.name === "max_seconds");
if (!input || input.link == null) return { wired: false, value: null };
const graph = node.graph;
const link = graph?.getLink?.(input.link) ?? graph?.links?.get?.(input.link) ?? graph?.links?.[input.link];
const origin = link ? graph?.getNodeById?.(link.origin_id) : null;
const shown = origin?.widgets?.find((widget) => typeof widget?.value === "number");
return { wired: true, value: shown ? Number(shown.value) : null };
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 wired = wiredMax(state.node);
if (wired.wired) return { value: wired.value ?? 0, fromLink: true, known: wired.value != null };
return { value: Number(state.maxWidget?.value) || 0, fromLink: false, known: true };
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) {
return outputWindow(state.duration, state.startWidget.value, state.endWidget.value, maxSeconds(state).value);
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) {
@@ -105,16 +116,15 @@ function ensureAudioCss() {
.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-row{display:flex;align-items:center;gap:6px;flex:none;padding:0 2px;}
.ausboss-audio-root .ausboss-audio-row .ausboss-video-values{flex:1 1 auto;min-width:0;}
.ausboss-audio-root .ausboss-audio-play{min-width:30px;font-size:10px;}
.ausboss-audio-root .ausboss-audio-length{flex:none;padding:0 2px;color:#7fd9d2;font-size:10px;font-variant-numeric:tabular-nums;white-space:nowrap;cursor:default;}
.ausboss-audio-root .ausboss-audio-length:empty{display:none;}
.ausboss-audio-root .ausboss-audio-length.has-cut{color:#ff9aa0;cursor:pointer;text-decoration:underline dotted rgba(224,82,90,.8);text-underline-offset:2px;}
.ausboss-audio-root .ausboss-audio-row .ausboss-video-tool{flex:none;}
.ausboss-audio-root .ausboss-video-values{display:flex;gap:8px;}
.ausboss-audio-root .ausboss-video-value input{width:48px;}
.ausboss-audio-root .ausboss-audio-length{margin-left:auto;}
.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);
}
@@ -192,21 +202,31 @@ function draw(state) {
}
}
// 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 max = maxSeconds(state);
if (document.activeElement !== state.startInput) state.startInput.value = formatTimecode(win.start);
if (document.activeElement !== state.endInput) state.endInput.value = formatTimecode(win.end);
if (state.duration > 0) {
const summary = outputSummary(win, { maxFromLink: max.fromLink && !max.known });
state.summary.textContent = win.length > 0 ? secondsLabel(win.length) : "";
state.summary.classList.toggle("has-cut", win.cut > 0.005);
state.summary.title = win.cut > 0.005
? `${summary}. Max length is ${max.value} s, so ${formatTimecode(win.keepEnd)} to ${formatTimecode(win.end)} is cut off (red). Click to move OUT to ${formatTimecode(win.keepEnd)}.`
: `${summary}: ${formatTimecode(win.start)} to ${formatTimecode(win.keepEnd)} comes out.`;
} else {
state.summary.textContent = "";
}
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);
}
@@ -217,12 +237,19 @@ function writeWidget(widget, value) {
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 {
writeWidget(state.startWidget, bounds.start);
// OUT at the very end stays 0, the widget's own "to the end".
writeWidget(state.endWidget, bounds.end >= state.duration - 0.005 ? 0 : bounds.end);
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;
}
@@ -248,7 +275,7 @@ function installDrag(state) {
event.preventDefault();
event.stopPropagation();
const initial = infoAt(event.clientX);
const bounds = { start: initial.win.start, end: initial.win.end };
const bounds = { start: initial.win.start, end: initial.win.keepEnd };
const anchor = initial.fraction * state.duration;
const downX = event.clientX;
let moved = false;
@@ -262,7 +289,7 @@ function installDrag(state) {
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.end }, initial.zone, next.fraction, MIN_TRIM_SECONDS));
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 {
@@ -336,19 +363,6 @@ function installPlayer(state) {
state.stopPlayer = () => { audio.pause(); stop(); };
}
function commitTimeInput(state, edge, input) {
if (state.duration <= 0) return;
const seconds = parseTimecode(input.value);
const win = currentWindow(state);
if (seconds === null) {
input.value = formatTimecode(edge === "start" ? win.start : win.end);
return;
}
writeTrim(state, dragTrimHandle(state.duration, { start: win.start, end: win.end }, edge, seconds / state.duration, MIN_TRIM_SECONDS));
notifyAusbossChange();
input.blur();
}
function watchWidget(state, widget) {
if (!widget || widget.__ausbossAudioWatch) return;
widget.__ausbossAudioWatch = true;
@@ -385,37 +399,44 @@ function buildPanel(node) {
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);
const values = document.createElement("div");
values.className = "ausboss-video-values";
const makeValue = (labelText, title) => {
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 = title;
input.addEventListener("keydown", (event) => {
keepKeyInField(event);
if (event.key === "Enter") input.dispatchEvent(new Event("change"));
});
wrap.append(label, input);
return { wrap, input };
// 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));
};
const startValue = makeValue("IN", "Where the sound starts. Type seconds (12.5) or a time (0:12.5).");
const endValue = makeValue("OUT", "Where the sound stops. Type seconds (24) or a time (0:24.0).");
// How long the output is, beside OUT and off the wave. Red when Max
// length cuts the pick short; the tooltip says how much.
const summary = document.createElement("div");
summary.className = "ausboss-audio-length";
values.append(startValue.wrap, endValue.wrap);
const row = document.createElement("div");
row.className = "ausboss-audio-row";
row.append(playButton, values, summary, loopButton);
root.append(stage, row);
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,
@@ -435,22 +456,11 @@ function buildPanel(node) {
audio.preload = "auto";
const abort = new AbortController();
const state = node.__ausbossLoadAudio = {
node, root, stage, canvas, status, playButton, loopButton, summary, audio,
startInput: startValue.input, endInput: endValue.input,
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,
};
// Clicking the red length moves OUT to where the sound really ends.
summary.addEventListener("click", (event) => {
const win = currentWindow(state);
if (win.cut <= 0.005) return;
event.preventDefault();
event.stopPropagation();
writeTrim(state, { start: win.start, end: win.keepEnd });
notifyAusbossChange();
});
const updateLoop = () => loopButton.classList.toggle("active", loopEnabled(node));
updateLoop();
loopButton.addEventListener("click", (event) => {
@@ -509,8 +519,6 @@ function buildPanel(node) {
watchWidget(state, startWidget);
watchWidget(state, endWidget);
watchWidget(state, state.maxWidget);
startValue.input.addEventListener("change", () => commitTimeInput(state, "start", startValue.input));
endValue.input.addEventListener("change", () => commitTimeInput(state, "end", endValue.input));
const observer = new ResizeObserver(() => draw(state));
observer.observe(stage);
state.observer = observer;
+145 -355
View File
@@ -1,9 +1,11 @@
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 { formatTimecode, parseTimecode } from "../shared/timecode.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 { parseImageReference } from "../shared/pad_canvas.mjs";
import {
mediaInfo,
@@ -19,42 +21,31 @@ 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;
// 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;
// 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;
// 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
// chrome covers the transport row and the trim strip under the player.
const DEFAULT_NODE_SIZE = [380, responsivePreviewHeight(380) + PREVIEW_CHROME + 190];
// extra covers the tools over the picture and the timing card under it.
const DEFAULT_NODE_SIZE = [380, responsivePreviewHeight(380) + PREVIEW_CHROME + 210];
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) {
@@ -66,14 +57,25 @@ 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);
}
@@ -82,271 +84,116 @@ function isSingleFrame(state) {
}
// Where the preview belongs for the current mode: the chosen frame, or the
// trim window's IN point.
// clip's start.
function homeTime(state) {
return isSingleFrame(state)
? singleFrameTime(state.video.duration, state.startWidget.value)
: currentBounds(state).start;
}
function applyMode(state) {
const single = isSingleFrame(state);
state.root.classList.toggle("is-single-frame", single);
state.frameButton?.classList.toggle("active", single);
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);
}
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;
// 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.sourceFps = Math.max(0, Number(metadata?.fps) || 0);
updateTrimFace(state);
state.metadata = metadata;
state.card?.sync();
} catch (_error) {
/* no fps, no frame count */
/* no metadata, no timing card numbers */
}
}
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 setWidget(widget, value) {
if (!widget) return;
if (widget.value === value) return;
widget.value = value;
widget.callback?.(value);
}
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",
);
// 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; }
}
};
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 });
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();
}
// 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 installPlayback(state) {
@@ -356,9 +203,9 @@ function installPlayback(state) {
state.playRaf = 0;
};
const tick = () => {
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 (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 (!isSingleFrame(state)) {
const bounds = currentBounds(state);
const action = playbackBoundaryAction(video.currentTime, bounds, getLoopEnabled(state.node), TRIM_EPSILON);
@@ -367,9 +214,11 @@ 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", () => {
@@ -390,7 +239,7 @@ function installPlayback(state) {
state.correctingSeek = true;
video.currentTime = target;
}, { signal: state.abort.signal });
video.addEventListener("seeked", () => { state.correctingSeek = false; }, { signal: state.abort.signal });
video.addEventListener("seeked", () => { state.correctingSeek = false; followPlayer(state); }, { signal: state.abort.signal });
state.stopTick = stopTick;
}
@@ -401,8 +250,8 @@ function watchTrimWidget(state, widget) {
widget.callback = function (...args) {
const result = prior?.apply(this, args);
if (!state.writing) {
updateTrimFace(state);
if (state.video.readyState >= 1) state.video.currentTime = homeTime(state);
state.card?.sync();
if (state.video.readyState >= 1 && state.video.paused) state.video.currentTime = homeTime(state);
}
return result;
};
@@ -416,7 +265,10 @@ function watchFrameWidget(state, widget) {
const result = prior?.apply(this, args);
if (!isSingleFrame(state)) {
const reopened = trimAfterFramePick(state.startWidget.value, state.endWidget.value);
if (reopened) writeTrim(state, reopened);
if (reopened) {
state.writing = true;
try { setWidget(state.endWidget, reopened.end); } finally { state.writing = false; }
}
}
applyMode(state);
if (state.video.readyState >= 1) state.video.currentTime = homeTime(state);
@@ -424,28 +276,6 @@ 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");
@@ -461,6 +291,8 @@ 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";
@@ -475,7 +307,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", "Loop playback inside the selected trim");
const loopButton = makeToolButton("LOOP", "Play the clip again and again");
loopButton.classList.add("ausboss-video-loop");
const reloadButton = makeToolButton("↻", "Reload the selected source video");
const frameButton = frameWidget
@@ -485,45 +317,12 @@ function buildPreview(node) {
tools.append(loopButton, reloadButton);
stage.append(video, status, tools);
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);
// 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 widget = node.addDOMWidget(PREVIEW_WIDGET, "ausboss_video", root, {
serialize: false,
@@ -544,15 +343,9 @@ function buildPreview(node) {
const abort = new AbortController();
const state = node.__ausbossLoadVideo = {
node, root, stage, video, status, loopButton, reloadButton, frameButton,
trim, range, selection, startHandle, endHandle, startInput: startValue.input,
endInput: endValue.input, startLabel: startValue.label, durationLabel,
cardSlot, card: null, cardMode: null, metadata: null, head: 0,
videoWidget, startWidget, endWidget, frameWidget,
// 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,
widget, abort, writing: false, correctingSeek: false, playRaf: 0,
};
const updateLoopButton = () => loopButton.classList.toggle("active", getLoopEnabled(node));
@@ -583,9 +376,9 @@ function buildPreview(node) {
if (!name || typeof name !== "string") {
video.pause();
video.removeAttribute("src");
state.sourceFps = 0;
state.metadata = null;
setEmpty(state, "Choose or upload a video");
updateTrimFace(state);
state.card?.sync();
return;
}
const parts = splitMediaName(name);
@@ -595,7 +388,7 @@ function buildPreview(node) {
const type = parseImageReference(name)?.type ?? "input";
video.src = api.apiURL(`/view?${mediaViewQuery({ ...parts, type }, "input")}`);
video.load();
probeSourceFps(state, name);
probeMetadata(state, name);
};
state.refresh = refresh;
reloadButton.addEventListener("click", (event) => {
@@ -605,31 +398,23 @@ 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);
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.
// The card says where the clip is; the stage only names the source on hover.
setReady(state, "");
const sourceInfo = mediaInfo(null, video);
durationLabel.title = sourceInfo ? `Source: ${sourceInfo}` : "";
updateTrimFace(state);
stage.title = sourceInfo ? `Source: ${sourceInfo}` : "";
state.card?.sync();
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) {
@@ -664,6 +449,11 @@ 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?.();
+385 -36
View File
@@ -1,7 +1,7 @@
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, holdVueNodeMinWidth } from "../shared/panel_layout.mjs";
import { WIDGET_FRAME, fillNodeHeight, growToNodeFloor, holdVueNodeMinWidth } from "../shared/panel_layout.mjs";
import { hideInputsInDef, hideWidget as collapseWidget } from "../shared/widget_visibility.mjs";
import {
closeSettingsMenu,
@@ -9,10 +9,15 @@ 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,6 +30,8 @@ import {
STRENGTH_MIN,
appendFolderRows,
clampHighlight,
followCurve,
rowsForNewCurve,
fitLoraLabel,
formatFileSize,
groupName,
@@ -46,6 +53,8 @@ import {
collectUpstreamLoaders,
collectDownstreamLoaders,
absorbChainIssue,
anyFolderOpen,
parentFolder,
mergeImportedRows,
moveGroup,
moveHighlight,
@@ -64,6 +73,7 @@ import {
scrubValue,
serializeRows,
setGroupEnabled,
setFolderFolds,
setGroupOff,
setStrength,
shortLoraName,
@@ -82,8 +92,9 @@ import {
upsertTemplate,
} from "../shared/lora_stack.mjs";
import {
MAX_PICTURE_BYTES, civitaiButtonLabel, civitaiByHashUrl, civitaiFailureText, isCivitaiAddress,
parseCivitaiBody, pickCivitaiPicture, smallPictureUrl,
MAX_PICTURE_BYTES, civitaiButtonLabel, civitaiByHashUrl, civitaiFailureText, civitaiQueueLabel,
civitaiQueueSummary, isCivitaiAddress, parseCivitaiBody, pickCivitaiPicture, runCivitaiQueue,
smallPictureUrl,
} from "../shared/civitai_lookup.mjs";
const NODE_CLASS = "AUSBOSS_NODES_LoraLoader";
@@ -138,6 +149,14 @@ 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,
@@ -208,6 +227,8 @@ 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";
@@ -218,7 +239,7 @@ function installStyles() {
if (document.getElementById("ausboss-lora-styles")) return;
const style = document.createElement("style");
style.id = "ausboss-lora-styles";
style.textContent = `
style.textContent = STRENGTH_LINK_STYLES + `
.ausboss-lora-panel, .ausboss-lora-panel *,
.ausboss-lora-pop, .ausboss-lora-pop *,
.ausboss-lora-hoverthumb { box-sizing: border-box; }
@@ -243,6 +264,11 @@ 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; }
@@ -393,6 +419,10 @@ 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}; }
@@ -476,6 +506,10 @@ 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;
@@ -724,15 +758,78 @@ 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) {
@@ -813,7 +910,7 @@ function panelHeight(state) {
}
function panelMinWidth(state) {
return PANEL_MIN_WIDTH + (linked(state) ? 0 : SEPARATE_EXTRA_WIDTH);
return PANEL_MIN_WIDTH + (linked(state) ? 0 : SEPARATE_EXTRA_WIDTH) + (curveWired(state) ? CURVE_MARK_WIDTH : 0);
}
function fitNode(state) {
@@ -870,7 +967,11 @@ 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 = () => state.rows[index]?.[key].toFixed(2) ?? "1.00";
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.__ausbossTint = () => state.rows[index] && applyRangeTint(input, state.rows[index], key);
ensureRange(state, state.rows[index].name);
@@ -884,6 +985,16 @@ 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();
@@ -955,6 +1066,34 @@ 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,
@@ -967,6 +1106,14 @@ 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);
@@ -1001,9 +1148,15 @@ 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(search, list);
pop.append(head, 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();
@@ -1026,7 +1179,8 @@ 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 collapsedFolders = loadCollapsedFolders();
const startFolded = pickerStartsFolded();
const collapsedFolders = startFolded ? new Set() : loadCollapsedFolders();
// Search reveals matches without losing the user's usual folded view.
let searchCollapsed = new Set();
const currentFolds = () => search.value.trim() ? searchCollapsed : collapsedFolders;
@@ -1034,15 +1188,21 @@ 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.
const toggleFolder = (name, collapsed = !currentFolds().has(name), after = "highlight") => {
// 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 folds = currentFolds();
if (collapsed) folds.add(name);
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);
else folds.delete(name);
if (folds === collapsedFolders) saveCollapsedFolders(folds);
if (folds === collapsedFolders && !startFolded) saveCollapsedFolders(folds);
const scrollTop = list.scrollTop;
highlight = -1;
renderList();
if (after === "highlight" && adding) {
if (after === "highlight" && adding && name != null) {
highlight = options.findIndex((entry) => entry.kind === "folder" && entry.name === name);
list.querySelector(`[data-ausboss-flat="${highlight}"]`)?.classList.add("highlight");
}
@@ -1059,15 +1219,16 @@ function openPicker(state, index, anchor, { keyboard = false } = {}) {
button.dataset.folder = name;
button.innerHTML = chevronIconSvg(false);
button.setAttribute("aria-expanded", String(expanded));
button.title = `${expanded ? "Collapse" : "Expand"} ${name}`;
button.setAttribute("aria-label", button.title);
button.setAttribute("aria-label", `${expanded ? "Collapse" : "Expand"} ${name}`);
button.title = `${button.getAttribute("aria-label")} (Alt-click: and every folder inside it)`;
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");
toggleFolder(name, !currentFolds().has(name), event.detail === 0 ? "arrow" : "search",
{ subtree: event.altKey || event.shiftKey });
});
row.append(button);
};
@@ -1290,6 +1451,11 @@ 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();
@@ -1317,6 +1483,9 @@ 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);
@@ -1326,9 +1495,18 @@ 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") {
&& options[highlight]?.kind === "folder"
&& !(event.key === "ArrowLeft" && currentFolds().has(options[highlight].name)
&& parentFolder(options[highlight].name) && !event.altKey && !event.shiftKey)) {
event.preventDefault();
toggleFolder(options[highlight].name, event.key === "ArrowLeft");
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);
} else if (event.key === "Home" || event.key === "End") {
event.preventDefault();
highlight = event.key === "Home" ? 0 : options.length - 1;
@@ -1357,6 +1535,13 @@ 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);
@@ -1378,8 +1563,10 @@ 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").
async function lookUpOnCivitai(serverName, picture = "PG-13") {
// 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 } = {}) {
const hashed = await (await api.fetchApi(
`/ausboss/lora/hash?name=${encodeURIComponent(serverName)}`
)).json();
@@ -1388,7 +1575,9 @@ async function lookUpOnCivitai(serverName, picture = "PG-13") {
credentials: "omit", redirect: "error", referrerPolicy: "no-referrer", cache: "no-store",
});
if (response.status === 404) return false;
if (!response.ok) throw new Error(`Civitai answered ${response.status}.`);
if (!response.ok) {
throw Object.assign(new Error(`Civitai answered ${response.status}.`), { status: response.status });
}
const info = parseCivitaiBody(await response.text());
const saved = await (await api.fetchApi("/ausboss/lora/civitai", {
method: "POST",
@@ -1396,24 +1585,28 @@ async function lookUpOnCivitai(serverName, picture = "PG-13") {
body: JSON.stringify({ name: serverName, info }),
})).json();
if (!saved.ok) throw new Error(saved.error || "Could not save the Civitai info.");
if (picture !== "off") {
await saveCivitaiPicture(serverName, info, picture === "any").catch((error) =>
loraToast(`Saved the Civitai info, but not its picture: ${civitaiFailureText(error)}`));
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" };
}
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) {
loraToast(anyRating
? "Civitai has no picture of this LoRA to save."
: "Civitai has no picture of this LoRA rated PG-13 or milder.");
return;
}
if (!picture) return false;
const response = await fetch(smallPictureUrl(picture.url), {
credentials: "omit", referrerPolicy: "no-referrer", cache: "no-store",
});
@@ -1431,6 +1624,76 @@ 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 ----------
@@ -1529,7 +1792,17 @@ function openInfo(state, index, anchor) {
loraToast(fetchButton.title);
}
});
card.append(fetchButton);
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);
}
const range = el("div", "ausboss-lora-range");
@@ -1765,6 +2038,18 @@ 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("Move up", () => commitGroups(state, moveRowInStack(state.rows, index, -1)),
@@ -2291,7 +2576,12 @@ 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;
const scale = strengthBarScale(state.rows);
// 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 dups = duplicateLoraKeys(state.rows);
state.panel.querySelectorAll(".ausboss-lora-name").forEach((button, index) => {
const row = state.rows[index];
@@ -2302,8 +2592,8 @@ function decorateRows(state) {
}
const notes = [row.name];
if (showBars) {
button.style.background = strengthBarBackground(row.strength, scale);
notes.push(`Model strength ${row.strength.toFixed(2)}; `
button.style.background = strengthBarBackground(shown[index].strength, scale);
notes.push(`Model strength ${shown[index].strength.toFixed(2)}; `
+ `bar edges are ±${scale.toFixed(2)}`);
} else {
button.style.background = "";
@@ -2348,6 +2638,7 @@ function updateRowValues(state) {
master.classList.toggle("mixed", overall === "mixed");
}
decorateRows(state);
decorateStrengthLinks(state);
}
// ---------- absorb the loader chain ----------
@@ -2521,6 +2812,19 @@ 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.
@@ -2829,7 +3133,7 @@ function renderRows(state) {
let nameDrag = null;
name.addEventListener("pointerdown", (event) => {
if (event.button !== 0 || !row.name
|| state.settings?.name_scrub === false) return;
|| state.settings?.name_scrub === false || linkedEntry(state, index)) return;
nameDrag = { x: event.clientX, y: event.clientY,
start: state.rows[index].strength, scrubbed: false };
name.setPointerCapture(event.pointerId);
@@ -2876,7 +3180,20 @@ function renderRows(state) {
showHoverThumb(state, row.name, event.clientX, event.clientY));
name.addEventListener("pointerleave", hideHoverThumb);
rowElement.append(grip, toggle, name, strengthBox(state, index, "strength"));
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"));
if (!linked(state)) rowElement.append(strengthBox(state, index, "strength_clip"));
const info = el("button", "ausboss-lora-info", "i");
@@ -2918,9 +3235,11 @@ function renderRows(state) {
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,
@@ -3027,6 +3346,7 @@ function syncRows(state) {
state.toggleSnapshot = snapshotEnabled(state.rows);
renderRows(state);
fitNode(state);
syncLoraFiles(state.node);
return true;
}
@@ -3051,6 +3371,7 @@ function ensureRedrawHook() {
if (state.node.graph !== shown) continue;
syncRows(state);
refreshLocks(state);
decorateStrengthLinks(state);
}
}, 250);
});
@@ -3156,6 +3477,7 @@ function watchBox(box) {
function unmountCard(state, { resize = true } = {}) {
liveCards.delete(state);
state.disposed = true;
state.unlinkStrengthWatch?.();
state.nameObserver?.disconnect();
closePopup();
try {
@@ -3191,6 +3513,7 @@ 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;
@@ -3249,6 +3572,10 @@ 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]);
@@ -3311,6 +3638,18 @@ 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();
@@ -3324,6 +3663,16 @@ 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
@@ -0,0 +1,303 @@
// 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;}
`;
+299
View File
@@ -0,0 +1,299 @@
// Pause for Shot 🆎: while a run waits on the node, a Continue bar shows on
// the node and over the 3D viewer it is wired to. Continue reads the viewer's
// camera, model turn and size as they are now and sends them to
// POST /ausboss/pause_shot/answer (nodes/node_pause_shot.py), which only
// accepts them while that node is waiting. The switch above the bar is the
// node's `pause` setting (js/widget_cards). When a 360 is wired into the
// node, the run hands it over as a temp picture and it goes behind the model
// as the viewer's panorama; Continue also sends the 360 strip's settings
// (js/viewer_pano), so the run's backdrop matches the viewer.
import { app } from "../../../scripts/app.js";
import { api } from "../../../scripts/api.js";
import { chainCallback, keepDomWidgetWidthAuto, showToast } from "../shared/index.mjs";
import { nodeByExecutionId } from "../shared/graph_ids.mjs";
import { compactAction, HINT_TYPE } from "../shared/panel_controls.mjs";
import { holdNodeMinWidth, pinVuePanelHeight } from "../shared/panel_layout.mjs";
import { FONT_UI, RADIUS_CONTROL, THEME as T } from "../shared/theme.mjs";
import { bottomButtons } from "../shared/viewer3d_layout.mjs";
import { viewValue } from "../shared/viewer_view.mjs";
const NODE_CLASS = "AUSBOSS_NODES_PauseShot";
const PANEL = "ausboss_pause_shot_panel";
const MIN_WIDTH = 260;
const PANEL_HEIGHT = 62;
function ensureCss() {
if (document.getElementById("ausboss-pause-shot-css")) return;
const style = document.createElement("style");
style.id = "ausboss-pause-shot-css";
style.textContent = `
.ausboss-pshot{box-sizing:border-box;overflow:hidden;display:flex;flex-direction:column;gap:6px;width:100%;height:100%;padding:6px 8px 8px;background:${T.card};border-radius:${RADIUS_CONTROL}px;font:400 12px/1.3 ${FONT_UI};color:${T.inkSoft}}
.ausboss-pshot-hint{${HINT_TYPE}}
.ausboss-pshot.waiting .ausboss-pshot-hint{color:${T.brandInk}}
.ausboss-pshot-row{display:flex;gap:6px;justify-content:flex-end}
.ausboss-pshot-row .ausboss-compact-action{height:26px;padding:0 12px}
.ausboss-pshot .go,.ausboss-pshot-over .go{background:${T.brand};color:${T.onBrand}}
.ausboss-pshot .go:hover:enabled,.ausboss-pshot-over .go:hover:enabled{background:${T.brand};color:${T.onBrand};filter:brightness(1.1)}
.ausboss-pshot:not(.waiting) .ausboss-pshot-row{visibility:hidden}
.ausboss-pshot-over{position:absolute;left:8px;bottom:8px;z-index:6;box-sizing:border-box;display:flex;align-items:center;gap:6px;height:32px;padding:0 4px 0 10px;border-radius:${RADIUS_CONTROL}px;background:${T.card};box-shadow:0 1px 6px rgba(0,0,0,.4);font:600 11px/1 ${FONT_UI};color:${T.brandInk};white-space:nowrap}
.ausboss-pshot-over .ausboss-compact-action{height:24px;padding:0 10px}
`;
document.head.append(style);
}
// The viewer wired to the pause: where its camera comes from.
function viewerOf(node) {
const slot = node.inputs?.findIndex((input) => input.name === "camera_info") ?? -1;
return slot >= 0 ? node.getInputNode?.(slot) ?? null : null;
}
// The viewer's shot as it is on screen right now.
async function readShot(viewer) {
const shot = {};
const state = viewer?.widgets?.find((widget) => widget.name === "viewport_state");
if (state?.serializeValue) {
const value = await state.serializeValue(viewer, viewer.widgets.indexOf(state));
if (value?.camera_info) shot.camera_info = value.camera_info;
if (Array.isArray(value?.model_3d_info)) shot.model_3d_info = value.model_3d_info;
}
const sky = viewer?.properties?.["AusBoss View"]?.sky;
if (sky && typeof sky === "object") shot.sky = sky;
// The viewer's Cut, so the run's mesh is cut the way the viewer shows it.
const cut = viewer?.properties?.["AusBoss View"]?.cut;
if (cut && typeof cut === "object") shot.cut = cut;
// The 360 taken out of the viewer (its background image removed) leaves
// the backdrop grey, as with no 360 wired in.
const scene = viewerGizmo(viewer)?.__ausbossScene;
if (scene && !(scene.currentBackgroundType === "image" && scene.backgroundRenderMode === "panorama")) shot.panorama = false;
try {
const ground = viewerGizmo(viewer)?.__ausbossScene?.__ausbossGround?.();
if (ground) shot.ground = ground;
} catch {
// No shadow then.
}
for (const key of ["width", "height"]) {
const linked = viewer?.inputs?.find((input) => input.name === key)?.link != null;
const widget = viewer?.widgets?.find((w) => w.name === key);
if (!linked && Number.isFinite(Number(widget?.value))) shot[key] = Number(widget.value);
}
return shot;
}
// The viewer's gizmo box, found through the 360 strip (js/viewer_pano).
function viewerGizmo(viewer) {
if (!viewer) return null;
for (const box of document.querySelectorAll("div[data-ausboss-gizmo]")) {
if (box.__ausbossNode === viewer && box.parentElement) return box;
}
return null;
}
const viewerBox = (viewer) => viewerGizmo(viewer)?.parentElement ?? null;
// ComfyUI sends the viewer's model only to the page that pressed Run. The
// pause brings it along, so a page that did not start the run (another tab,
// a phone, a reload) shows the model too.
// ComfyUI names the model as {"result": ["model.glb [temp]", ...]}, or since
// its standard 3d output item as {"3d": [{filename, subfolder, type}]}.
const plainName = (text) => String(text ?? "").replace(/\s*\[[^\]]*\]$/, "").replaceAll("\\", "/");
function modelName(output) {
const first = output?.result?.[0];
if (typeof first === "string") return plainName(first);
const item = output?.["3d"]?.[0];
if (typeof item?.filename !== "string") return "";
return plainName(item.subfolder ? `${item.subfolder}/${item.filename}` : item.filename);
}
function showModel(viewer, shown) {
const name = modelName(shown?.output);
if (!viewer || !name || typeof viewer.onExecuted !== "function") return;
const last = plainName(viewer.properties?.["Last Time Model File"]);
if (last === name || last.endsWith(`/${name}`)) return;
viewer.onExecuted(shown.output);
}
// Put the run's 360 behind the model, as the viewer's panorama.
async function showPanorama(viewer, picture) {
const scene = viewerGizmo(viewer)?.__ausbossScene;
if (!scene?.setBackgroundImage || !picture?.filename) return false;
await scene.setBackgroundImage(`temp/${picture.filename}`);
scene.setBackgroundRenderMode?.("panorama");
scene.__ausbossViewport?.forceRender?.();
return true;
}
function buildPanel(node) {
ensureCss();
const root = document.createElement("div");
root.className = "ausboss-pshot";
const hint = document.createElement("div");
hint.className = "ausboss-pshot-hint";
const row = document.createElement("div");
row.className = "ausboss-pshot-row";
const stop = compactAction("Stop", "End the run here.");
const go = compactAction("Continue", "Go on with the shot as the viewer shows it now.");
go.classList.add("go");
row.append(stop, go);
root.append(hint, row);
const state = { waitingFor: null, over: null };
const idle = "A run waits here while you frame the shot.";
hint.textContent = idle;
const removeOver = () => { state.over?.remove(); state.over = null; };
const clear = () => {
state.waitingFor = null;
root.classList.remove("waiting");
hint.textContent = idle;
removeOver();
};
const answer = async (action) => {
const id = state.waitingFor;
if (!id) return;
const buttons = [go, stop, ...(state.over ? state.over.querySelectorAll("button") : [])];
buttons.forEach((button) => { button.disabled = true; });
try {
const body = { node: id, action };
if (action === "continue") body.shot = await readShot(viewerOf(node));
const response = await api.fetchApi("/ausboss/pause_shot/answer", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) });
if (!response.ok) {
const data = await response.json().catch(() => ({}));
showToast({ detail: data.error || "The pause could not be answered.", severity: "warn" });
if (response.status === 409) clear();
}
} catch {
showToast({ detail: "The pause could not be answered. Is ComfyUI still running?", severity: "warn" });
} finally {
buttons.forEach((button) => { button.disabled = false; });
}
};
go.addEventListener("click", () => answer("continue"));
stop.addEventListener("click", () => answer("stop"));
// The same Continue on the viewer, at its bottom-left corner on the line
// of the viewer's own bottom buttons, clear of the shot.
const placeOver = (host, over) => {
const line = bottomButtons(host);
if (!line) return;
over.style.bottom = `${line.bottom}px`;
over.style.height = `${line.height}px`;
};
const showOver = () => {
removeOver();
const host = viewerBox(viewerOf(node));
if (!host) return;
const over = document.createElement("div");
over.className = "ausboss-pshot-over";
const label = document.createElement("span");
label.textContent = "Frame your shot";
const overStop = compactAction("Stop", "End the run here.");
const overGo = compactAction("Continue", "Go on with the shot as the viewer shows it now.");
overGo.classList.add("go");
overStop.addEventListener("click", () => answer("stop"));
overGo.addEventListener("click", () => answer("continue"));
for (const type of ["pointerdown", "mousedown", "dblclick", "contextmenu"]) over.addEventListener(type, (event) => event.stopPropagation());
over.append(label, overStop, overGo);
host.append(over);
placeOver(host, over);
state.over = over;
};
const show = (detail) => {
state.waitingFor = String(detail.node);
root.classList.add("waiting");
hint.textContent = "Frame the shot in the viewer, then Continue.";
showOver();
const viewer = viewerOf(node);
try {
showModel(viewer, detail.viewer);
} catch {
// The viewer keeps what it has.
}
const panorama = detail.panorama;
const showIt = () => showPanorama(viewer, panorama).catch(() => false);
// After a reload, or before the viewer has drawn once, its panel is not
// there yet: keep looking for it while the pause waits.
if (!state.over || !viewerGizmo(viewer)) {
const id = state.waitingFor;
let tries = 0;
const retry = () => {
if (state.waitingFor !== id) return;
if (!state.over) showOver();
if (state.over && viewerGizmo(viewer)) { showIt(); return; }
// Quick at first, then slower for as long as the pause waits.
setTimeout(retry, (tries += 1) < 40 ? 750 : 2000);
};
setTimeout(retry, 750);
} else showIt();
node.setDirtyCanvas?.(true, true);
};
root.addEventListener("pointerdown", (event) => {
if (event.target.closest("button")) event.stopPropagation();
});
return { root, show, clear, isWaitingFor: (id) => state.waitingFor === String(id) };
}
function panelOf(detail) {
const node = nodeByExecutionId(app.rootGraph ?? app.graph, detail?.node);
return node?.__ausbossPauseShot ?? null;
}
// A page opened or reloaded while a run waits missed the event: ask.
async function showWaiting() {
try {
const response = await api.fetchApi("/ausboss/pause_shot/waiting");
if (!response.ok) return;
const { waiting } = await response.json();
for (const detail of Array.isArray(waiting) ? waiting : []) {
const panel = panelOf(detail);
if (panel && !panel.isWaitingFor(detail.node)) panel.show(detail);
}
} catch {
// Nothing to bring back.
}
}
app.registerExtension({
name: "ausboss.pause_shot",
afterConfigureGraph() { showWaiting(); },
setup() {
api.addEventListener("reconnected", () => showWaiting());
api.addEventListener("ausboss-pause-shot", (event) => panelOf(event.detail)?.show(event.detail));
api.addEventListener("ausboss-pause-shot-done", (event) => {
const panel = panelOf(event.detail);
if (panel?.isWaitingFor(event.detail?.node)) panel.clear();
});
},
beforeRegisterNodeDef(nodeType, nodeData) {
if (nodeData?.name !== NODE_CLASS) return;
chainCallback(nodeType.prototype, "onNodeCreated", function () {
const panel = buildPanel(this);
const widget = this.addDOMWidget(PANEL, PANEL, panel.root, { serialize: false, hideOnZoom: false });
keepDomWidgetWidthAuto(widget);
// Not saved with the workflow: saved values come back by position.
widget.serialize = false;
// A hint and two buttons: a constant height (tests/panel_guards.test.mjs,
// fixedByDesign).
widget.computeSize = (width) => [Math.max(MIN_WIDTH, Number(width || this.size?.[0] || MIN_WIDTH)), PANEL_HEIGHT];
pinVuePanelHeight(widget);
holdNodeMinWidth(widget, MIN_WIDTH);
widget.options.minNodeSize = [MIN_WIDTH, 60];
this.__ausbossPauseShot = panel;
// The viewer's 360 settings and Cut go into the hidden `view` input as
// the prompt is built, so a run that goes straight through runs again
// when one of them changed (js/shared/viewer_view.mjs). The widget
// itself holds nothing, so a saved workflow carries no copy.
const view = this.widgets?.find((item) => item.name === "view");
if (view) {
view.value = "";
view.serializeValue = () => viewValue(viewerOf(this)?.properties?.["AusBoss View"]);
}
});
chainCallback(nodeType.prototype, "onRemoved", function () {
this.__ausbossPauseShot?.clear();
});
},
});
+185 -10
View File
@@ -32,17 +32,20 @@ import { WIDGET_FRAME, fillNodeHeight, holdVueNodeMinWidth } from "../shared/pan
import { hideInputsInDef, hideWidget } from "../shared/widget_visibility.mjs";
import { liftSlot, markSocketless } from "../shared/widget_card_math.mjs";
import { makeScrubInput } from "../shared/scrub_input.mjs";
import { keepKeyInField } from "../shared/canvas_passthrough.mjs";
import {
closeSettingsMenu,
gearIconSvg,
loadSettings,
openSettingsMenu,
saveSetting,
} from "../shared/settings_menu.mjs";
import {
DEFAULT_RAIL,
DEFAULT_SNAP,
DIM_MAX,
DIM_MIN,
RAIL_MAX,
SNAP_STEPS,
applyRatioAtBudget,
chipMatch,
@@ -54,12 +57,16 @@ import {
offGrid,
orientRatio,
parseRail,
parseRatioToken,
parseWorkflowSizes,
railEntries,
railText,
ratioKey,
readWorkflowPolicy,
savedWorkflowPolicy,
workflowRatios,
quickSizes,
ratioLabel,
railRatioLabel,
reduceRatio,
scrubDim,
sizeForMegapixels,
@@ -97,14 +104,16 @@ const SETTINGS_SCHEMA = [
},
{
key: "chips_keep_budget", label: "Chips keep current budget", type: "toggle",
default: false,
hint: "Ratio chips reshape at your current megapixels instead of jumping "
+ "to that ratio's ~1MP default size.",
default: true,
hint: "On: ratio chips keep your current megapixels. Off: a chip jumps "
+ "to that ratio's ~1MP size.",
},
{
key: "rail", label: "Ratio rail", type: "text",
default: DEFAULT_RAIL, placeholder: DEFAULT_RAIL,
hint: "Comma-separated ratios shown as chips, e.g. \"1:1, 21:9\".",
// Stored as text ("1:1, 16:9, -21:9"); the gear shows it as a list
// editor (editRatioRail), never as this text field.
key: "rail", label: "Ratio chips", type: "text",
default: DEFAULT_RAIL,
hint: "Which ratios show as chips. Switch them on or off, or add your own, like 21:9.",
},
{ section: "Latent output" },
{
@@ -146,6 +155,25 @@ function installStyles() {
.ausboss-size-dialog [role=alert]{color:#ffd49e}
.ausboss-size-dialog p{color:#adc1be;font:12px/1.45 system-ui;margin:7px 0 12px}
.ausboss-size-dialog footer{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}
.ausboss-size-dialog footer .grow{margin-right:auto}
.ausboss-rail-list{list-style:none;margin:0;padding:0;max-height:min(320px,50vh);overflow:auto;
border:1px solid #2a3a3a;border-radius:8px;background:#111819}
.ausboss-rail-row{display:flex;align-items:center;gap:10px;height:32px;padding:0 6px 0 10px;
border-bottom:1px solid #1f2b2b;cursor:pointer}
.ausboss-rail-row:last-child{border-bottom:0}
.ausboss-rail-row.off{color:#6f8482}
.ausboss-rail-row .box{width:24px;height:16px;display:flex;align-items:center;justify-content:center;flex:none}
.ausboss-rail-row .box span{display:block;border:1.4px solid currentColor;border-radius:2px;box-sizing:border-box}
.ausboss-rail-row .name{font:12px ${MONO};min-width:44px}
.ausboss-rail-row .size{flex:1;color:#7f9795;font:11px ${MONO}}
.ausboss-rail-row.off .size{color:#4f6260}
.ausboss-rail-del{width:24px;height:24px;border:0;border-radius:5px;background:none;color:#7f9795;
cursor:pointer;font:15px/1 system-ui}
.ausboss-rail-del:hover{background:#3a2424;color:#ffb4a8}
.ausboss-rail-add{display:flex;align-items:center;gap:8px;margin-top:10px}
.ausboss-rail-add input{flex:1;min-width:0;box-sizing:border-box;height:28px;padding:0 8px;
border:1px solid #345554;border-radius:6px;background:#0f1516;color:#d7e4e3;font:12px ${MONO}}
.ausboss-rail-add input:focus{outline:none;border-color:#00b4aa}
.ausboss-res-sec { flex: none; background: #141515; border: 1px solid #252727;
border-radius: 8px; padding: 6px 8px 8px; }
.ausboss-res-sechead { display: flex; align-items: baseline;
@@ -517,6 +545,146 @@ function editWorkflowSizes(state) {
dialog.showModal();
}
// The gear's "Ratio chips" list: every saved ratio with a switch, a delete
// button, an add box and a way back to the shipped list. One list for every
// Latent Size node in this browser, like the gear's other display options.
function editRatioRail(state) {
closeSettingsMenu();
let entries = railEntries(state.settings?.rail);
const dialog = el("dialog", "ausboss-size-dialog");
dialog.setAttribute("aria-label", "Ratio chips");
const heading = el("label", "", "Ratio chips");
const hint = el("p", "", "Ticked ratios show as chips on every Latent Size node. "
+ "The flip button on the node turns any of them portrait.");
const list = el("ul", "ausboss-rail-list");
const addRow = el("div", "ausboss-rail-add");
const input = el("input");
input.type = "text";
input.placeholder = "Add a ratio, like 21:9";
input.setAttribute("aria-label", "New ratio");
const add = compactAction("Add");
addRow.append(input, add);
const error = el("div");
error.setAttribute("role", "alert");
const render = () => {
list.textContent = "";
const snap = currentSnap(state);
for (const entry of entries) {
const row = el("li", `ausboss-rail-row${entry.on ? "" : " off"}`);
const check = el("input");
check.type = "checkbox";
check.checked = entry.on;
check.setAttribute("aria-label", `Show ${entry.label}`);
const box = el("span", "box");
const glyph = el("span");
const fitted = fitRectInBox(entry.x, entry.y, 22, 14);
glyph.style.width = `${fitted.w.toFixed(1)}px`;
glyph.style.height = `${fitted.h.toFixed(1)}px`;
box.append(glyph);
const size = defaultSizeForRatio(entry, snap);
const del = el("button", "ausboss-rail-del", "×");
del.type = "button";
del.title = `Remove ${entry.label}`;
del.setAttribute("aria-label", `Remove ${entry.label}`);
const toggle = () => {
entry.on = !entry.on;
error.textContent = "";
render();
};
check.addEventListener("click", (event) => { event.stopPropagation(); toggle(); });
row.addEventListener("click", (event) => { if (event.target !== del) toggle(); });
del.addEventListener("click", (event) => {
event.stopPropagation();
entries = entries.filter(other => other !== entry);
error.textContent = "";
render();
});
row.append(check, box, el("span", "name", entry.label),
el("span", "size", `${size.width} × ${size.height}`), del);
list.append(row);
}
add.disabled = entries.length >= RAIL_MAX;
};
const addTyped = () => {
const ratio = parseRatioToken(input.value);
if (!ratio) {
error.textContent = "Type a ratio as two whole numbers, like 21:9 or 5:4.";
input.focus();
return;
}
const existing = entries.find(entry => ratioKey(entry) === ratioKey(ratio));
if (existing) {
existing.on = true;
error.textContent = `${existing.label} is already in the list, so it is switched on.`;
} else if (entries.length >= RAIL_MAX) {
error.textContent = `The list holds up to ${RAIL_MAX} ratios. Remove one first.`;
return;
} else {
entries.push({ ...ratio, on: true });
error.textContent = "";
}
input.value = "";
render();
list.lastElementChild?.scrollIntoView?.({ block: "nearest" });
input.focus();
};
add.onclick = addTyped;
input.addEventListener("keydown", (event) => {
keepKeyInField(event);
if (event.key !== "Enter") return;
event.preventDefault();
addTyped();
});
const footer = el("footer");
const reset = compactAction("Reset to defaults");
reset.classList.add("grow");
reset.title = "Back to the shipped list: six chips on, 5:4 and 21:9 off";
reset.onclick = () => {
entries = railEntries(DEFAULT_RAIL);
error.textContent = "";
render();
};
const cancel = compactAction("Cancel");
const save = compactAction("Save");
cancel.onclick = () => dialog.close();
save.onclick = () => {
if (!entries.some(entry => entry.on)) {
error.textContent = "Keep at least one ratio switched on.";
return;
}
const rail = railText(entries);
saveSetting(SETTINGS_SCOPE, SETTINGS_SCHEMA, "rail", rail);
for (const other of latentSizeStates()) {
other.settings = { ...other.settings, rail };
buildPanel(other);
fitNode(other);
}
dialog.close();
};
footer.append(reset, cancel, save);
dialog.append(heading, hint, list, addRow, error, footer);
document.body.append(dialog);
dialog.addEventListener("close", () => dialog.remove(), { once: true });
render();
dialog.showModal();
}
// Every live Latent Size panel, in the open graph and the one on screen
// (a subgraph), so a changed chip list shows everywhere at once.
function latentSizeStates() {
const states = new Set();
for (const graph of [app.graph, app.canvas?.graph]) {
for (const node of graph?.nodes ?? graph?._nodes ?? []) {
const state = node?.__ausbossResolution;
if (state && !state.disposed) states.add(state);
}
}
return states;
}
function repaint(state) {
const { width, height } = getSize(state);
const snap = currentSnap(state);
@@ -525,7 +693,7 @@ function repaint(state) {
state.dimLabel.textContent = `${width} × ${height}`;
state.subMp.textContent = `${megapixels(width, height).toFixed(2)} MP`;
state.subRatio.textContent = state.strict ? `${ratio.x}:${ratio.y}` : ratioLabel(width, height);
state.subRatio.textContent = state.strict ? `${ratio.x}:${ratio.y}` : railRatioLabel(width, height, state.railRatios);
state.offGridDot.style.display = !state.strict && offGrid(width, height, snap) ? "" : "none";
state.dots.style.display = state.settings?.show_grid === false ? "none" : "";
@@ -606,7 +774,7 @@ function repaint(state) {
state.quickHint.textContent = state.policyError ? "Invalid list · edit in settings"
: linked && state.strict ? "Linked size checked at run"
: state.strict ? `Allowed · ${ratio.x}:${ratio.y}` : picks ? "Workflow recommendations"
: onRail ? `for ${ratioLabel(width, height)} · /${snap}` : `custom · /${snap}`;
: onRail ? `for ${railRatioLabel(width, height, state.railRatios)} · /${snap}` : `custom · /${snap}`;
}
state.quickButtons.forEach(({ button, size }) => {
button.disabled = linked;
@@ -901,6 +1069,10 @@ function buildPanel(state) {
key: "workflow_sizes", type: "action", label: "Workflow resolutions", button: "Edit list",
onAction: () => editWorkflowSizes(state),
}, ...SETTINGS_SCHEMA.filter(e => !state.strict || !["default_snap", "chips_keep_budget", "rail"].includes(e.key)).map((entry) => {
if (entry.key === "rail") {
return { key: "rail_list", type: "action", label: entry.label, hint: entry.hint,
button: "Edit list", onAction: () => editRatioRail(state) };
}
const input = entry.key === "latent" ? "latent" : entry.key === "batch" ? "batch_size" : null;
return input && axisLinked(state, input) ? { section: `${entry.label} is linked` } : entry;
})],
@@ -912,7 +1084,10 @@ function buildPanel(state) {
batch: Number(state.batchWidget?.value ?? 1),
},
onChange: (values, key) => {
state.settings = values;
// The menu's values lack the rail (its row is the list editor), so
// keep the stored one; after a Reset that is the shipped list.
state.settings = { ...loadSettings(SETTINGS_SCOPE, SETTINGS_SCHEMA), ...values };
delete state.settings.rail_list;
if (key === "latent" && state.latentWidget) {
state.latentWidget.value = values.latent;
state.latentWidget.callback?.(values.latent);
+25 -13
View File
@@ -33,7 +33,7 @@ const CARD_HEIGHT = 288;
const WRAPPER_INSET = 16;
const HIDDEN = [
"filename_prefix", "format", "save_metadata", "exact_name", "on_existing",
"output_dir", "caption", "name_counter", "name_date", "name_time", "name_size", "name_batch", "autosave",
"output_dir", "caption", "name_counter", "name_date", "name_time", "name_size", "name_batch", "autosave", "civitai_info",
];
const FONT = `-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif`;
const MONO = `ui-monospace,SFMono-Regular,Menlo,Consolas,monospace`;
@@ -64,6 +64,7 @@ function ensureCss() {
.ausboss-save-half{display:flex;align-items:center;gap:6px;flex:1 1 auto;min-width:0}
.ausboss-save-half .ausboss-card-seg{flex:1 1 0;min-width:0}
.ausboss-save-switches{gap:12px}
.ausboss-save-half.embed{flex-grow:1.5}
.ausboss-save-browse{position:fixed;z-index:10000;width:260px;max-height:320px;overflow:auto;padding:4px;border:1px solid #3a4047;border-radius:7px;background:#1c1f23;box-shadow:0 8px 28px rgba(0,0,0,.5);font:12px/1.3 ${FONT};color:#d8ecea}
.ausboss-save-browse-head{padding:5px 8px 6px;border-bottom:1px solid #2c3238;color:#78908e;font:10px/1 ${FONT};letter-spacing:.08em;text-transform:uppercase;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ausboss-save-browse button{display:block;width:100%;padding:6px 8px;border:none;border-radius:5px;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}
@@ -273,20 +274,31 @@ function buildCard(node) {
}
root.append(seg);
// Embed workflow: a no | yes pill, the pack's boolean.
// Embed: what goes in the file, in one pill. Off is a clean picture; On
// stores the prompt and workflow for drag-back; Civitai stores them too and
// adds the settings line civitai.com reads (save_metadata + civitai_info).
const embedRow = el("div", "ausboss-save-row");
const embedSeg = el("div", "ausboss-card-seg ausboss-card-bool");
embedSeg.setAttribute("role", "radiogroup");
const embedButtons = new Map();
const embedTitle = "Embed stores the prompt and workflow in the image for drag-back. Off writes a clean image for sharing or datasets.";
for (const [on, text] of [[false, PANEL_LABELS.off], [true, PANEL_LABELS.on]]) {
const embedChoices = [
["off", PANEL_LABELS.off, false, false, "Off writes a clean image, with no prompt or workflow inside - for sharing or datasets."],
["on", PANEL_LABELS.on, true, false, "On stores the prompt and workflow in the image, so it drags back into ComfyUI."],
["civitai", "Civitai", true, true, "Civitai stores the workflow and also the prompt, settings and model and LoRA fingerprints the way civitai.com reads them, so an upload lists its prompt and resources."],
];
for (const [key, text, embed, civitai, title] of embedChoices) {
const button = el("button", "", text);
button.type = "button"; button.title = embedTitle;
button.addEventListener("click", () => { if (setValue(node, "save_metadata", on)) notifyAusbossChange(); state.refresh(); });
embedSeg.append(button); embedButtons.set(on, button);
button.type = "button"; button.title = title;
button.addEventListener("click", () => {
const changedEmbed = setValue(node, "save_metadata", embed);
const changedCivitai = setValue(node, "civitai_info", civitai);
if (changedEmbed || changedCivitai) notifyAusbossChange();
state.refresh();
});
embedSeg.append(button); embedButtons.set(key, button);
}
const embedHalf = el("div", "ausboss-save-half");
embedHalf.append(el("span", "ausboss-save-embed-label", PANEL_LABELS.embed), embedSeg);
const embedHalf = el("div", "ausboss-save-half embed");
embedHalf.append(el("span", "ausboss-save-embed-label", "Embed"), embedSeg);
embedRow.classList.add("ausboss-save-switches");
embedRow.append(embedHalf);
root.append(embedRow);
@@ -348,10 +360,10 @@ function buildCard(node) {
chips.classList.toggle("off", !tagsEnabled(values));
for (const [key, chip] of chipButtons) chip.classList.toggle("on", Boolean(values[key]));
for (const [key, button] of formatButtons) button.classList.toggle("on", values.format === key);
const embed = Boolean(values.save_metadata);
for (const [on, button] of embedButtons) {
button.classList.toggle("on", on === embed);
button.setAttribute("aria-checked", String(on === embed));
const embed = !values.save_metadata ? "off" : values.civitai_info ? "civitai" : "on";
for (const [key, button] of embedButtons) {
button.classList.toggle("on", key === embed);
button.setAttribute("aria-checked", String(key === embed));
}
const auto = values.autosave !== false;
for (const [on, button] of autoButtons) {
+3 -3
View File
@@ -40,8 +40,8 @@ function getLoopEnabled(node) {
}
// The Preview steps switch: the hidden `step_preview` widget (the card hides it).
// On, the player shows each step of the clip's first frame while it is
// being made, and a STOP button joins the tools for the run.
// On, the player shows each step of the clip while it is being made (a few
// of its frames in a loop), and a STOP button joins the tools for the run.
function stepsOn(state) {
return state.stepsWidget?.value === true;
}
@@ -131,7 +131,7 @@ function buildPreview(node) {
loopButton.classList.add("ausboss-steps-loop");
const stopButton = makeToolButton("STOP", "Stop this run now. The next run in the queue still starts.");
stopButton.classList.add("ausboss-steps-stop");
const stepsButton = panelSwitch("Preview steps", "Show the clip's first frame here while it is being made, one step at a time, with a Stop button. Off by default.");
const stepsButton = panelSwitch("Preview steps", "Show the clip here while it is being made: after each step, a few of its frames play in a loop, with a Stop button. Off by default.");
tools.classList.add("ausboss-steps-tools");
tools.append(stopButton, loopButton);
stage.append(video, image, status, tools);
+70
View File
@@ -0,0 +1,70 @@
// App mode and the pack's cards. Pure logic, no DOM: tested under node:test.
//
// App mode is ComfyUI's simple form view of a workflow: a saved list of
// fields (extra.linearData.inputs) and a Run button. Each field is a
// widget. A node with a card or panel hides its standard widgets and shows
// its own controls instead, and App mode reads that hidden flag too, so the
// form drew an empty row for every field on such a node.
//
// While a workflow is in App mode, the widgets its form lists are shown
// again; App mode draws its own control for each. Back in the graph they are
// hidden again, so the node's face is unchanged. Only listed widgets move.
import { hideWidget, isWidgetHidden, showWidget } from "./widget_visibility.mjs";
export const APP_MODE = "app";
// "app", "graph" or "builder:..." for the open workflow.
export function workflowMode(workflow) {
return workflow?.activeMode ?? workflow?.initialMode ?? "graph";
}
// The form's fields as { nodeId, widget } pairs. A field is saved as
// [nodeId, widgetName] or [nodeId, widgetName, { description }].
export function appFields(linearData) {
const inputs = Array.isArray(linearData?.inputs) ? linearData.inputs : [];
const fields = [];
for (const entry of inputs) {
if (!Array.isArray(entry) || entry.length < 2) continue;
const [nodeId, widget] = entry;
if ((typeof nodeId !== "string" && typeof nodeId !== "number") || typeof widget !== "string") continue;
fields.push({ nodeId: String(nodeId), widget });
}
return fields;
}
// Where the form puts a DOM widget (a panel, the clip window): the empty
// host the form draws in that field's row. The form moves the widget's
// element into it once, as the row mounts, and the graph's own widget layer
// can take it back a moment later, which left the row empty. So the pack
// moves it in again (js/app_mode/). A selector, so it is testable here.
export function formHostSelector(nodeId, name) {
const id = String(nodeId).replace(/["\\]/g, "");
const field = String(name).replace(/["\\]/g, "");
return `[data-testid="app-mode-widget-item"][data-widget-key$=":${id}:${field}"] [data-widget-name="${field}"] div[node-type]`;
}
// find(nodeId, widgetName) -> { node, widget } or null
// changed(node) is called after a widget on that node changed visibility.
export function createAppModeSync({ find, changed = () => {} }) {
const lent = new Map(); // widget -> node, shown for the form
return function sync(mode, linearData) {
if (mode === APP_MODE) {
for (const { nodeId, widget: name } of appFields(linearData)) {
const found = find(nodeId, name);
if (!found?.widget || !isWidgetHidden(found.widget)) continue;
showWidget(found.widget);
// An explicit false, not a deleted flag: the frontend keeps its own
// copy of the hidden state and only hears about a written value.
if (found.widget.options) found.widget.options.hidden = false;
lent.set(found.widget, found.node);
changed(found.node);
}
return lent.size;
}
for (const [widget, node] of lent) {
if (hideWidget(widget)) changed(node);
}
lent.clear();
return 0;
};
}
+190
View File
@@ -0,0 +1,190 @@
// The maths behind the 3D viewer's Blender keys (js/viewer_keys): G moves,
// R rotates and S scales the model while the mouse moves, the way Blender
// does it. Plain arrays [x, y, z]; nothing here touches the page, so it is
// tested on its own (tests/blender_transform.test.mjs).
export const AXES = Object.freeze({ x: [1, 0, 0], y: [0, 1, 0], z: [0, 0, 1] });
export const AXIS_NAMES = Object.freeze(["x", "y", "z"]);
export const dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
export const add = (a, b) => [a[0] + b[0], a[1] + b[1], a[2] + b[2]];
export const sub = (a, b) => [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
export const times = (a, k) => [a[0] * k, a[1] * k, a[2] * k];
export const cross = (a, b) => [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
export const length = (a) => Math.hypot(a[0], a[1], a[2]);
export const unit = (a) => { const n = length(a); return n > 1e-12 ? times(a, 1 / n) : [0, 0, 0]; };
/**
* Blender's axis lock. X locks to the world's X axis, X again to the
* model's own X, a third time unlocks. Shift+X locks to the plane that
* leaves X out (move or scale along the other two), with the same cycle.
*/
export function nextConstraint(current, axis, plane = false) {
const kind = plane ? "plane" : "axis";
if (!current || current.axis !== axis || current.kind !== kind) return { kind, axis, space: "global" };
if (current.space === "global") return { kind, axis, space: "local" };
return null;
}
/** Where a ray meets a plane, as a distance along the ray; null when it runs parallel. */
export function rayPlane(origin, dir, point, normal) {
const denom = dot(dir, normal);
if (Math.abs(denom) < 1e-9) return null;
return dot(sub(point, origin), normal) / denom;
}
export const along = (origin, dir, t) => add(origin, times(dir, t));
/**
* The spot on an axis line (through `point`, along unit `axis`) nearest a
* ray, as a distance along the axis. null when the axis points along the
* ray, where every spot is as near as any other.
*/
export function closestOnAxis(origin, dir, point, axis) {
const w = sub(point, origin);
const a = dot(axis, axis);
const b = dot(axis, dir);
const c = dot(dir, dir);
const denom = a * c - b * b;
if (Math.abs(denom) < 1e-9 * a * c) return null;
return (b * dot(dir, w) - c * dot(axis, w)) / denom;
}
/** The turn from screen point `a` to `b` around `center`, counter-clockwise positive, in (-pi, pi]. Screen y points down. */
export function screenTurn(center, a, b) {
const ax = a[0] - center[0], ay = center[1] - a[1];
const bx = b[0] - center[0], by = center[1] - b[1];
if (Math.hypot(ax, ay) < 1e-6 || Math.hypot(bx, by) < 1e-6) return 0;
return Math.atan2(ax * by - ay * bx, ax * bx + ay * by);
}
/** Round to the nearest step; a step of 0 leaves the value alone. */
export const snapTo = (value, step) => (step > 0 ? Math.round(value / step) * step : value);
/**
* A typed number as Blender takes it while a move runs: digits, one point,
* and a minus anywhere that flips the sign. null while nothing usable is typed.
*/
export function parseTyped(text) {
if (typeof text !== "string") return null;
const negative = (text.match(/-/g)?.length ?? 0) % 2 === 1;
const digits = text.replace(/-/g, "");
if (!/^\d*\.?\d*$/.test(digits) || !/\d/.test(digits)) return null;
const value = Number(digits);
return Number.isFinite(value) ? (negative ? -value : value) : null;
}
/** Edit the typed text with one key: a digit, ".", "-" (flip), or Backspace. */
export function typeKey(text, key) {
if (key === "Backspace") return text.slice(0, -1);
if (key === "-") return text.startsWith("-") ? text.slice(1) : `-${text}`;
if (key === ".") return text.includes(".") ? text : `${text}.`;
if (/^\d$/.test(key)) return text + key;
return text;
}
/** How fine Ctrl snapping is: Shift makes it ten times finer, as in Blender. */
export function snapStep(mode, precise) {
if (mode === "rotate") return precise ? 1 : 5; // degrees
return precise ? 0.01 : 0.1; // world units, or scale factor
}
/**
* The model's own axis that lies closest to a world axis, for scaling along
* a world axis: scale belongs to the model's own axes, so a turned model
* is scaled along the one that points most that way.
* `localAxes` are the model's three axes in world space.
*/
export function nearestLocalAxis(localAxes, worldAxis) {
let best = 0;
let score = -1;
localAxes.forEach((axis, i) => {
const s = Math.abs(dot(unit(axis), worldAxis));
if (s > score) { score = s; best = i; }
});
return best;
}
/** The scale factors on the model's own axes for a scale of `factor` under a lock. */
export function scaleFactors(factor, constraint, lockedIndex) {
if (!constraint) return [factor, factor, factor];
return [0, 1, 2].map((i) => {
const on = constraint.kind === "axis" ? i === lockedIndex : i !== lockedIndex;
return on ? factor : 1;
});
}
/** How far (screen px) the mouse must travel before the middle button picks an axis. */
export const PICK_PX = 8;
/**
* The mouse move that picks the axis for Blender's middle-button lock: the
* move since the middle button went down once it is long enough (hold and
* slide along an axis), else the move since G, R or S began (move, then
* click the middle button). null while neither is long enough; then a click
* waits for the mouse to move and picks from that.
*/
export function pickVector(start, press, now, min = PICK_PX) {
if (press) {
const held = [now[0] - press[0], now[1] - press[1]];
if (Math.hypot(held[0], held[1]) >= min) return held;
}
const whole = [now[0] - start[0], now[1] - start[1]];
return Math.hypot(whole[0], whole[1]) >= min ? whole : null;
}
/**
* Of the axes as drawn on screen (2D directions, any length), the one a
* mouse move runs most nearly along: Blender picks the axis line nearest
* the mouse's move. Axes shorter than `minLength` on screen (pointing at
* the camera) are left out; -1 when none is left or the move is empty.
*/
export function nearestScreenAxis(move, screenAxes, minLength = 1e-3) {
if (!move || Math.hypot(move[0], move[1]) < 1e-9) return -1;
let best = -1;
let score = Infinity;
screenAxes.forEach((d, i) => {
const n = Math.hypot(d[0], d[1]);
if (!(n >= minLength)) return;
// The move's distance from the axis line through the start.
const off = Math.abs(move[0] * d[1] - move[1] * d[0]) / n;
if (off < score - 1e-9) { score = off; best = i; }
});
return best;
}
/** The lock the middle button gives for the picked axis (Shift: the plane without it). */
export const autoConstraint = (axis, plane = false) => ({ kind: plane ? "plane" : "axis", axis, space: "global" });
/** Words for the lock, for the header line. */
export function constraintLabel(constraint) {
if (!constraint) return "";
const name = constraint.axis.toUpperCase();
const where = constraint.space === "local" ? "local" : "global";
if (constraint.kind === "plane") {
const others = AXIS_NAMES.filter((a) => a !== constraint.axis).map((a) => a.toUpperCase()).join("");
return `on ${where} ${others}`;
}
return `along ${where} ${name}`;
}
const num = (v, digits = 3) => (Math.abs(v) < 5e-7 ? 0 : v).toFixed(digits);
/**
* The amount in Blender's header words, without the lock: "D: 0.500 (0.500)"
* along a locked axis (`along` is the signed distance on it), "Dx: .. Dy: ..
* Dz: .. (length)" otherwise, "Rot: 45.0°", "Scale: 1.200" or "Scale X: ..
* Y: .. Z: ..". `value` is the move [x, y, z], the degrees, the factor, or
* [dx, dy] degrees for the trackball.
*/
export function readout(mode, value, constraint = null, along = null) {
if (mode === "grab") {
const size = num(length(value));
if (constraint?.kind === "axis" && along != null) return `D: ${num(along)} (${size})`;
return `Dx: ${num(value[0])} Dy: ${num(value[1])} Dz: ${num(value[2])} (${size})`;
}
if (mode === "trackball") return `Trackball: ${num(value[0], 1)}° ${num(value[1], 1)}°`;
if (mode === "rotate") return `Rot: ${num(value, 1)}°`;
if (constraint) return `Scale: ${num(value)}`;
return `Scale X: ${num(value)} Y: ${num(value)} Z: ${num(value)}`;
}
+83
View File
@@ -289,3 +289,86 @@ export function repointLinks(text, nodes, groups) {
.replace(ARROW_RE, (all, _arrow, id) => (id === undefined ? all : `${all.slice(0, -id.length - 1)}${follow(`#${id}`)}`));
return changed ? next : null;
}
// Info card: a small card with a title, rows and small print, chosen from the
// note's menu. Its text is the note's ordinary text with one addition: a line
// with a | in it is a row, the words before it on the left and the rest on
// the right. A row in **bold** is the one to notice and is drawn in teal. The
// first line is the card's title; a clock, info, warning, bulb or tick emoji
// at its start is drawn as a small icon. A plain callout reads none of this,
// so every note written before looks as it did, and a release before this
// one shows the card as a plain note with its rows written out.
const CARD_ICONS = new Map([
["⏱", "clock"], ["⏲", "clock"], ["⏰", "clock"], ["\u{1F552}", "clock"], ["⌛", "clock"], ["⏳", "clock"],
["ℹ", "info"], ["⚠", "warning"], ["\u{1F4A1}", "tip"], ["✅", "check"], ["✔", "check"],
]);
const CARD_ICON_RE = new RegExp(`^(${[...CARD_ICONS.keys()].join("|")})${VS16}?\\s*`, "u");
export const CARD_TEMPLATE = [
"ℹ️ Title",
`${SMALL_MARK}A line of small print under the title.`,
"",
"Label | value",
"**The one to notice | value**",
"",
`${SMALL_MARK}A note at the bottom.`,
].join("\n");
// Where a row splits: the first | that is not inside a link, or -1.
function cellSplit(line) {
const masked = line.replace(WORDS_LINK_RE, (all) => " ".repeat(all.length));
return masked.indexOf("|");
}
// A row's two sides, or null when the line is not a row. The outer pipes of
// a pasted Markdown table row are dropped.
export function cardCells(line) {
const bare = String(line ?? "").trim().replace(/^\|/, "").replace(/\|$/, "");
const at = cellSplit(bare);
if (at < 0) return null;
let label = bare.slice(0, at).trim();
let value = bare.slice(at + 1).trim();
if (!label || !value) return null;
// **label | value** marks the whole row.
if (label.startsWith("**") && !label.slice(2).includes("**") && value.endsWith("**") && !value.slice(0, -2).includes("**")) {
label = `${label}**`;
value = `**${value}`;
}
return [label, value];
}
// Text -> blocks of lines. A line is { kind: "title", icon, pieces },
// { kind: "row", cells: [pieces, pieces], highlight } or { kind: "text",
// pieces }; small print carries `small: true`. A Markdown table's ---|---
// line is dropped.
export function parseCard(text) {
const blocks = [];
let lines = [];
let first = true;
const flush = () => {
if (lines.length) blocks.push(lines);
lines = [];
};
for (const raw of String(text ?? "").replace(/\r\n?/g, "\n").split("\n")) {
const line = raw.replace(HEADING_RE, "").trim();
if (!line) { flush(); continue; }
if (/^\|?[\s:|-]*-[\s:|-]*\|?$/.test(line) && line.includes("|")) continue;
const small = SMALL_RE.test(raw);
const cells = cardCells(line);
let item;
if (first && !small && !cells) {
const icon = CARD_ICON_RE.exec(line);
item = { kind: "title", icon: icon ? CARD_ICONS.get(icon[1]) : null, pieces: pieces(icon ? line.slice(icon[0].length) : line) };
} else if (cells) {
const sides = cells.map((cell) => pieces(cell));
const shown = sides.flat().filter((piece) => piece.arrow || piece.text?.trim());
item = { kind: "row", cells: sides, highlight: shown.length > 0 && shown.every((piece) => piece.bold) };
} else {
item = { kind: "text", pieces: pieces(line) };
}
first = false;
if (small) item.small = true;
lines.push(item);
}
flush();
return blocks;
}
+19 -4
View File
@@ -9,7 +9,9 @@
// in js/canvas_passthrough/ wires them to the page.
// The wheel belongs to the panel while it can still scroll that way (a long
// text box, a list of rows), or while a text field has the keyboard.
// text box, a list of rows). A text box with the cursor in it is no
// exception: when it has nothing left to scroll, the wheel zooms the graph,
// as it does over ComfyUI's own text boxes.
export function canScrollFurther(element, delta, axis = "y") {
if (!element || !delta) return false;
const horizontal = axis === "x";
@@ -25,10 +27,11 @@ export function canScrollFurther(element, delta, axis = "y") {
// and the panel's own root? `styleOf` is getComputedStyle, passed in so this
// stays testable without a page. `host` is the frontend's wrapper around the
// panel: a pointer on the wrapper itself is on nothing inside the panel.
export function panelKeepsWheel(target, event, { root, host, styleOf, activeElement }) {
// Ctrl + wheel, which is also how a trackpad pinch arrives, always zooms the
// graph; left to a scrolling box it would zoom the whole page.
export function panelKeepsWheel(target, event, { root, host, styleOf }) {
if (event.ctrlKey || event.metaKey) return false;
for (let element = target; element && element !== root && element !== host; element = element.parentElement) {
const tag = String(element.tagName ?? "").toUpperCase();
if ((tag === "TEXTAREA" || tag === "INPUT") && element === activeElement) return true;
const style = styleOf(element);
const overflow = style?.overflowY;
if ((overflow === "auto" || overflow === "scroll") && canScrollFurther(element, event.deltaY)) return true;
@@ -38,6 +41,18 @@ export function panelKeepsWheel(target, event, { root, host, styleOf, activeElem
return false;
}
// Nodes 2.0 hands every wheel turn over a node to the graph on its way down
// to the node, before any part of the node sees it (only a focused core text
// box is spared). A box of the pack's that can still scroll the way the wheel
// turns has to claim the wheel before that. The classic renderer lets the box
// see the wheel first, so there it needs no claim.
export function vueBoxKeepsWheel(target, event, { styleOf }) {
if (!target?.closest?.(".lg-node-widgets")) return false;
const root = panelRoot(target);
if (!root) return false;
return panelKeepsWheel(target, event, { root, host: panelHost(target), styleOf });
}
// Gestures that start over a panel and still mean "move the graph": the
// middle button (pan), and Ctrl + Shift + left button (drag-zoom) when the
// user has that shortcut switched on.
+116
View File
@@ -104,3 +104,119 @@ export function isCivitaiAddress(url) {
return false;
}
}
// ---------- fetch all ----------
// One button runs the same one-file lookup for every LoRA in a stack that has
// no Civitai info yet: one file at a time, with a pause between files so
// Civitai is not asked too fast. Nothing here talks to the network itself;
// the caller hands in the lookup.
// The pause between two lookups, and the longer one after Civitai answers
// 429 ("too many requests"). A second 429 ends the run.
export const QUEUE_PAUSE_MS = 1500;
export const SLOW_DOWN_PAUSE_MS = 20000;
// This many failures in a row ends the run: something is wrong for all files.
export const MAX_FAILURES_IN_A_ROW = 3;
// `names`: the stack's LoRA names (repeats and blanks are dropped).
// `needsLookup(name)`: true when the file has no Civitai info yet; an error
// means the file is missing, and it is left out.
// `lookUp(name)`: false when Civitai does not know the file, else
// `{ picture }` ("saved" when a picture was saved). An error with
// `status: 429` means slow down; a TypeError means Civitai cannot be reached.
// `wait(ms)`: a pause; it may end early once `shouldStop()` is true.
// `onProgress({ done, total, name })`: total is null while files are checked.
export async function runCivitaiQueue(names, {
needsLookup, lookUp, wait, shouldStop = () => false, onProgress = () => {},
pauseMs = QUEUE_PAUSE_MS, slowDownMs = SLOW_DOWN_PAUSE_MS,
}) {
const result = {
total: 0, done: 0, found: 0, pictures: 0, notFound: 0, failed: 0,
alreadyHad: 0, missing: 0, stopped: null, error: null,
};
const unique = [...new Set((names ?? []).filter((name) => typeof name === "string" && name))];
const todo = [];
onProgress({ done: 0, total: null, name: null });
for (const name of unique) {
if (shouldStop()) { result.stopped = "you"; return result; }
try {
if (await needsLookup(name)) todo.push(name);
else result.alreadyHad += 1;
} catch {
result.missing += 1;
}
}
result.total = todo.length;
onProgress({ done: 0, total: result.total, name: null });
let failuresInRow = 0;
for (const name of todo) {
if (result.done > 0) await wait(pauseMs);
if (shouldStop()) { result.stopped = "you"; return result; }
let slowedDown = false;
for (;;) {
try {
const answer = await lookUp(name);
if (answer) {
result.found += 1;
if (answer.picture === "saved") result.pictures += 1;
} else {
result.notFound += 1;
}
failuresInRow = 0;
break;
} catch (error) {
if (error?.status === 429 && !slowedDown) {
slowedDown = true;
await wait(slowDownMs);
if (shouldStop()) { result.stopped = "you"; return result; }
continue;
}
result.error = error;
if (error?.status === 429) { result.stopped = "slow down"; return result; }
if (error instanceof TypeError) { result.stopped = "unreachable"; return result; }
result.failed += 1;
failuresInRow += 1;
break;
}
}
result.done += 1;
onProgress({ done: result.done, total: result.total, name });
if (failuresInRow >= MAX_FAILURES_IN_A_ROW) { result.stopped = "failures"; return result; }
}
return result;
}
// The run's button while it works: where it is, and that a click stops it.
export function civitaiQueueLabel(done, total) {
return total == null ? "Civitai: checking · Stop" : `Civitai ${done} / ${total} · Stop`;
}
const plural = (count, word) => `${count} ${word}${count === 1 ? "" : "s"}`;
// What the run did, in one or two plain sentences for the closing message.
export function civitaiQueueSummary(result) {
if (!result.total && !result.stopped) {
if (result.alreadyHad && !result.missing) return "Every LoRA in this stack already has its Civitai info.";
if (!result.alreadyHad && !result.missing) return "This stack has no LoRAs to look up.";
}
const parts = [];
if (result.found) {
parts.push(`found ${plural(result.found, "LoRA")}`
+ (result.pictures ? ` (${plural(result.pictures, "new picture")})` : ""));
}
if (result.notFound) parts.push(`${result.notFound} not on Civitai`);
if (result.failed) parts.push(`${result.failed} failed`);
if (result.alreadyHad) parts.push(`${result.alreadyHad} already had info`);
if (result.missing) parts.push(`${plural(result.missing, "file")} not found on disk`);
let text = parts.length ? `Civitai: ${parts.join(", ")}.` : "Civitai: nothing fetched.";
const left = result.total - result.done;
if (result.stopped === "you") text += ` Stopped with ${left} left.`;
else if (result.stopped === "slow down") {
text += ` Civitai asked us to slow down, so it stopped with ${left} left. Try again in a few minutes.`;
} else if (result.stopped === "unreachable") text += ` ${civitaiFailureText(result.error)}`;
else if (result.failed && !result.stopped) text += ` Last failure: ${civitaiFailureText(result.error)}`;
else if (result.stopped === "failures") {
text += ` Stopped after ${MAX_FAILURES_IN_A_ROW} failures in a row: ${civitaiFailureText(result.error)}`;
}
return text;
}
+64 -16
View File
@@ -1,30 +1,78 @@
// Read only literal numeric sources. Calculated inputs must remain unknown
// until execution; never evaluate an arbitrary upstream graph for a label.
export function inputNumber(node, name, fallback) {
const input = node.inputs?.find((slot) => slot.name === name || slot.widget?.name === name);
if (input?.link == null) return fallback;
const graph = node.graph;
let linkId = input.link;
// A subgraph's output that comes straight from a literal inside it (Person
// Swap's "Pick the model files" hands out its video fps that way) counts as
// that literal: it is still a typed number, not a calculation.
function tableLink(graph, id) {
if (id == null || !graph) return null;
return graph.getLink?.(id) ?? graph.links?.get?.(id) ?? graph.links?.[id] ?? graph._links?.get?.(id) ?? null;
}
// The link into one of a node's inputs: the frontend's own accessor first
// (newer frontends warn on reading input.link), the link table after it.
// undefined when nothing is connected.
function linkInto(node, index, graph) {
if (typeof node?.getInputLink === "function" && node.graph) {
try {
return node.getInputLink(index) ?? undefined;
} catch {
return undefined;
}
}
const id = node?.inputs?.[index]?.link;
return id == null ? undefined : tableLink(node.graph ?? graph, id);
}
// Where a linked input really comes from: the node and output slot at the
// far end, through Reroutes and into a subgraph whose output is wired
// straight to a node inside it. null for a muted or bypassed source, a loop,
// or a subgraph output with nothing behind it. undefined when the input is
// not linked at all.
export function linkOrigin(node, name) {
const index = node?.inputs?.findIndex((slot) => slot?.name === name || slot?.widget?.name === name) ?? -1;
if (index < 0) return undefined;
let graph = node.graph;
let link = linkInto(node, index, graph);
if (link === undefined) return undefined;
const seen = new Set();
for (let depth = 0; depth < 16; depth++) {
if (seen.has(linkId)) return null;
seen.add(linkId);
const link = graph?.links?.[linkId] ?? graph?._links?.get?.(linkId);
const source = graph?.getNodeById?.(link?.origin_id);
if (!link || seen.has(link)) return null;
seen.add(link);
const source = graph?.getNodeById?.(link.origin_id);
if (!source || (source.mode ?? 0) !== 0) return null;
if (source.type === "Reroute") {
linkId = source.inputs?.[0]?.link;
if (linkId == null) return null;
if ((source.comfyClass ?? source.type) === "Reroute") {
link = linkInto(source, 0, graph) ?? null;
continue;
}
if (!["PrimitiveFloat", "PrimitiveInt", "AUSBOSS_NODES_Integer", "AUSBOSS_NODES_Float"].includes(source.type) || link.origin_slot !== 0) return null;
if (source.inputs?.some((slot) => slot.name === "value" && slot.link != null)) return null;
const value = source.widgets?.find((widget) => widget.name === "value")?.value;
return typeof value === "number" && Number.isFinite(value) ? value : null;
const inner = source.subgraph;
if (inner && typeof source.isSubgraphNode === "function" && source.isSubgraphNode()) {
link = tableLink(inner, inner.outputs?.[link.origin_slot]?.linkIds?.[0]);
graph = inner;
continue;
}
return { node: source, slot: link.origin_slot };
}
return null;
}
const LITERALS = ["PrimitiveFloat", "PrimitiveInt", "AUSBOSS_NODES_Integer", "AUSBOSS_NODES_Float"];
export function inputNumber(node, name, fallback) {
const origin = linkOrigin(node, name);
if (origin === undefined) return fallback;
if (!origin) return null;
const { node: source, slot } = origin;
// ComfyUI's older Primitive node holds the value of the widget it feeds.
if ((source.comfyClass ?? source.type) === "PrimitiveNode") {
const value = source.widgets?.[0]?.value;
return typeof value === "number" && Number.isFinite(value) ? value : null;
}
if (!LITERALS.includes(source.type) || slot !== 0) return null;
if (source.inputs?.some((input) => input.name === "value" && input.link != null)) return null;
const value = source.widgets?.find((widget) => widget.name === "value")?.value;
return typeof value === "number" && Number.isFinite(value) ? value : null;
}
export function clipOutputRate(node, sourceFps, everyNth = 1) {
const forced = inputNumber(node, "force_rate", 0);
const nth = inputNumber(node, "every_nth", everyNth);
+433
View File
@@ -0,0 +1,433 @@
// The clip window: the part of the video a run uses, as one box on a strip
// of pictures from the video, under a player that plays only that part on a
// loop. Drag the box to pick where the clip starts; drag an edge to make it
// shorter or longer, never past min_seconds / max_seconds. While a drag is
// live the player shows the frame under the edge being moved. Made for an App-mode form, where it is the only control a
// person sees for the clip node: the node keeps it hidden on the graph and
// js/app_mode/ lends it to the form when the form lists it.
//
// It reads and writes the node's own values (start_seconds, max_frames,
// end_seconds), the way the node's timeline does, so both always agree. The
// arithmetic lives in timeline_math.mjs (clipWindowOf, dragClipWindow).
import { THEME, FONT_UI, RADIUS_CONTROL } from "./theme.mjs";
import { formatTimecode } from "./timecode.mjs";
import {
clipInfo,
clipWindowOf,
clipWindowValues,
dragClipWindow,
lengthLimits,
limitFrameRange,
loopPlayhead,
} from "./timeline_math.mjs";
const CSS_ID = "ausboss-clip-window-css-v2";
const EDGE_HIT_PX = 14;
const STRIP_HEIGHT = 58;
const PLAYER_MAX_HEIGHT = 240;
// Inputs that, when connected, set the clip on the graph instead.
const GRAPH_SET = ["start_seconds", "start_frame", "end_frame", "end_seconds", "fixed_frames", "frame_load_cap", "max_frames", "every_nth"];
function installCss() {
if (document.getElementById(CSS_ID)) return;
const style = document.createElement("style");
style.id = CSS_ID;
style.textContent = `
.ausboss-clip-window{display:flex;flex-direction:column;gap:6px;box-sizing:border-box;width:100%;min-width:0;overflow:hidden;padding:2px 0 4px;color:${THEME.inkSoft};font:13px ${FONT_UI}}
.ausboss-clip-window-head{display:flex;align-items:baseline;gap:6px;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:${THEME.label}}
.ausboss-clip-window-head b{color:${THEME.ink};font-weight:600}
.ausboss-clip-window-strip{position:relative;height:${STRIP_HEIGHT}px;margin:0 9px;border-radius:${RADIUS_CONTROL}px;background:${THEME.well};touch-action:none;user-select:none;cursor:pointer}
.ausboss-clip-window-strip.is-off{cursor:default}
.ausboss-clip-window-thumbs{position:absolute;inset:0;width:100%;height:100%;border-radius:${RADIUS_CONTROL}px;pointer-events:none}
.ausboss-clip-window-shade{position:absolute;top:0;bottom:0;background:rgba(8,9,10,.68);pointer-events:none}
.ausboss-clip-window-box{position:absolute;top:-3px;bottom:-3px;box-sizing:border-box;border:3px solid ${THEME.brand};border-radius:${RADIUS_CONTROL}px;cursor:grab;outline:none}
.ausboss-clip-window-box:focus-visible{box-shadow:0 0 0 2px ${THEME.ink}}
.ausboss-clip-window-strip.is-moving .ausboss-clip-window-box{cursor:grabbing}
.ausboss-clip-window-box[hidden]{display:none}
.ausboss-clip-window-edge{position:absolute;top:50%;width:9px;height:26px;margin-top:-13px;border-radius:3px;background:${THEME.brand};cursor:ew-resize}
.ausboss-clip-window-edge.start{left:-6px}
.ausboss-clip-window-edge.end{right:-6px}
.ausboss-clip-window-box.is-whole{cursor:default}
.ausboss-clip-window-box.is-whole .ausboss-clip-window-edge{display:none}
.ausboss-clip-window-empty{position:absolute;inset:0;display:grid;place-items:center;color:${THEME.faint};pointer-events:none}
.ausboss-clip-window-empty[hidden],.ausboss-clip-window-shade[hidden]{display:none}
.ausboss-clip-window-readout{color:${THEME.brandInk};font-weight:600;font-size:14px;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ausboss-clip-window-hint{color:${THEME.faint};font-size:12px;line-height:1.4}
.ausboss-clip-window-hint.is-stop{color:${THEME.warnInk}}
.ausboss-clip-window-player{position:relative;width:100%;max-height:${PLAYER_MAX_HEIGHT}px;aspect-ratio:16/9;margin:0 auto;border-radius:${RADIUS_CONTROL}px;background:${THEME.well};overflow:hidden;cursor:pointer}
.ausboss-clip-window-player[hidden]{display:none}
.ausboss-clip-window-player video{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;pointer-events:none}
.ausboss-clip-window-play{position:absolute;left:50%;top:50%;width:46px;height:46px;margin:-23px 0 0 -23px;border-radius:50%;background:rgba(8,9,10,.62);pointer-events:none;opacity:0;transition:opacity .15s}
.ausboss-clip-window-play::after{content:"";position:absolute;left:18px;top:14px;border-style:solid;border-width:9px 0 9px 14px;border-color:transparent transparent transparent ${THEME.ink}}
.ausboss-clip-window-player.is-paused .ausboss-clip-window-play{opacity:1}
.ausboss-clip-window-playhead{position:absolute;top:0;bottom:0;width:2px;margin-left:-1px;background:${THEME.ink};box-shadow:0 0 0 1px rgba(8,9,10,.5);pointer-events:none}
.ausboss-clip-window-playhead[hidden]{display:none}
`;
document.head.append(style);
}
function el(tag, className = "", text = "") {
const item = document.createElement(tag);
if (className) item.className = className;
if (text) item.textContent = text;
return item;
}
const secondsText = (value) => String(Number((Number(value) || 0).toFixed(1)));
// A length in the readout keeps its tenth: "8.0 s used".
const lengthText = (value) => (Number(value) || 0).toFixed(1);
// options:
// get(name, fallback) / set(name, value) widget access
// driven(name) whether an input is linked
// number(name, fallback) a linked literal's value, null when only the run knows it
// outputRate() output fps, null when unknown
// metadata() the source's {fps, frame_count, duration}
// storyboard() {image, times, tileWidth, tileHeight} or null
// videoUrl() the source video for the player, "" for none
// onCommit() a drag settled (undo point)
export function mountClipWindow({ get, set, driven = () => false, number = (name, fallback) => get(name, fallback), outputRate = () => null, metadata, storyboard = () => null, videoUrl = () => "", onCommit }) {
installCss();
const root = el("div", "ausboss-clip-window");
const head = el("div", "ausboss-clip-window-head");
const strip = el("div", "ausboss-clip-window-strip");
const thumbs = el("canvas", "ausboss-clip-window-thumbs");
const shadeLeft = el("div", "ausboss-clip-window-shade");
const shadeRight = el("div", "ausboss-clip-window-shade");
const box = el("div", "ausboss-clip-window-box");
box.tabIndex = 0;
box.setAttribute("role", "slider");
box.setAttribute("aria-label", "Part of the video to use");
const edgeStart = el("span", "ausboss-clip-window-edge start");
const edgeEnd = el("span", "ausboss-clip-window-edge end");
box.append(edgeStart, edgeEnd);
const empty = el("div", "ausboss-clip-window-empty", "Choose a video first");
const playhead = el("div", "ausboss-clip-window-playhead");
playhead.hidden = true;
strip.append(thumbs, shadeLeft, shadeRight, box, playhead, empty);
const readout = el("div", "ausboss-clip-window-readout");
const hint = el("div", "ausboss-clip-window-hint");
// The player: muted, plays the picked part on a loop, a click pauses it.
const player = el("div", "ausboss-clip-window-player is-paused");
player.hidden = true;
player.title = "Click to play or pause";
const video = document.createElement("video");
video.muted = true;
video.playsInline = true;
video.preload = "auto";
video.disablePictureInPicture = true;
player.append(video, el("span", "ausboss-clip-window-play"));
root.append(player, head, strip, readout, hint);
const info = () => clipInfo(metadata());
const limits = () => lengthLimits(number("min_seconds", get("min_seconds", 0)) ?? 0, number("max_seconds", get("max_seconds", 0)) ?? 0);
const nth = () => Math.max(1, Math.trunc(Number(get("every_nth", 1)) || 1));
const rate = () => {
const known = outputRate?.();
if (known > 0) return known;
const clip = info();
return clip.fps > 0 ? clip.fps / nth() : 0;
};
// The clip is set on the graph (a connected input, or an exact Fixed
// frames count): the window shows nothing it cannot honour.
const setOnGraph = () => GRAPH_SET.some((name) => driven(name)) || Number(get("fixed_frames", 0)) > 0;
const current = () => clipWindowOf(info(), {
start: get("start_seconds", 0),
end: get("end_seconds", 0),
cap: get("max_frames", 0),
rate: rate(),
}, limits());
const rangeWords = () => {
const { min, max } = limits();
if (min > 0 && max > 0) return min === max ? `${secondsText(min)} s` : `${secondsText(min)} to ${secondsText(max)} s`;
if (max > 0) return `up to ${secondsText(max)} s`;
if (min > 0) return `at least ${secondsText(min)} s`;
return "";
};
let stopText = "";
let thumbsKey = "";
const drawThumbs = () => {
const clip = info();
const board = storyboard?.();
const width = Math.round(strip.clientWidth);
const height = Math.round(strip.clientHeight);
const key = `${width}x${height}:${board?.image?.src?.length ?? 0}:${board?.times?.length ?? 0}:${clip.duration}`;
if (key === thumbsKey) return;
thumbsKey = key;
const scale = Math.min(2, window.devicePixelRatio || 1);
thumbs.width = Math.max(1, Math.round(width * scale));
thumbs.height = Math.max(1, Math.round(height * scale));
const context = thumbs.getContext("2d");
if (!context) return;
context.clearRect(0, 0, thumbs.width, thumbs.height);
if (!board?.image || !board.times?.length || !(clip.duration > 0) || !width) return;
// Cells as wide as a tile drawn at the strip's height, each showing the
// tile nearest its middle.
const cellWidth = Math.max(24, (board.tileWidth / board.tileHeight) * height);
const cells = Math.max(1, Math.ceil(width / cellWidth));
const cell = thumbs.width / cells;
for (let index = 0; index < cells; index++) {
const moment = ((index + 0.5) / cells) * clip.duration;
let tile = 0;
for (let other = 1; other < board.times.length; other++) {
if (Math.abs(board.times[other] - moment) < Math.abs(board.times[tile] - moment)) tile = other;
}
// Cover the cell: crop the tile's sides to the cell's shape.
const sourceWidth = Math.min(board.tileWidth, (cell / thumbs.height) * board.tileHeight);
const sourceX = tile * board.tileWidth + (board.tileWidth - sourceWidth) / 2;
context.drawImage(board.image, sourceX, 0, sourceWidth, board.tileHeight, Math.floor(index * cell), 0, Math.ceil(cell), thumbs.height);
}
};
const sync = () => {
const clip = info();
const window = clip.count ? current() : null;
const off = !window || setOnGraph();
strip.classList.toggle("is-off", off);
empty.hidden = Boolean(window);
box.hidden = !window;
shadeLeft.hidden = shadeRight.hidden = !window;
const range = rangeWords();
if (!clip.count) {
head.textContent = "";
readout.textContent = "";
hint.textContent = range ? `The clip will be ${range} long.` : "";
hint.classList.remove("is-stop");
thumbsKey = "";
drawThumbs();
syncPlayer();
return;
}
head.replaceChildren(el("b", "", `Your video: ${secondsText(clip.duration)} s long`));
if (range) head.append(document.createTextNode(`· the clip is ${range} long`));
if (!window) {
readout.textContent = "";
hint.textContent = "The clip length is known once the graph runs.";
syncPlayer();
return;
}
const duration = clip.duration || clip.count / clip.fps;
const left = Math.max(0, Math.min(1, window.start / duration));
const right = Math.max(left, Math.min(1, (window.start + window.seconds) / duration));
box.style.left = `${(left * 100).toFixed(3)}%`;
box.style.width = `${((right - left) * 100).toFixed(3)}%`;
shadeLeft.style.left = "0";
shadeLeft.style.width = `${(left * 100).toFixed(3)}%`;
shadeRight.style.left = `${(right * 100).toFixed(3)}%`;
shadeRight.style.right = "0";
box.classList.toggle("is-whole", window.whole || off);
box.setAttribute("aria-valuemin", "0");
box.setAttribute("aria-valuemax", String(Number(duration.toFixed(2))));
box.setAttribute("aria-valuenow", String(Number(window.start.toFixed(2))));
box.setAttribute("aria-valuetext", `${secondsText(window.seconds)} seconds from ${formatTimecode(window.start)}`);
readout.textContent = window.whole
? `The whole video is used: ${lengthText(window.seconds)} s`
: `${lengthText(window.seconds)} s used, starting at ${formatTimecode(Math.round(window.start * 10) / 10)}`;
hint.classList.toggle("is-stop", Boolean(stopText));
if (off) hint.textContent = "This clip is set on the graph, so it cannot be moved here.";
else if (window.whole) hint.textContent = `The video is shorter than ${secondsText(limits().min)} s, so all of it is used.`;
else if (stopText) hint.textContent = stopText;
else hint.textContent = range
? `Drag the box to pick where it starts. Drag an edge to shorten it, never under ${secondsText(limits().min || 0)} s or over ${secondsText(limits().max || duration)} s.`
: "Drag the box to pick where it starts. Drag an edge to change its length.";
drawThumbs();
syncPlayer();
};
// --- player ---------------------------------------------------------------
let playerUrl = "";
let wantPlay = true; // the person's play/pause choice; a drag only pauses for its length
let onScreen = false;
let frameRequest = 0;
const playable = () => Boolean(playerUrl) && !player.hidden;
const showPlayhead = () => {
const clip = info();
const duration = clip.duration || (clip.fps ? clip.count / clip.fps : 0);
playhead.hidden = !playable() || !(duration > 0) || !(video.readyState >= 1);
if (!playhead.hidden) playhead.style.left = `${(Math.max(0, Math.min(1, video.currentTime / duration)) * 100).toFixed(3)}%`;
};
const seek = (seconds) => {
if (!(video.readyState >= 1) || !Number.isFinite(seconds)) return;
if (Math.abs(video.currentTime - seconds) > 0.01) video.currentTime = Math.max(0, seconds);
showPlayhead();
};
// Keeps the playhead inside the picked part while it plays.
const tick = () => {
frameRequest = 0;
if (video.paused || !onScreen) return;
const window = info().count ? current() : null;
if (window && !drag) {
const next = loopPlayhead(video.currentTime, window.start, window.seconds);
if (next !== video.currentTime) video.currentTime = next;
}
showPlayhead();
frameRequest = requestAnimationFrame(tick);
};
const play = () => {
if (!playable() || !onScreen || drag || !wantPlay) return;
const window = info().count ? current() : null;
if (window) seek(loopPlayhead(video.currentTime, window.start, window.seconds));
video.play().catch(() => { /* not ready or not allowed: stays paused */ });
};
const pause = () => { if (!video.paused) video.pause(); };
video.addEventListener("play", () => { player.classList.remove("is-paused"); if (!frameRequest) frameRequest = requestAnimationFrame(tick); });
video.addEventListener("pause", () => player.classList.add("is-paused"));
video.addEventListener("loadedmetadata", () => {
if (video.videoWidth > 0 && video.videoHeight > 0) player.style.aspectRatio = `${video.videoWidth} / ${video.videoHeight}`;
const window = info().count ? current() : null;
if (window) seek(window.start);
play();
});
// A file the browser cannot play: no player, the strip still works.
video.addEventListener("error", () => { player.hidden = true; playhead.hidden = true; });
player.addEventListener("pointerdown", (event) => {
if (event.button !== 0) return;
event.preventDefault();
event.stopPropagation();
wantPlay = video.paused;
if (wantPlay) play(); else pause();
});
// Plays only while it can be seen: hidden on the graph, it stays still.
new IntersectionObserver((entries) => {
onScreen = entries.some((entry) => entry.isIntersecting);
if (onScreen) play(); else pause();
}).observe(player);
const syncPlayer = () => {
const url = info().count ? String(videoUrl?.() || "") : "";
if (url !== playerUrl) {
playerUrl = url;
player.hidden = !url;
playhead.hidden = true;
if (url) { video.src = url; video.load(); } else { video.removeAttribute("src"); video.load(); }
}
if (!playable()) return;
const window = info().count ? current() : null;
if (window && !drag && !video.paused) {
const next = loopPlayhead(video.currentTime, window.start, window.seconds);
if (next !== video.currentTime) seek(next);
}
showPlayhead();
};
const store = (window) => {
const values = clipWindowValues(window, info());
if (!driven("fixed_frames") && Number(get("fixed_frames", 0)) !== 0) set("fixed_frames", 0);
set("start_seconds", values.start_seconds);
set("end_seconds", values.end_seconds);
set("max_frames", values.max_frames);
};
// Why a drag stopped short of the pointer, in words.
const stopWords = (zone, wanted, got) => {
if (zone === "move" || Math.abs(wanted - got) < 0.5 / Math.max(1, rate())) return "";
const range = limitFrameRange(limits(), rate());
const frames = Math.round(got * rate());
if (frames >= range.max) return `${secondsText(got)} s is the longest it can be.`;
if (frames <= range.min) return `${secondsText(got)} s is the shortest it can be.`;
return "The video ends there.";
};
// --- gestures ---------------------------------------------------------------
let drag = null;
const secondsAt = (event) => {
const rect = strip.getBoundingClientRect();
const clip = info();
const duration = clip.duration || (clip.fps ? clip.count / clip.fps : 0);
const x = Math.max(0, Math.min(rect.width, event.clientX - rect.left));
return { seconds: rect.width > 0 ? (x / rect.width) * duration : 0, x, width: rect.width, duration };
};
const apply = (event, settled) => {
if (!drag) return;
const { seconds } = secondsAt(event);
const target = drag.zone === "move" ? seconds - drag.grab : seconds;
const next = dragClipWindow(drag.base, drag.zone, target, info(), limits());
if (!next) return;
const wantedLength = drag.zone === "end" ? seconds - drag.base.start
: drag.zone === "start" ? drag.base.start + drag.base.seconds - seconds : next.seconds;
stopText = stopWords(drag.zone, wantedLength, next.seconds);
store(next);
sync();
if (playable()) seek(settled || drag.zone !== "end" ? next.start : Math.max(next.start, next.start + next.seconds - 1 / Math.max(1, rate())));
if (settled) {
onCommit?.();
stopText = "";
setTimeout(sync, 1600);
}
};
strip.addEventListener("pointerdown", (event) => {
if (event.button !== 0) return;
const window = info().count && !setOnGraph() ? current() : null;
if (!window || window.whole) return;
event.preventDefault();
event.stopPropagation();
const { seconds, width, duration } = secondsAt(event);
const pxPerSecond = duration > 0 ? width / duration : 0;
const startX = window.start * pxPerSecond;
const endX = (window.start + window.seconds) * pxPerSecond;
const x = seconds * pxPerSecond;
const nearStart = Math.abs(x - startX) <= EDGE_HIT_PX;
const nearEnd = Math.abs(x - endX) <= EDGE_HIT_PX;
let zone;
if (nearStart || nearEnd) zone = nearStart && nearEnd ? (x < (startX + endX) / 2 ? "start" : "end") : nearStart ? "start" : "end";
else zone = "move";
// A press outside the box brings the box there, centred on the press.
const inside = x > startX && x < endX;
const grab = zone !== "move" ? 0 : inside ? seconds - window.start : window.seconds / 2;
drag = { zone, grab, base: window, pointerId: event.pointerId };
pause();
strip.classList.toggle("is-moving", zone === "move");
box.focus({ preventScroll: true });
try { strip.setPointerCapture(event.pointerId); } catch { /* mouse fallback */ }
apply(event, false);
});
strip.addEventListener("pointermove", (event) => {
if (!drag) {
const window = info().count && !setOnGraph() ? current() : null;
if (!window || window.whole) { strip.style.cursor = ""; return; }
const { seconds, width, duration } = secondsAt(event);
const px = duration > 0 ? width / duration : 0;
const near = Math.min(Math.abs(seconds - window.start), Math.abs(seconds - window.start - window.seconds)) * px <= EDGE_HIT_PX;
strip.style.cursor = near ? "ew-resize" : "grab";
return;
}
event.preventDefault();
event.stopPropagation();
apply(event, false);
});
const finish = (event) => {
if (!drag) return;
if (event) apply(event, true);
else onCommit?.();
try { if (strip.hasPointerCapture(drag.pointerId)) strip.releasePointerCapture(drag.pointerId); } catch { /* released already */ }
drag = null;
strip.classList.remove("is-moving");
play();
};
strip.addEventListener("pointerup", (event) => { event.stopPropagation(); finish(event); });
strip.addEventListener("pointercancel", () => finish(null));
strip.addEventListener("lostpointercapture", () => finish(null));
// Arrow keys slide the box a second at a time; Shift moves one frame.
box.addEventListener("keydown", (event) => {
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) return;
const window = info().count && !setOnGraph() ? current() : null;
if (!window || window.whole) return;
event.preventDefault();
event.stopPropagation();
const clip = info();
const step = event.shiftKey && clip.fps > 0 ? 1 / clip.fps : 1;
const target = event.key === "Home" ? 0 : event.key === "End" ? Infinity
: window.start + (event.key === "ArrowLeft" ? -step : step);
const moved = dragClipWindow(window, "move", Number.isFinite(target) ? target : clip.duration, clip, limits());
store(moved);
sync();
if (moved && playable()) seek(moved.start);
onCommit?.();
});
new ResizeObserver(() => drawThumbs()).observe(strip);
sync();
return { root, sync };
}
+42 -6
View File
@@ -131,6 +131,21 @@ export function compareBadges(fraction, stageWidth, badgeWidth = 22, gap = 5) {
return { a: a >= 4 ? a : null, b: b + badgeWidth <= width - 4 ? b : null };
}
// The node property that holds the picture the panel rests on: "A" or "B",
// saved with the workflow. A new node rests on B, the "after" picture.
export const REST_PROPERTY = "ausboss_compare_rest";
// A saved resting side, or null when the node has none yet (a workflow
// saved before the choice existed).
export function savedRestSide(value) {
return value === "A" || value === "B" ? value : null;
}
// Node types that hand on one of their pictures and make nothing new.
export const SWITCH_NODE_TYPES = new Set(["ComfySwitchNode", "ComfySoftSwitchNode", "AUSBOSS_NODES_Switch"]);
// The inputs of a switch that choose a branch rather than carry a picture.
export const SWITCH_CONTROL_INPUTS = new Set(["switch", "select", "boolean", "index"]);
// Is `target` somewhere upstream of `start`? `feeds(id)` lists the ids of
// the nodes wired into node `id`.
function isUpstream(target, start, feeds) {
@@ -147,15 +162,34 @@ function isUpstream(target, start, feeds) {
return false;
}
// Is the picture out of `start` made from `target`'s picture? A switch only
// hands one of its pictures on, so it counts only when one branch is made
// from `target` and no branch can hand on a picture from before `target`.
// `branches(id)` lists a switch's picture branches, null for other nodes.
function madeFrom(start, target, graph, memo = new Map()) {
if (start === target) return true;
if (memo.has(start)) return memo.get(start);
memo.set(start, false); // a loop in the links proves nothing
const branches = graph.branches?.(start) ?? null;
const ids = (branches ?? graph.feeds(start) ?? []).filter((id) => id != null);
const answer = ids.some((id) => madeFrom(id, target, graph, memo))
&& !(branches && ids.some((id) => id !== target && isUpstream(id, target, graph.feeds)));
memo.set(start, answer);
return answer;
}
// Which input holds the result, the picture the panel rests on. B is the
// "after" picture by convention. When B's picture feeds the node that makes
// A, they are wired the other way round and the result is A.
// "after" picture by convention. When A is made from B's picture, they are
// wired the other way round and the result is A. A switch that can hand on
// either the other picture or the one it started from is a "before" picker:
// the picture it can hand on is the result.
//
// `a` and `b` say where the two pictures come from: { id, slot } of the node
// and output wired to each input. `graph` reads the links: feeds(id) lists
// the ids of the nodes wired into node `id`, and inside(id) opens a
// subgraph: the same two calls for the graph in it, plus output(slot),
// where that output comes from in there.
// the ids of the nodes wired into node `id`, branches(id) the picture
// branches of a switch (null for other nodes), and inside(id) opens a
// subgraph: the same calls for the graph in it, plus output(slot), where
// that output comes from in there.
export function compareResultSide(a, b, graph) {
// Both pictures out of one subgraph: the answer is inside it.
for (let depth = 0; a && b && a.id === b.id && depth < 16; depth += 1) {
@@ -164,5 +198,7 @@ export function compareResultSide(a, b, graph) {
[a, b, graph] = [inner.output(a.slot), inner.output(b.slot), inner];
}
if (!a || !b || a.id === b.id) return "B";
return isUpstream(b.id, a.id, graph.feeds) ? "A" : "B";
if (madeFrom(a.id, b.id, graph)) return "A";
if (madeFrom(b.id, a.id, graph)) return "B";
return isUpstream(a.id, b.id, graph.feeds) ? "A" : "B";
}
+110
View File
@@ -0,0 +1,110 @@
// Film Grain's Auto, on the node's face: what Auto picks for the picture on
// hand, shown beside the Amount and Size boxes ("= 0.27", "= 1.0 px").
//
// The picture is read from its Load Image through ComfyUI's /view route and
// its fine noise measured here, with the same measure the node uses
// (js/shared/live_grain.mjs). A picture that only exists after a run (a VAE
// Decode) is known from the node's last run, which sends Auto's picks with
// its result. Until either, the card shows a plain dash.
//
// With a picture on grain_from, Auto copies that picture's grain instead.
// The match is worked out by the node when it runs, and sent with its result
// (node.__ausbossMatch = { amount, size, color }); the card's notes and the
// live preview use it from then on. The node keeps its last few matches,
// one per pair of pictures, in its saved properties: ComfyUI does not run a
// node again for pictures it already ran, so a run that comes from its
// cache sends no match, and a reopened workflow would otherwise wait for one.
import { autoGrain, measureNoise } from "./live_grain.mjs";
import { loadPixels, pixelsToImage, planInput } from "./live_sources.mjs";
// Is a picture wired into grain_from?
export const grainFromLinked = (node) => node?.inputs?.some((input) => input?.name === "grain_from" && input.link != null) === true;
// Does Auto copy grain from a picture right now?
export const copiesGrain = (node) => Boolean(node?.widgets?.find((widget) => widget?.name === "auto")?.value) && grainFromLinked(node);
// The match from the node's last run, or null.
export function matchFromRun(record) {
const sent = record?.ausboss_grain_match?.[0];
return sent && ["base_amount", "base_size", "base_color"].every((key) => Number.isFinite(sent[key]))
? { amount: sent.base_amount, size: sent.base_size, color: sent.base_color }
: null;
}
// Which pair of pictures a match belongs to: the picture and grain_from's
// source (a Load Image's file, or the link a run reads).
export const matchKey = (node) => ["image", "grain_from"].map((name) => planInput(node, name).key ?? "-").join("|");
const KEPT_MATCHES = 8;
const validMatch = (match) => match && ["amount", "size", "color"].every((key) => Number.isFinite(match[key])) ? match : null;
// Remember a run's match for the pictures wired now.
export function keepMatch(node, match) {
if (!node || !validMatch(match)) return;
node.properties ??= {};
const kept = { ...(node.properties.ausboss_grain_matches ?? {}) };
const key = matchKey(node);
delete kept[key];
kept[key] = { amount: match.amount, size: match.size, color: match.color };
const keys = Object.keys(kept);
for (const old of keys.slice(0, Math.max(0, keys.length - KEPT_MATCHES))) delete kept[old];
node.properties.ausboss_grain_matches = kept;
}
// The kept match for the pictures wired now, or null.
export const keptMatch = (node) => validMatch(node?.properties?.ausboss_grain_matches?.[matchKey(node)]) ?? null;
export function setMatch(node, match) {
const before = node.__ausbossMatch;
if (before?.amount === match?.amount && before?.size === match?.size && before?.color === match?.color) return;
node.__ausbossMatch = match ?? null;
node.__ausbossCard?.refresh?.();
node.__ausbossLive?.hooks?.refresh?.();
node.setDirtyCanvas?.(true, true);
}
// Auto's picks for the node (node.__ausbossAuto = { amount, size }: the
// numbers before the card's multipliers), or null while they are not known.
export function setAuto(node, picks) {
const before = node.__ausbossAuto;
const next = picks && Number.isFinite(picks.amount) && Number.isFinite(picks.size) ? { amount: picks.amount, size: picks.size } : null;
if (before?.amount === next?.amount && before?.size === next?.size) return;
node.__ausbossAuto = next;
node.__ausbossCard?.refresh?.();
node.setDirtyCanvas?.(true, true);
}
// From a picture already read (the live stage has it).
export function autoFromImage(node, image) {
const noise = measureNoise(image);
const picks = autoGrain(image.h, image.w, noise);
setAuto(node, picks);
return picks;
}
// From what the node's last run sent.
export function autoFromRun(record) {
const sent = record?.ausboss_grain_auto?.[0];
return sent && Number.isFinite(sent.base_amount) && Number.isFinite(sent.base_size) ? { amount: sent.base_amount, size: sent.base_size } : null;
}
// Work out Auto's picks for a node now. `viewUrl(query)` turns a /view query
// into a URL; `record` is the node's last output record, if any.
export async function refreshAuto(node, { viewUrl, record = null }) {
if (!node || typeof viewUrl !== "function") return;
// The match kept for these two pictures; other pictures wait for a run.
setMatch(node, grainFromLinked(node) ? keptMatch(node) : null);
const plan = planInput(node, "image");
if (plan.state === "direct") {
try {
const image = pixelsToImage(await loadPixels(viewUrl(plan.query)), 3);
// The wiring or the file changed while the picture was being read.
if (planInput(node, "image").key !== plan.key) return;
autoFromImage(node, image);
return;
} catch {
// A browser that hides picture pixels: fall back to the last run's numbers.
}
}
setAuto(node, plan.state === "none" ? null : autoFromRun(record));
}
+162 -28
View File
@@ -1,9 +1,15 @@
// The row of chips on H3 Prompt Writer: each picture plugged in, with its @
// name, a small copy of it and its job, then the video and its job. A slot with nothing plugged in is a faint
// dashed chip, so it reads as optional. The widgets underneath stay the
// source of truth: a chip only changes their value.
// name, a small copy of it and its job, then the video and its job. A slot
// with nothing plugged in has no chip (js/shared/h3_sockets.mjs holds the
// rule). A picture whose loader is turned off keeps a faint dashed chip that
// says so. The widgets underneath stay the source of truth: a chip only
// changes their value. The chips share one line. On a narrow node the widest
// chips give way first, their job cut short, so a short job such as "place"
// stays whole for as long as it can.
import { app } from "../../../scripts/app.js";
import { BRAND, chainCallback } from "./index.mjs";
import { BRAND, chainCallback, notifyAusbossChange } from "./index.mjs";
import { THEME as T, FONT_UI } from "./theme.mjs";
import { SHOW_ALL, chipsToShow } from "./h3_sockets.mjs";
import { liftSocket } from "./widget_card.mjs";
import { commitWidgetValue, comboValues } from "./widget_card_math.mjs";
@@ -15,15 +21,22 @@ function ensureCss() {
const style = document.createElement("style");
style.id = CSS_ID;
style.textContent = `
.ausboss-chips{display:flex;flex-wrap:wrap;align-content:flex-start;gap:5px;height:100%;min-width:0;font:600 10.5px/1 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
.ausboss-chip{position:relative;display:flex;align-items:center;gap:4px;height:24px;max-width:100%;padding:0 8px;box-sizing:border-box;border:1px solid #2a3437;border-radius:12px;background:#0b0f10;color:#d8ecea;white-space:nowrap}
.ausboss-chips{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,max-content);justify-content:start;align-items:start;gap:5px;height:100%;min-width:0;font:600 10.5px/1 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
.ausboss-chip{position:relative;display:flex;align-items:center;gap:4px;height:24px;min-width:0;max-width:100%;padding:0 8px;box-sizing:border-box;border:1px solid #2a3437;border-radius:12px;background:#0b0f10;color:#d8ecea;white-space:nowrap}
.ausboss-chip:hover{border-color:${BRAND}}
.ausboss-chip img{flex:none;width:18px;height:18px;margin-left:-5px;border-radius:9px;object-fit:cover}
.ausboss-chip b{flex:none;color:${BRAND};font:700 10px ui-monospace,SFMono-Regular,Menlo,monospace}
.ausboss-chip em{flex:none;color:#6f8886;font-style:normal;font-weight:500}
.ausboss-chip select{field-sizing:content;min-width:0;max-width:120px;height:22px;padding:0 11px 0 0;border:none;background:transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M1 1l3 3 3-3' fill='none' stroke='%236f8886' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 1px center;color:#d8ecea;font:inherit;appearance:none;-webkit-appearance:none;cursor:pointer;text-overflow:ellipsis}
.ausboss-chip select:focus-visible{outline:2px solid ${BRAND};outline-offset:2px}
.ausboss-chip select option{background:#0f1516;color:#d8ecea}
.ausboss-chip-pick{flex:0 1 auto;min-width:0;max-width:120px;height:22px;padding:0 12px 0 0;border:none;background:transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M1 1l3 3 3-3' fill='none' stroke='%236f8886' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 1px center;color:#d8ecea;font:inherit;cursor:pointer;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-align:left}
.ausboss-chip-pick:focus-visible{outline:2px solid ${BRAND};outline-offset:2px;border-radius:3px}
.ausboss-chip.open{border-color:${BRAND}}
.ausboss-chip-menu{position:fixed;z-index:10000;box-sizing:border-box;padding:.33em;border:1px solid ${T.rule};border-radius:.66em;background:${T.card};box-shadow:0 10px 32px rgba(0,0,0,.55);font:500 12px/1.25 ${FONT_UI};color:${T.inkSoft}}
.ausboss-chip-item{display:flex;align-items:center;gap:.5em;padding:.45em .75em .45em .5em;border-radius:.4em;white-space:nowrap;cursor:pointer;user-select:none}
.ausboss-chip-item::before{content:"";flex:none;width:.9em;text-align:center;color:${T.brand}}
.ausboss-chip-item.current::before{content:"\\2713"}
.ausboss-chip-item.current{color:${T.brandInk}}
.ausboss-chip-item.hot{background:${T.fill};color:${T.ink}}
.ausboss-chip span{min-width:0;overflow:hidden;text-overflow:ellipsis}
.ausboss-chip.off{border-style:dashed;background:transparent;color:#56706d}
.ausboss-chip.off:hover{border-color:#2a3437}
.ausboss-chip.wired{color:#8ba3a1}
@@ -40,6 +53,19 @@ function linkSource(node, name) {
return (source?.mode ?? 0) === 0 ? source ?? {} : null;
}
const hasWire = (node, name) => {
const slot = node.inputs?.find((input) => !input?.widget && input?.name === name);
return slot?.link !== null && slot?.link !== undefined;
};
// The names of the chips this node draws now: picture_1 to picture_4, video.
export function castChipNames(node) {
return chipsToShow({
wiredInputs: ["picture_1", "picture_2", "picture_3", "picture_4", "video"].filter((name) => hasWire(node, name)),
showAll: Boolean(app.extensionManager?.setting?.get?.(SHOW_ALL)),
});
}
const widgetOf = (node, name) => node.widgets?.find((widget) => widget.name === name) ?? null;
function chip(className = "") {
@@ -56,17 +82,116 @@ function add(parent, tag, text, className) {
return child;
}
// The open job list, one at a time across every chip on the page.
let openMenu = null;
// The job list a chip opens. A native <select> lets the browser draw its own
// list (small system font, light highlight, pinned to the select's left
// edge); this one wears the node's colours, sits under the whole chip and
// grows with the canvas zoom like the chip does.
function openJobMenu(chipElement, button, values, current, choose) {
openMenu?.close();
const menu = add(document.body, "div", undefined, "ausboss-chip-menu");
menu.setAttribute("role", "listbox");
const items = values.map((value) => {
const item = add(menu, "div", value, "ausboss-chip-item");
item.setAttribute("role", "option");
if (value === current) { item.classList.add("current"); item.setAttribute("aria-selected", "true"); }
return item;
});
let hot = -1;
const setHot = (index) => {
items[hot]?.classList.remove("hot");
hot = (index + items.length) % items.length;
items[hot]?.classList.add("hot");
items[hot]?.scrollIntoView({ block: "nearest" });
};
setHot(Math.max(0, values.indexOf(current)));
// The chip is drawn scaled with the canvas: the list matches that size,
// starts at the chip's left edge and is at least as wide as the chip.
function place() {
const box = chipElement.getBoundingClientRect();
const zoom = Math.min(2.5, Math.max(0.85, box.height / (chipElement.offsetHeight || 24)));
menu.style.fontSize = `${12 * zoom}px`;
menu.style.minWidth = `${box.width}px`;
const width = menu.offsetWidth;
const height = menu.offsetHeight;
let top = box.bottom + 4;
if (top + height > window.innerHeight - 8 && box.top - height - 4 >= 8) top = box.top - height - 4;
menu.style.left = `${Math.max(8, Math.min(box.left, window.innerWidth - width - 8))}px`;
menu.style.top = `${Math.max(8, top)}px`;
}
const abort = new AbortController();
const close = () => {
abort.abort();
menu.remove();
chipElement.classList.remove("open");
if (openMenu?.menu === menu) openMenu = null;
};
const pick = (index) => { close(); button.focus(); choose(values[index]); };
items.forEach((item, index) => {
item.addEventListener("pointermove", () => { if (hot !== index) setHot(index); });
item.addEventListener("click", () => pick(index));
});
menu.addEventListener("pointerdown", (event) => event.stopPropagation());
const outside = (event) => !menu.contains(event.target) && !button.contains(event.target);
const on = { capture: true, signal: abort.signal };
window.addEventListener("pointerdown", (event) => { if (outside(event)) close(); }, on);
window.addEventListener("wheel", (event) => { if (outside(event)) close(); }, { ...on, passive: true });
// The page fires resize on its own now and then: the list follows the chip
// instead of vanishing, and goes only when the chip itself is gone.
window.addEventListener("resize", () => (chipElement.isConnected ? place() : close()), on);
// Only the window itself losing focus (another app, another tab). Pressing an item takes
// focus off the chip's button, and a capturing blur listener would hear that and close
// the list before the click lands. The press keeps focus on the button instead.
window.addEventListener("blur", (event) => { if (event.target === window) close(); }, { signal: abort.signal });
menu.addEventListener("mousedown", (event) => event.preventDefault());
window.addEventListener("keydown", (event) => {
const step = { ArrowDown: 1, ArrowUp: -1 }[event.key];
if (step) setHot(hot + step);
else if (event.key === "Home") setHot(0);
else if (event.key === "End") setHot(items.length - 1);
else if (event.key === "Enter" || event.key === " ") pick(hot);
else if (event.key === "Escape" || event.key === "Tab") { close(); if (event.key === "Escape") button.focus(); }
else return;
if (event.key !== "Tab") { event.preventDefault(); event.stopPropagation(); }
}, on);
place();
chipElement.classList.add("open");
openMenu = { owner: button, menu, close };
}
function choice(node, name, into) {
const widget = widgetOf(node, name);
const select = add(into, "select");
for (const value of comboValues(widget)) add(select, "option", value).value = value;
select.value = widget?.value ?? "";
select.title = widget?.options?.tooltip ?? "";
select.addEventListener("change", () => {
if (widget) commitWidgetValue(node, widget, select.value, app.canvas);
const button = add(into, "button", undefined, "ausboss-chip-pick");
button.type = "button";
button.setAttribute("aria-haspopup", "listbox");
// The job can be cut short on a narrow node, so the hint starts with it.
const hint = widget?.options?.tooltip ?? "";
const show = (value) => {
button.textContent = String(value ?? "");
button.title = [String(value ?? ""), hint].filter(Boolean).join("\n");
};
show(widget?.value);
const choose = (value) => {
show(value);
if (widget && value !== widget.value) {
commitWidgetValue(node, widget, value, app.canvas);
notifyAusbossChange();
}
node.setDirtyCanvas?.(true, true);
};
button.addEventListener("pointerdown", (event) => event.stopPropagation());
button.addEventListener("click", (event) => {
event.preventDefault();
if (openMenu?.owner === button) { openMenu.close(); return; }
const values = comboValues(widget).map(String);
openJobMenu(into, button, values, String(widget?.value ?? ""), choose);
});
return (values) => { if (document.activeElement !== select) select.value = values[name] ?? ""; };
return (values) => { if (openMenu?.owner !== button) show(values[name]); };
}
// The jobs have no socket of their own, but a page saved by an earlier
@@ -90,15 +215,24 @@ export function castChips(node) {
let syncs = [];
let latest = {};
const build = (values) => {
if (openMenu && element.contains(openMenu.owner)) openMenu.close();
element.textContent = "";
syncs = [];
const names = castChipNames(node);
// A faint chip: a socket with nothing in it (only with every socket
// shown), or a picture whose loader is turned off.
const faint = (name, label, plugIn) => {
const empty = chip("off");
const off = hasWire(node, name);
empty.textContent = off ? `${label} off` : `+ ${label}`;
empty.title = off ? `The loader on ${name} is turned off, so it is not used.` : plugIn;
element.append(empty);
};
for (const number of [1, 2, 3, 4]) {
if (!names.includes(`picture_${number}`)) continue;
const source = linkSource(node, `picture_${number}`);
if (!source) {
const empty = chip("off");
empty.textContent = `+ @${number}`;
empty.title = `Plug a picture into picture_${number} to name it @${number} in your lines.`;
element.append(empty);
faint(`picture_${number}`, `@${number}`, `Plug a picture into picture_${number} to name it @${number} in your lines.`);
continue;
}
const item = chip();
@@ -115,20 +249,17 @@ export function castChips(node) {
if (linkSource(node, "video_job")) add(item, "span", "job from its wire");
else syncs.push(choice(node, "video_job", item));
element.append(item);
} else {
const empty = chip("off");
empty.textContent = "+ video";
empty.title = "Plug a video into video to copy its moves, swap the person, keep it going or give it a new voice.";
element.append(empty);
} else if (names.includes("video")) {
faint("video", "video", "Plug a video into video to copy its moves, swap the person, keep it going or give it a new voice.");
}
for (const run of syncs) run(values);
};
const shapeOf = () => JSON.stringify(["picture_1", "picture_2", "picture_3", "picture_4", "video", ...JOBS].map((name) => {
const shapeOf = () => JSON.stringify([castChipNames(node), ...["picture_1", "picture_2", "picture_3", "picture_4", "video", ...JOBS].map((name) => {
const source = linkSource(node, name);
return source ? [source.id ?? 1, source.imgs?.[0]?.src ?? ""] : 0;
}));
})]);
const sync = (values) => {
latest = values;
const now = shapeOf();
@@ -136,7 +267,10 @@ export function castChips(node) {
for (const run of syncs) run(values);
};
const watch = setInterval(() => sync(latest), WATCH);
chainCallback(node, "onRemoved", () => clearInterval(watch));
chainCallback(node, "onRemoved", () => {
clearInterval(watch);
if (openMenu && element.contains(openMenu.owner)) openMenu.close();
});
chainCallback(node, "onConfigure", () => queueMicrotask(() => keepOldJobLinks(node)));
return { element, sync };
}
+53 -1
View File
@@ -1,3 +1,5 @@
import { linkOrigin } from "./clip_rate.mjs";
// The same live-input rule used by the writer timeline: muted/bypassed
// sources do not reach this node. This inspects the wire, never media bytes.
export function linkSource(node, name) {
@@ -9,8 +11,58 @@ export function linkSource(node, name) {
return (source?.mode ?? 0) === 0 ? source ?? null : null;
}
// Keep in step with Python video_frames (node_h3_prompt_writer.py): H3 makes
// 5 frames plus steps of 17, at most 15 s at 24 fps, rounding a clip down.
export const H3_FPS = 24;
export function h3VideoFrames(frames) {
const count = Math.trunc(Number(frames));
if (!(count > 0)) return null;
return Math.max(1, Math.floor((Math.min(count, 15 * H3_FPS) - 5) / 17)) * 17 + 5;
}
// What the clip node's face last worked out for its run ({frames,
// startSeconds, endSeconds}), or null when the clip is not that node or its
// count is only known at run time.
export function clipTimingFor(node) {
// Through Reroutes and subgraphs, as every linked value is read.
const timing = linkOrigin(node, "video")?.node?.__ausbossClipTiming;
return timing && timing.frames > 0 ? timing : null;
}
// The words under "From the clip": what H3 will make of the clip's frames.
export function clipLengthWords(timing) {
if (!timing) return null;
const made = h3VideoFrames(timing.frames);
const seconds = (frames) => String(Number((frames / H3_FPS).toFixed(2)));
if (made < timing.frames) {
const up = made + 17;
const room = timing.roomFrames ?? Infinity;
const stops = timing.startSeconds + made / H3_FPS;
return {
title: `H3 makes ${made} of the clip's ${timing.frames} frames · ${seconds(made)} s`,
note: `H3 leaves out the last ${seconds(timing.frames - made)} s, so it stops at ${String(Number(stops.toFixed(2)))} s in the video. To lose nothing, set the clip's Duration to ${seconds(made)} s${up <= Math.min(room, 15 * H3_FPS) ? ` or ${seconds(up)} s` : ""}.`,
warn: true,
};
}
if (made === timing.frames) return { title: `H3 uses all ${made} frames · ${seconds(made)} s`, note: "The clip is already a length H3 makes.", warn: false };
return { title: `H3 makes ${made} frames · ${seconds(made)} s`, note: `That is its shortest length; the clip has ${timing.frames} frames.`, warn: true };
}
// These video jobs keep the clip's own camera (Python MOVES_ARE and
// SWAP_VIDEO say so; a new voice or a change keeps the clip as it was shot).
// "keep going" makes new footage, so its camera is still the user's words.
const CAMERA_FROM_CLIP = ["copy its moves", "swap the person", "new voice", "change something"];
// The Camera list's first choice adds no camera words. With a clip wired for
// one of those jobs that means the clip's own camera, so it reads that way.
export function cameraChoiceLabel(value, values, node) {
if (value !== "as typed" || !node) return undefined;
const job = node.widgets?.find((widget) => widget.name === "video_job")?.value;
return CAMERA_FROM_CLIP.includes(job) && linkSource(node, "video") !== null ? "from the video" : undefined;
}
// Keep in step with Python KEEPS_ITS_LENGTH. Other jobs use seconds normally.
export function clipSetsDuration(node, values) {
return ["swap the person", "new voice", "change something"].includes(values.video_job)
return ["copy its moves", "swap the person", "new voice", "change something"].includes(values.video_job)
&& linkSource(node, "video") !== null;
}
+156
View File
@@ -0,0 +1,156 @@
// H3 Prompt Writer's two tabs. Simple is the card as it always was: your
// lines, the chips and the menus. Full prompt shows the prompt the node wrote
// on its last run, in a box you can change; whatever you type there is what
// H3 gets, until Reset to written. The `full_prompt` widget underneath holds
// the edit (empty when there is none), so it saves and loads like any value.
import { app } from "../../../scripts/app.js";
import { chainCallback, notifyAusbossChange } from "./index.mjs";
import { keepKeyInField } from "./canvas_passthrough.mjs";
import { compactAction } from "./panel_controls.mjs";
import { THEME as T } from "./theme.mjs";
import { commitWidgetValue } from "./widget_card_math.mjs";
import { FULL, SIMPLE, TAB_PROPERTY, WRITTEN_PROPERTY, boxText, editValue, isEdited, promptTab, writtenFromOutput } from "./h3_full_prompt_math.mjs";
export { FULL, SIMPLE, isEdited, promptTab };
const CSS_ID = "ausboss-h3-full-prompt-css";
const EDITED_NOTE = "Edited by you. This text is sent as it is; the Simple tab is not used until you reset.";
function ensureCss() {
if (document.getElementById(CSS_ID)) return;
const style = document.createElement("style");
style.id = CSS_ID;
style.textContent = `
.ausboss-prompt-tabs .dot{display:inline-block;width:6px;height:6px;margin-left:6px;border-radius:3px;background:${T.warn};vertical-align:1px}
.ausboss-prompt-tabs .dot[hidden]{display:none}
.ausboss-full-prompt{display:flex;flex-direction:column;gap:6px;height:100%;min-height:0}
.ausboss-full-prompt-area{display:block;flex:1 1 auto;width:100%;min-width:0;min-height:0;padding:5px 8px;box-sizing:border-box;border:1px solid transparent;border-radius:6px;background:${T.fill};color:${T.ink};font:11.5px/1.45 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;resize:none;overflow:auto}
.ausboss-full-prompt-area:focus{outline:none;border-color:${T.brand}}
.ausboss-full-prompt-area::placeholder{color:${T.faint}}
.ausboss-full-prompt-note{flex:none;padding:5px 8px;border-radius:5px;background:${T.warnSoft};color:${T.warnInk};font-size:11px;line-height:1.35}
.ausboss-full-prompt-note[hidden]{display:none}
.ausboss-full-prompt-foot{flex:none;display:flex;align-items:center;gap:8px;min-height:24px}
.ausboss-full-prompt-foot span{flex:1 1 auto;min-width:0;color:${T.faint};font-size:11px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.ausboss-simple-edited{display:flex;align-items:center;height:100%;padding:0 8px;box-sizing:border-box;border-radius:5px;background:${T.warnSoft};color:${T.warnInk};font-size:11px;line-height:1.3}
`;
document.head.append(style);
}
const widgetOf = (node, name) => node.widgets?.find((widget) => widget.name === name) ?? null;
const redraw = (node) => (node.__ausbossCard?.refreshByHand ?? node.__ausbossCard?.refresh)?.();
const writtenOf = (node) => String(node.properties?.[WRITTEN_PROPERTY] ?? "");
function setEdit(node, value) {
const widget = widgetOf(node, "full_prompt");
if (!widget || widget.value === value) return;
commitWidgetValue(node, widget, value, app?.canvas);
node.graph?.setDirtyCanvas?.(true, true);
}
// The tab switch at the top of the card. The open tab is a display choice
// kept on the node, not a value: it changes nothing that is sent.
export function promptTabs(node) {
ensureCss();
const element = document.createElement("div");
element.className = "ausboss-card-seg ausboss-prompt-tabs";
const make = (tab, label, title) => {
const button = document.createElement("button");
button.type = "button";
button.textContent = label;
button.title = title;
button.addEventListener("click", () => {
if (promptTab(node) === tab) return;
node.properties ??= {};
node.properties[TAB_PROPERTY] = tab;
redraw(node);
});
element.append(button);
return button;
};
const simple = make(SIMPLE, "Simple", "Your lines, the pictures and the menus. The node writes the full prompt from them.");
const full = make(FULL, "Full prompt", "The prompt the node wrote on its last run. Change it here to send your own.");
const dot = document.createElement("span");
dot.className = "dot";
dot.title = "Edited: this text is sent instead of the Simple tab.";
full.append(dot);
return {
element,
sync(values) {
const tab = promptTab(node);
simple.classList.toggle("on", tab === SIMPLE);
full.classList.toggle("on", tab === FULL);
dot.hidden = !isEdited(values);
},
};
}
// One line on the Simple tab while an edit is being sent instead.
export function simpleEditedNote() {
ensureCss();
const element = document.createElement("div");
element.className = "ausboss-simple-edited";
element.textContent = "Full prompt is edited, so these lines are not used until you reset it there.";
return { element };
}
// The Full prompt tab: the box, a note while it holds an edit, and Reset.
export function fullPromptBox(node) {
ensureCss();
const element = document.createElement("div");
element.className = "ausboss-full-prompt";
const area = document.createElement("textarea");
// Not the card's own textarea class: the script's colouring takes the
// first box with that class, and it belongs to the script.
area.className = "ausboss-full-prompt-area";
area.spellcheck = false;
area.placeholder = "Run the workflow once and the prompt the node writes shows here. Change it to send your own.";
area.title = "What H3 gets. Type here to send your own text instead of the node's.";
const note = document.createElement("div");
note.className = "ausboss-full-prompt-note";
note.textContent = EDITED_NOTE;
const foot = document.createElement("div");
foot.className = "ausboss-full-prompt-foot";
const hint = document.createElement("span");
hint.textContent = "Filled in after each run.";
const reset = compactAction("Reset to written", "Throw your edit away and send what the Simple tab writes again.");
foot.append(hint, reset);
element.append(area, note, foot);
area.addEventListener("input", () => {
setEdit(node, editValue(area.value, writtenOf(node)));
redraw(node);
});
area.addEventListener("change", () => notifyAusbossChange());
area.addEventListener("keydown", (event) => {
keepKeyInField(event, { weights: true });
if (event.key === "Escape") area.blur();
});
// Leaving the box shows what is sent: emptied, it is the written prompt again.
area.addEventListener("blur", () => redraw(node));
reset.addEventListener("click", () => {
setEdit(node, "");
area.value = writtenOf(node);
notifyAusbossChange();
redraw(node);
});
// Each run hands back the prompt the node wrote. It is kept on the node, so
// a saved workflow opens with it.
chainCallback(node, "onExecuted", (output) => {
const written = writtenFromOutput(output);
if (written === null) return;
node.properties ??= {};
node.properties[WRITTEN_PROPERTY] = written;
redraw(node);
});
return {
element,
sync(values) {
const edited = isEdited(values);
if (document.activeElement !== area) area.value = boxText(values, writtenOf(node));
note.hidden = !edited;
reset.disabled = !edited;
},
};
}
+39
View File
@@ -0,0 +1,39 @@
// What H3 Prompt Writer's Full prompt tab decides, kept apart from the DOM so
// it can be tested. The node writes the prompt; the tab shows what it wrote
// after a run, and text typed there is sent in its place until Reset.
export const SIMPLE = "simple";
export const FULL = "full";
// Display choices kept on the node: the open tab, and the last prompt the
// node wrote (so a saved workflow opens the tab with it).
export const TAB_PROPERTY = "ausboss_prompt_tab";
export const WRITTEN_PROPERTY = "ausboss_written_prompt";
export function promptTab(node) {
return node?.properties?.[TAB_PROPERTY] === FULL ? FULL : SIMPLE;
}
// The widget holds an edit only when there is one: empty text, or the
// written prompt typed back unchanged, means "send what the node writes".
export function editValue(text, written = "") {
const typed = String(text ?? "");
if (!typed.trim()) return "";
if (written && typed.trim() === String(written).trim()) return "";
return typed;
}
export function isEdited(values) {
return String(values?.full_prompt ?? "").trim() !== "";
}
// What the box shows: the edit, else the last prompt the node wrote.
export function boxText(values, written = "") {
return isEdited(values) ? String(values.full_prompt) : String(written ?? "");
}
// The prompt the node wrote on its last run, from the run's ui output.
export function writtenFromOutput(output) {
const text = output?.written_prompt;
if (Array.isArray(text)) return typeof text[0] === "string" ? text[0] : null;
return typeof text === "string" ? text : null;
}
+117
View File
@@ -0,0 +1,117 @@
// Which sockets H3 Prompt Writer 🆎 shows. The node keeps every socket in
// its lists, so a saved workflow and what is sent are unchanged; the ones
// not in use are only left out of the drawing (js/h3_sockets/index.js).
//
// Kept free of /scripts/app.js imports so node:test can cover it
// (tests/h3_sockets.test.mjs).
const PICTURES = ["picture_1", "picture_2", "picture_3", "picture_4"];
export const INPUT_NAMES = ["clip", ...PICTURES, "video", "video_sound", "voice", "song"];
export const OUTPUT_NAMES = [
"prompt", ...PICTURES, "video", "video_sound", "voice", "song", "song_under",
"frames", "width", "height", "keeps_clip_sound",
];
// The setting that shows every socket, and every picture chip, all the time.
export const SHOW_ALL = "AusBoss.H3PromptWriter.ShowEverySocket";
// The sockets that come and go. Every other socket always shows, and so
// does one this rule does not know (a later release may add some).
const PICTURE = /^picture_(\d+)$/;
const inOrder = (names) => names.filter((name) => PICTURE.test(name))
.sort((a, b) => Number(a.match(PICTURE)[1]) - Number(b.match(PICTURE)[1]));
const COMES_AND_GOES_OUT = ["video", "video_sound", "voice", "song", "song_under", "keeps_clip_sound"];
// An output that shows once the input of the same name has a wire.
const FOLLOWS_ITS_INPUT = ["video", "video_sound", "voice", "song"];
// The names of the sockets to draw. A socket with a wire on it always shows.
// `inputNames` and `outputNames` are the node's own sockets: a node with more
// pictures than four follows the same rule.
export function socketsToShow({
wiredInputs = [], wiredOutputs = [], showAll = false, inputNames = INPUT_NAMES, outputNames = OUTPUT_NAMES,
} = {}) {
if (showAll) return { inputs: new Set(inputNames), outputs: new Set(outputNames) };
const wired = new Set(wiredInputs);
const inputs = new Set([...inputNames.filter((name) => !PICTURE.test(name) && name !== "video_sound"), ...wired]);
const outputs = new Set([...outputNames.filter((name) => !PICTURE.test(name) && !COMES_AND_GOES_OUT.includes(name)), ...wiredOutputs]);
// Every picture up to the last wired one, and the next free one after it.
const pictures = inOrder(inputNames);
const lastWired = pictures.reduce((last, name, index) => (wired.has(name) ? index : last), -1);
pictures.slice(0, lastWired + 2).forEach((name) => inputs.add(name));
// The pictures come out in order, so two wired pictures are outputs 1 and
// 2 whichever inputs they are on.
const count = pictures.filter((name) => wired.has(name)).length;
inOrder(outputNames).slice(0, count).forEach((name) => outputs.add(name));
if (wired.has("video")) inputs.add("video_sound");
FOLLOWS_ITS_INPUT.filter((name) => wired.has(name)).forEach((name) => outputs.add(name));
if (wired.has("voice") && wired.has("song")) outputs.add("song_under");
if (wired.has("video")) outputs.add("keeps_clip_sound");
return { inputs, outputs };
}
// The chips to draw under "Pictures and settings": one for each picture and
// for the video that has a wire, in the node's order.
export function chipsToShow({ wiredInputs = [], showAll = false } = {}) {
const wired = new Set(wiredInputs);
return [...PICTURES, "video"].filter((name) => showAll || wired.has(name));
}
// Where a wire dropped on the node's body should go. `slots` is the node's
// input or output list as { name, type, wired, shown }, and `landed` the
// index the frontend picked. A wire never stays on a socket nobody can see
// while a shown one of the same kind can take it. An input takes one wire;
// an output takes many (`shared`), so a wired one will do when none is free.
export function dropTarget(slots, landed, { shared = false } = {}) {
const slot = slots[landed];
if (!slot || slot.shown) return landed;
const fits = (other, index) => index !== landed && other.shown && other.type === slot.type;
const free = slots.findIndex((other, index) => fits(other, index) && !other.wired);
if (free !== -1) return free;
const any = shared ? slots.findIndex(fits) : -1;
return any === -1 ? landed : any;
}
// A node's id comes from the workflow file and can be any text, so it goes
// into a style rule escaped: it can name a row and nothing else.
const cssText = (value) => String(value).replace(/[^A-Za-z0-9_-]/g, (char) => `\\${char.codePointAt(0).toString(16)} `);
// The style rule for one node in Nodes 2.0: it hides the row of each hidden
// socket. `keys` are "in-<index>" and "out-<index>". Nodes 2.0 measures
// where the sockets are only when the node or its widget grid changes size,
// and a row that comes or goes in the shorter column changes neither, which
// left wires ending beside their dots. `nudge` makes the grid a tenth of a
// pixel narrower; flipping it makes the frontend measure again.
export function hiddenRowsRule(nodeId, keys, nudge = false) {
const id = cssText(nodeId);
const rows = keys.length ? `${keys.map((key) => `.lg-slot:has([data-slot-key="${id}-${key}"])`).join(",")}{display:none}` : "";
return nudge ? `${rows}[data-widgets-grid-node-id="${id}"]{padding-left:0.1px}` : rows;
}
// A socket with a position of its own gets no row: the frontend only stacks
// the ones without (and writes the position into the saved file, which
// js/h3_sockets/index.js takes out again).
const PARKED = [0, -4000];
const noDraw = () => {};
// Hide or show one socket of a live node. Returns false, and changes
// nothing, when it cannot be done here: a frontend whose sockets do not draw
// themselves, or a socket that was placed by someone else.
export function setSocketHidden(slot, hidden) {
if (!slot || typeof slot.draw !== "function") return false;
if (!slot._ausbossHidden && slot.pos) return false;
if (hidden === Boolean(slot._ausbossHidden)) return true;
slot._ausbossHidden = hidden;
if (hidden) {
slot.pos = PARKED;
slot.draw = noDraw;
slot.drawCollapsed = noDraw;
} else {
delete slot.pos;
delete slot.draw;
delete slot.drawCollapsed;
}
return true;
}
+233
View File
@@ -0,0 +1,233 @@
// H3 Prompt Writer 🆎: the gear in the card's corner.
//
// Sockets in use | all. The same choice as the ComfyUI setting "Show
// every socket on H3 Prompt Writer" (js/h3_sockets), so it
// holds for every writer on this browser.
// The model what the small model on clip is asked, four wordings. Each
// opens in an editor; an edited one is saved in this node's
// hidden model_asks input, so a shared workflow asks the same.
// Empty means the built-in wording.
import { api } from "../../../scripts/api.js";
import { app } from "../../../scripts/app.js";
import { SHOW_ALL } from "./h3_sockets.mjs";
import { LONGEST_ASK, editedAsks, readAsks, wordingWarning, writeAsks } from "./h3_writer_gear_math.mjs";
import { showToast } from "./index.mjs";
import { gearIconSvg, openSettingsMenu, closeSettingsMenu } from "./settings_menu.mjs";
import { FONT_UI, THEME } from "./theme.mjs";
const CSS_ID = "ausboss-h3-gear-css";
const TITLE = "H3 Prompt Writer settings";
// The gear's width and the gap beside it, kept free at the end of the tabs.
const CORNER_RESERVE = 30;
export const ASKS = [
{ key: "describe", label: "Describe a new person", hint: "In a swap, writes how a new person looks from their picture." },
{ key: "next", label: "Fill in the next moments", hint: "After one typed line, writes what happens next. {seconds}, {first} and {count} are filled in." },
{ key: "heard", label: "Hear the place", hint: "Writes the steady sound of the place. {lines} is filled in." },
{ key: "tidy", label: "Tidy up my lines", hint: "Instructions for Tidy up my lines, under More." },
];
let builtIn = null;
async function builtInAsks() {
if (builtIn) return builtIn;
const response = await api.fetchApi("/ausboss/h3_writer/asks");
if (!response.ok) throw new Error("no built-in wording");
builtIn = await response.json();
return builtIn;
}
function ensureCss() {
if (document.getElementById(CSS_ID)) return;
const style = document.createElement("style");
style.id = CSS_ID;
style.textContent = `
.ausboss-card.has-corner .ausboss-prompt-tabs{width:calc(100% - ${CORNER_RESERVE}px)}
.ausboss-ask-back{position:fixed;inset:0;z-index:10000;display:grid;place-items:center;background:rgba(0,0,0,.45)}
.ausboss-ask{width:min(560px,calc(100vw - 32px));max-height:calc(100vh - 48px);display:flex;flex-direction:column;gap:8px;padding:12px;box-sizing:border-box;border:1px solid ${THEME.rule};border-radius:10px;background:#1f2326;color:${THEME.inkSoft};font:13px/1.4 ${FONT_UI};box-shadow:0 12px 36px rgba(0,0,0,.55)}
.ausboss-ask h3{margin:0;font-size:14px;color:${THEME.ink}}
.ausboss-ask p{margin:0;font-size:11px;color:${THEME.faint}}
.ausboss-ask textarea{min-height:240px;flex:1 1 auto;resize:vertical;padding:8px;box-sizing:border-box;border:1px solid ${THEME.brand};border-radius:6px;outline:none;background:#0b0f10;color:${THEME.ink};font:12px/1.45 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
.ausboss-ask-row{display:flex;gap:6px;align-items:center}
.ausboss-ask-row .gap{flex:1}
.ausboss-ask button{all:unset;flex:none;white-space:nowrap;padding:5px 11px;border-radius:6px;background:${THEME.fill};color:${THEME.inkSoft};font-weight:600;font-size:12px;cursor:pointer}
.ausboss-ask button:hover{background:${THEME.fillHover}}
.ausboss-ask button.save{background:${THEME.brand};color:${THEME.onBrand}}
.ausboss-ask .state{font-size:11px;color:${THEME.faint}}
.ausboss-ask .state.warn{color:${THEME.warn}}
`;
document.head.append(style);
}
// The editor for one wording: the node's own, or the built-in one to start
// from. Save keeps it on the node; Back to built-in empties it.
function openEditor(node, card, ask, built) {
ensureCss();
const back = document.createElement("div");
back.className = "ausboss-ask-back";
const box = document.createElement("div");
box.className = "ausboss-ask";
const title = document.createElement("h3");
title.textContent = ask.label;
const hint = document.createElement("p");
hint.textContent = `${ask.hint} Only used when a text model is plugged into clip. Saved in this node.`;
const area = document.createElement("textarea");
const own = readAsks(card.values().model_asks)[ask.key];
area.maxLength = LONGEST_ASK;
area.value = (own ?? built).slice(0, LONGEST_ASK);
area.spellcheck = false;
const opened = area.value;
const state = document.createElement("span");
state.className = "state";
const button = (label, className, run) => {
const element = document.createElement("button");
element.type = "button";
element.textContent = label;
if (className) element.className = className;
element.addEventListener("click", run);
return element;
};
const saveButton = button("Save", "save", () => save(area.value));
// Escape or a click outside over typing that is not saved, and Save over a
// wording that drops a name the writer fills in, each say so once; the
// second press goes ahead.
let leaving = false;
let saving = false;
const warn = (words) => {
state.textContent = words;
state.classList.toggle("warn", true);
};
const showState = () => {
leaving = false;
saving = false;
saveButton.textContent = "Save";
state.classList.toggle("warn", false);
const words = area.value.trim() === built.trim() || !area.value.trim() ? "Built-in wording" : "Your wording";
state.textContent = area.value.length >= LONGEST_ASK ? `${words}, at the ${LONGEST_ASK.toLocaleString()} letter limit` : words;
};
showState();
area.addEventListener("input", showState);
const close = () => back.remove();
const leave = () => {
if (leaving || area.value === opened) return close();
showState();
leaving = true;
warn("Not saved yet. Press Esc again to close without saving.");
};
const save = (words) => {
// The built-in wording, or nothing, is stored as nothing, so a later
// release's better wording reaches this node.
const kept = words.trim() && words.trim() !== built.trim() ? words : "";
const problem = kept ? wordingWarning(ask.key, kept, built) : "";
if (problem && !saving) {
showState();
saving = true;
saveButton.textContent = "Save anyway";
warn(problem);
return;
}
card.setWidget("model_asks", writeAsks(card.values().model_asks, ask.key, kept));
card.refresh();
close();
};
// The editor is a window of its own: no key reaches ComfyUI while it is
// open (Ctrl+Enter would queue the old wording; here it saves), Tab stays
// inside it, and Escape closes it from any of its controls.
back.addEventListener("keydown", (event) => {
event.stopPropagation();
if (event.key === "Escape") {
event.preventDefault();
leave();
} else if (event.key === "Enter" && (event.ctrlKey || event.metaKey)) {
event.preventDefault();
save(area.value);
} else if (event.key === "Tab") {
const stops = [...box.querySelectorAll("textarea, button")];
const at = stops.indexOf(document.activeElement);
const next = (at + (event.shiftKey ? -1 : 1) + stops.length) % stops.length;
event.preventDefault();
stops[next].focus();
}
});
const row = document.createElement("div");
row.className = "ausboss-ask-row";
const gap = document.createElement("span");
gap.className = "gap";
row.append(
button("Back to built-in", "", () => { area.value = built; showState(); }),
state, gap,
button("Cancel", "", close),
saveButton,
);
box.append(title, hint, area, row);
back.append(box);
back.addEventListener("pointerdown", (event) => { if (event.target === back) leave(); });
document.body.append(back);
area.focus();
}
// The card's corner: { element, sync } for mountWidgetCard's corner option.
export function writerGear(node, card) {
ensureCss();
const gear = document.createElement("button");
gear.type = "button";
gear.className = "ausboss-card-gear";
gear.title = TITLE;
gear.innerHTML = gearIconSvg();
const open = async () => {
let built;
try {
built = await builtInAsks();
} catch {
built = null;
}
const edited = editedAsks(card.values().model_asks);
const schema = [
{ section: "Display (this browser)" },
{
key: "sockets", label: "Sockets", type: "choice", options: ["in use", "all"], default: "in use", persist: false,
hint: "In use shows the sockets you use and the next free picture.",
},
{ section: "What the model on clip is asked (saved in this node)" },
...ASKS.map((ask) => ({
key: `ask_${ask.key}`, label: ask.label, type: "action", button: "Edit",
hint: built ? (edited.has(ask.key) ? "Your wording." : "Built-in wording.") : "Restart ComfyUI to edit this.",
onAction: () => {
if (!built) return;
closeSettingsMenu();
openEditor(node, card, ask, built[ask.key] ?? "");
},
})),
];
openSettingsMenu({
scope: "h3_writer",
schema,
anchor: gear.getBoundingClientRect(),
title: TITLE,
initial: { sockets: app.extensionManager?.setting?.get?.(SHOW_ALL) ? "all" : "in use" },
onChange: (values, key) => {
if (key === "sockets") app.extensionManager?.setting?.set?.(SHOW_ALL, values.sockets === "all");
else if (key === null) reset();
},
});
};
// The menu's Reset: the sockets back to "in use" and every wording back
// to built-in, as one undo step, then the menu again to show it.
const reset = async () => {
try {
await app.extensionManager?.setting?.set?.(SHOW_ALL, false);
} catch {
// The menu shows what the setting holds.
}
if (editedAsks(card.values().model_asks).size) {
card.setWidget("model_asks", "");
card.refresh();
showToast({ summary: "H3 Prompt Writer", detail: "The model's wordings are back to built-in. Ctrl+Z brings yours back." });
}
closeSettingsMenu();
await open();
};
gear.addEventListener("click", open);
// Only the tabs make room for the gear (the style above); the rows under
// them keep the card's full width.
return { element: gear, sync: () => 0 };
}
+64
View File
@@ -0,0 +1,64 @@
// H3 Prompt Writer's model_asks: the node's own wording for each thing the
// small model is asked, as JSON in one hidden text input. Empty means the
// built-in wording. Kept free of app imports so node:test covers it.
const KEYS = ["describe", "next", "heard", "tidy"];
// The longest wording the writer reads (LONGEST_ASK in nodes/_h3_model_asks.py).
export const LONGEST_ASK = 8000;
export function readAsks(value) {
let found;
try {
found = value ? JSON.parse(value) : {};
} catch {
return {};
}
if (!found || typeof found !== "object" || Array.isArray(found)) return {};
const asks = {};
for (const key of KEYS) {
if (typeof found[key] === "string" && found[key].trim()) asks[key] = found[key];
}
return asks;
}
// The input's new text with one wording set, or taken out when empty.
export function writeAsks(value, key, words) {
const asks = readAsks(value);
if (String(words ?? "").trim()) asks[key] = String(words);
else delete asks[key];
return Object.keys(asks).length ? JSON.stringify(asks) : "";
}
export function editedAsks(value) {
return new Set(Object.keys(readAsks(value)));
}
// The names the writer fills into each wording (fill_words in
// nodes/_h3_script_helpers.py), and what each one tells the model.
const FILLS = {
next: { seconds: "how long the clip is", first: "what happens first", count: "how many lines to write" },
heard: { lines: "what happens in the clip" },
};
const NAME = /\{(\w+)\}/g;
const listed = (items) => (items.length < 2 ? items.join("") : `${items.slice(0, -1).join(", ")} and ${items.at(-1)}`);
const namesIn = (text) => [...new Set([...String(text ?? "").matchAll(NAME)].map((match) => match[1]))];
// What a node's own wording would lose, or send as typed, in plain words:
// a name the built-in wording fills in that it no longer has, and a name
// the writer does not fill in. Empty when it has neither.
export function wordingWarning(key, words, built) {
const fills = FILLS[key] ?? {};
const fillsIn = (name) => Object.hasOwn(fills, name);
const typed = namesIn(words);
const missing = namesIn(built).filter((name) => fillsIn(name) && !typed.includes(name));
const unknown = typed.filter((name) => !fillsIn(name));
const said = [];
if (missing.length) {
said.push(`Without ${listed(missing.map((name) => `{${name}}`))}, the model is not told ${listed(missing.map((name) => fills[name]))}.`);
}
if (unknown.length) {
const many = unknown.length > 1;
said.push(`${listed(unknown.map((name) => `{${name}}`))} ${many ? "are" : "is"} not filled in: the model reads ${many ? "them" : "it"} as typed.`);
}
return said.join(" ");
}
+117
View File
@@ -0,0 +1,117 @@
// Language for the pack's own node faces. ComfyUI translates node names and
// socket names from locales/<language>/nodeDefs.json; the controls the pack
// draws itself (widget cards, panels, bars, menus) are translated here.
//
// t("Preview") the Chinese text on a Chinese ComfyUI, else the same text
// translateText(text) the lookup alone, no locale check
//
// The Chinese table is js/shared/i18n_zh.mjs, keyed by the English text, so a
// string with no entry stays English. Only what is displayed changes; widget
// names, widget values and saved workflows never go through this.
import { PATTERNS, SCRUB_HINT_EN, SCRUB_HINT_ZH, ZH } from "./i18n_zh.mjs";
// "zh", "zh-CN", "zh-TW" ... all take the Chinese table.
export function isChineseLocale(code) {
return typeof code === "string" && /^zh(?:[-_]|$)/i.test(code.trim());
}
// ComfyUI's language setting, read each time so a changed setting is seen on
// the next call.
let localeSource = null;
// js/i18n/index.js hands over ComfyUI's own `app`, which is there before
// `window.app` is.
export function useLocaleSource(read) { localeSource = typeof read === "function" ? read : null; }
export function currentLocale() {
try {
const value = localeSource ? localeSource() : globalThis.app?.ui?.settings?.getSettingValue?.("Comfy.Locale");
return typeof value === "string" ? value : "";
} catch {
return "";
}
}
export const chineseActive = () => isChineseLocale(currentLocale());
// Look `text` up in the Chinese table, keeping any spaces around it. Returns
// the text itself when there is no entry.
export function translateText(text, table = ZH, patterns = PATTERNS) {
if (typeof text !== "string" || text === "") return text;
const trimmed = text.trim();
if (trimmed === "") return text;
// A number box's tooltip is "<its own tooltip> <the scrub hint>".
if (table === ZH && trimmed.endsWith(` ${SCRUB_HINT_EN}`)) {
const own = trimmed.slice(0, -SCRUB_HINT_EN.length - 1);
return text.replace(trimmed, () => `${translateText(own, table, patterns)} ${SCRUB_HINT_ZH}`);
}
const hit = Object.hasOwn(table, trimmed) ? table[trimmed] : undefined;
let result = typeof hit === "string" && hit !== "" ? hit : null;
if (result === null) {
for (const [pattern, build] of patterns) {
const match = pattern.exec(trimmed);
if (match) { result = build(...match); break; }
}
}
if (result === null) return text;
return text.replace(trimmed, () => result);
}
export function t(text) {
return chineseActive() ? translateText(text) : text;
}
// ---------- translating a face that is already built ----------
const ATTRIBUTES = ["title", "placeholder", "aria-label"];
// Text that belongs to the user or the graph, or that code reads back.
const SKIP = "[data-no-i18n],[class*='ausboss-callout'],[class*='ausboss-note'],.ausboss-show-text-body,.ausboss-lora-label";
// Text inside these is a value (what is typed, or the page's own scripts), not a label.
const VALUE_HOLDERS = "textarea,input,script,style,[contenteditable]";
const SCOPE = "[class*='ausboss']";
function inScope(element, text = false) {
if (!element?.closest?.(SCOPE) || element.closest(SKIP)) return false;
return !(text && element.closest(VALUE_HOLDERS));
}
function translateNode(node) {
if (node.nodeType === 3) {
const parent = node.parentElement;
// An <option>'s text is what the list shows; its value is its own attribute.
if (!parent || !inScope(parent, true)) return;
const next = translateText(node.nodeValue);
if (next !== node.nodeValue) node.nodeValue = next;
return;
}
if (node.nodeType !== 1 || !(node.matches?.(SCOPE) || node.querySelector?.(SCOPE) || node.closest?.(SCOPE))) return;
const walker = node.ownerDocument.createTreeWalker(node, 1 | 4);
const visit = (current) => {
if (current.nodeType === 3) translateNode(current);
else if (current.nodeType === 1 && inScope(current)) {
for (const name of ATTRIBUTES) {
const value = current.getAttribute(name);
if (!value) continue;
const next = translateText(value);
if (next !== value) current.setAttribute(name, next);
}
}
};
visit(node);
for (let current = walker.nextNode(); current; current = walker.nextNode()) visit(current);
}
// Keep every pack face in `root` translated, including text a face writes
// later. Returns a function that stops it.
export function followFaces(root = document.body) {
translateNode(root);
const observer = new MutationObserver((records) => {
for (const record of records) {
if (record.type === "characterData") translateNode(record.target);
else if (record.type === "attributes") translateNode(record.target);
else for (const added of record.addedNodes) translateNode(added);
}
});
observer.observe(root, { subtree: true, childList: true, characterData: true, attributes: true, attributeFilter: ATTRIBUTES });
return () => observer.disconnect();
}
+410
View File
@@ -0,0 +1,410 @@
// Simplified Chinese for the text the pack draws on its own node faces
// (widget cards, panels, bars and menus). The key is the English text as the
// code writes it; a string with no entry here simply stays English.
// Only what is DISPLAYED changes: widget names, values, saved workflows and
// the API prompt never see these strings.
//
// Product and model names (H3, Pika, Qwen, FlashVSR, LoRA, VRAM, SAM 3) and
// file names, codec names and algorithm names stay as they are.
export const ZH = {
// ---- card rows and group headers
"Lens": "镜头视角", "Crop margin": "裁剪边距", "360 width": "360 宽度",
"How wide the photo is, in degrees across. Wire Get FoV from MoGe here.": "照片横向有多宽,单位为度。把 MoGe 的“获取视角”接到这里。",
"Target": "目标", "Size": "尺寸", "Edge": "边缘", "Budget": "像素预算", "Scale": "缩放", "Fit": "适应",
"Fill": "填充", "Multiple": "倍数", "Filter": "滤镜", "Job": "任务", "Pieces": "分块数",
"Lock": "锁定", "Tolerance": "容差", "Feather": "羽化", "Remove tint": "去除偏色", "Strength": "强度",
"Method": "方法", "Reference": "参考", "Invert mask": "反转遮罩", "Megapixels": "百万像素",
"More": "更多", "MORE": "更多", "Tile size": "分块大小", "Overlap": "重叠", "Redraw limit": "重绘上限",
"Keep colors": "保持颜色", "Tone match": "色调匹配", "Fix edge halo": "修复边缘光晕", "Follow changes": "跟随变化",
"Context": "上下文", "Stay in picture": "不出画面", "Blend": "混合", "Grow": "扩大", "Blur": "模糊",
"Target size, extend": "目标尺寸与外扩", "Extra context": "额外上下文", "Target width": "目标宽度", "Target height": "目标高度",
"Rescale": "重新缩放", "Extend left": "向左外扩", "Extend right": "向右外扩", "Extend up": "向上外扩", "Extend down": "向下外扩",
"Expand": "扩张", "Fill holes": "填补孔洞", "Max hole size": "最大孔洞", "Smooth": "平滑", "Black point": "黑场", "White point": "白场",
"Detail range": "细节范围", "Fix threshold": "修正阈值",
"From": "来源", "Folder": "文件夹", "Subfolders": "子文件夹", "Order": "排序", "Run": "运行", "Picture": "图片",
"After a run": "运行之后", "At the end": "到末尾时", "Soften": "柔化", "Fine edges": "精细边缘", "Fill small holes": "填补小孔",
"Invert": "反转", "If nothing": "没选中时", "New picture": "换新图时", "Free VRAM": "释放显存", "Canvas": "画布",
"Find": "查找", "If several": "有多个时", "Sureness": "把握度", "FPS": "帧率", "Scene cut": "场景切换", "Batch": "批量",
"Model": "模型", "Mode": "模式", "Anchor": "对齐位置", "Pad fill": "扩边填充", "Pad color": "扩边颜色", "Color": "颜色",
"Empty fill": "空白填充", "Max zoom": "最大缩放", "Every nth": "每隔几帧", "Offset": "偏移", "Split after": "在此之后拆分",
"Mismatch": "尺寸不一致", "Value": "数值", "Split at": "拆分方式", "Numbering": "编号", "Limit": "数量上限",
"Length": "长度", "Camera": "镜头", "Look": "风格", "Song starts at": "歌曲起点", "Moments on the beat": "时刻对齐节拍",
"Language": "语言", "Clip's own sound": "素材自带声音", "Tidy up my lines": "整理我的台词", "Sound": "声音", "Music": "音乐", "Frame": "帧",
"KV cache": "KV 缓存", "VLM reference": "VLM 参考", "Source": "素材", "Width": "宽度", "Height": "高度",
"Longest side": "最长边", "Ratio": "比例", "Keep": "保留", "Round to": "取整到", "Enlarge": "放大小图",
"Backdrop": "背景虚化", "Exact padding": "精确扩边", "Left": "左", "Top": "上", "Right": "右", "Bottom": "下",
"Prefix": "文件名前缀", "Format": "格式", "FPS · CRF": "帧率 · CRF", "Ping-pong": "往返播放", "Embed workflow": "嵌入工作流", "Embed": "嵌入",
"Pictures and settings": "图片与设置", "What H3 gets": "H3 收到的内容", "What happens": "发生了什么",
"Align": "对齐", "Aspect ratio": "画面比例", "Crop, pad & resize": "裁剪、扩边与缩放", "Duration": "时长", "Ends at": "结束于",
"Frames for": "帧数用于", "Start": "起点", "Whole video": "整段视频", "Clip IN": "片段入点", "Clip OUT": "片段出点",
"Colors": "颜色", "Preview steps": "预览步骤", "Show picture": "显示图片", "Preview": "预览",
"Settings": "设置", "Show as": "显示为", "When off": "关闭时", "Group order": "分组顺序", "Groups": "分组", "Inputs": "输入", "Outputs": "输出",
"Fit to ratio": "适应比例", "Hold the shape": "保持形状", "Box 1 is": "框 1 是",
// ---- on / off pills and short states
"on": "开", "off": "关", "On": "开", "Off": "关", "keep": "保留", "remove": "移除", "once per run": "每次运行一次", "every step": "每一步",
"Pause": "暂停", "wait for me": "等我取景", "run through": "直接运行",
"forward, back": "正放、倒放", "not used": "未使用", "by blend in": "(融合模式下)", "blend in": "融合", "blend": "混合",
// ---- choice labels
"Width × height": "宽 × 高", "Longest edge": "最长边", "Shortest edge": "最短边", "Scale factor": "缩放倍数",
"cover": "填满", "fit": "适应", "fit inside": "放入框内", "crop to fill": "裁剪填满", "crop to ratio": "按比例裁剪", "crop": "裁剪",
"pad": "扩边", "resize": "缩放", "stretch": "拉伸", "megapixels": "百万像素", "longest side": "最长边", "scale": "缩放",
"hist": "直方图", "histogram": "直方图", "first frame": "首帧", "reference": "参考图", "guided": "引导", "matting": "抠图",
"optical flow (RAFT)": "光流 (RAFT)", "match a": "匹配 a", "match b": "匹配 b", "error": "报错", "source rect": "源矩形",
"whole canvas": "整个画布", "all in one run": "一次全部", "one per run": "每次一张", "all of them": "全部", "none": "无", "None": "无",
"any": "任意", "always": "始终", "auto": "自动", "stay": "保持", "start over": "重新开始", "keep picks": "保留选择",
"stop the run": "停止运行", "empty mask": "空遮罩", "newest first": "最新在前", "oldest first": "最旧在前", "random": "随机", "Random": "随机",
"next": "下一张", "name": "名称", "title": "标题", "canvas": "画布", "each line": "每行一次", "blank line": "空行分隔",
"rows": "逐行", "one pill": "单选", "bypass": "绕过", "mute": "静音", "mirror": "镜像", "follow": "跟随", "linked": "已连接",
"gray": "灰色", "edge": "边缘", "edge pixel": "边缘像素", "color": "纯色", "pillarbox blur": "两侧虚化", "replicate": "复制边缘",
"source": "原图", "as typed": "照输入", "from the picture": "取自图片", "text": "文字", "object": "物体", "still": "静止", "handheld": "手持",
"shaky": "抖动", "push in": "推近", "pull back": "拉远", "orbit": "环绕", "walking pov": "步行视角", "anime": "动漫", "comic book": "漫画",
"pencil sketch": "铅笔素描", "watercolor": "水彩", "split sheet at gaps": "按空隙拆分拼图", "cut a piece": "裁出一块", "Move right": "右移", "Move down": "下移", "Position": "位置", "Pad": "扩边", "Crop": "裁剪",
"Resize": "缩放", "Center": "居中", "Soft": "柔和", "Simple": "简易", "Full prompt": "完整提示词", "Text": "文字", "Fixed": "固定",
"LTX (8n+1)": "LTX (8n+1)", "Wan (4n+1)": "Wan (4n+1)", "Every group": "每个分组", "Numbered groups": "编号分组",
"Titles matching…": "按标题匹配…", "No groups": "没有分组", "All": "全部", "Background": "背景", "Subject": "主体",
// ---- buttons, bars, captions
"Add": "添加", "Browse": "浏览", "Clear": "清除", "Done": "完成", "Erase": "擦除", "Paint": "绘制", "Pick": "选取", "Load": "加载",
"Open editor": "打开编辑器", "Reset": "重置", "Reset crop": "重置裁剪", "Reset padding": "重置扩边", "Reset to written": "恢复为所写内容",
"Undo": "撤销", "Use as start": "设为起点", "Use last run": "用上次的", "New seed": "新种子", "Step +1": "步进 +1", "STOP": "停止",
"FIND": "查找", "FRAME": "帧", "LOOP": "循环", "AUTO": "自动", "Turn": "旋转", "Step": "步进", "Match": "匹配",
"+ Choice": "+ 选项", "+ LoRA": "+ LoRA", "+ new": "+ 新建", "+ video": "+ 视频", "Layouts ▾": "布局 ▾",
"Select nodes, then add a switch": "先选中节点,再添加开关", "Description": "说明",
"Choose a file…": "选择文件…", "Choose a sound file": "选择声音文件", "Choose an input video…": "选择输入视频…",
"Choose an uploaded image…": "选择已上传的图片…", "Choose an uploaded video…": "选择已上传的视频…",
"Choose or upload a video": "选择或上传视频", "Choose an input image": "选择输入图片", "Choose an input video": "选择输入视频",
"Copy a folder from your computer": "从电脑复制一个文件夹", "Load image": "加载图片", "Load video": "加载视频",
"Connect a mask to see it here": "连接遮罩即可在此查看", "Connect an image to see it here": "连接图像即可在此查看",
"Connect frames to see it here": "连接帧即可在此查看",
"Connect a picture or a video. H3 needs one to start from.": "请连接一张图片或一段视频,H3 需要一个起点。",
"Drag on the canvas to draw a box": "在画布上拖动来画一个框",
"Each box you draw gets its words here: a thing to show, or text to write in the picture.": "你画的每个框都在这里写描述:要显示的东西,或要写在图里的文字。",
"Edited by you. This text is sent as it is; the Simple tab is not used until you reset.": "已由你修改。这段文字将原样发送,重置之前不会使用“简易”标签页。",
"Edited: this text is sent instead of the Simple tab.": "已修改:发送的是这段文字,而不是“简易”标签页。",
"Full prompt is edited, so these lines are not used until you reset it there.": "完整提示词已被修改,所以这些行在那边重置之前不会使用。",
"Filled in after each run.": "每次运行后自动填入。",
"No LoRAs yet": "还没有 LoRA", "no LoRAs": "没有 LoRA", "No pictures here yet. Drop a folder or pictures on the node, or bring a folder in:": "这里还没有图片。把文件夹或图片拖到节点上,或导入一个文件夹:",
"no pictures": "没有图片", "Working on the fine details…": "正在处理细节…", "Run to preview the saved video": "运行后预览保存的视频",
"run the graph to see the text that arrives here": "运行工作流即可在此看到传入的文字",
"rolls a new seed each queue": "每次排队都会换新种子", "Source · feather 24 px": "素材 · 羽化 24 px",
"Select the nodes of one part, such as a box and its Save, then press + Switch.": "选中某个部分的节点(例如一个框和它的保存节点),然后点“+ 开关”。",
"Choose an uploaded image or drop one onto this node.": "选择已上传的图片,或把图片拖到此节点上。",
"Choose an uploaded video or add one to ComfyUI's input folder.": "选择已上传的视频,或把视频放进 ComfyUI 的 input 文件夹。",
"Choose a file from ComfyUI's input folder or load a new image.": "从 ComfyUI 的 input 文件夹选择文件,或加载新图片。",
"Choose a file from ComfyUI's input folder or load a new video.": "从 ComfyUI 的 input 文件夹选择文件,或加载新视频。",
"Choose a rendered image from ComfyUI's output folder.": "从 ComfyUI 的 output 文件夹选择已生成的图片。",
"Choose a rendered video from ComfyUI's output folder.": "从 ComfyUI 的 output 文件夹选择已生成的视频。",
"Choose a picture or video to center.": "选择要居中的图片或视频。",
"Upload a picture into ComfyUI's input folder": "把图片上传到 ComfyUI 的 input 文件夹",
"Upload an image into ComfyUI's input folder": "把图片上传到 ComfyUI 的 input 文件夹",
"Upload a video into ComfyUI's input folder": "把视频上传到 ComfyUI 的 input 文件夹",
"Upload a sound file into ComfyUI's input folder": "把声音文件上传到 ComfyUI 的 input 文件夹",
// ---- tooltips written in the pack's own code
"Add a LoRA": "添加 LoRA", "Pick one LoRA, or click a folder name to add all its LoRAs.": "选一个 LoRA,或点文件夹名把里面的 LoRA 全部加入。",
"Re-check LoRA files: refresh the list and reconnect rows whose files moved or came back": "重新检查 LoRA 文件:刷新列表,并重新连接文件被移动或重新出现的行",
"LoRA templates: save this stack, or apply a saved one": "LoRA 模板:保存当前这组,或套用已保存的",
"Toggle every LoRA: mixed saves your setup and turns all on; on turns all off; off brings your saved setup back": "切换所有 LoRA:混合时保存当前设置并全部开启;全开时全部关闭;全关时恢复你保存的设置",
"Serialized LoRA stack managed by the node's row editor; edit the rows, not this value.": "由节点的行编辑器管理的 LoRA 列表;请编辑各行,不要改这个值。",
"LoRA Loader settings": "LoRA 加载器设置",
"Click to type a seed": "点击输入种子", "Copy the seed": "复制种子", "Copy the text": "复制文字", "Earlier seeds this node ran with": "此节点用过的历史种子",
"Increment the seed after each queue (click again for decrement)": "每次排队后种子加 1(再点一次改为减 1)",
"Keep this seed for every queue": "每次排队都用这个种子",
"Put the last run's seed back and pin it (Fixed)": "恢复上次运行的种子并固定",
"Roll a fresh seed and pin it (Fixed)": "随机一个新种子并固定",
"Roll a new seed after every queue": "每次排队后随机新种子",
"Rolls a new seed after each run. Tap for Fixed.": "每次运行后随机新种子。点一下切换为固定。",
"Seed settings: full or compact look": "种子设置:完整或紧凑外观", "Number settings": "数字设置", "Text settings": "文字设置",
"Image Crop + Rotate + Pad settings": "图像裁剪 + 旋转 + 扩边设置", "Stitch Inpaint settings": "拼回重绘设置",
"Step down; Shift = fine.": "减小;按住 Shift 精细调节。", "Step up; Shift = fine.": "增大;按住 Shift 精细调节。",
"Arithmetic over a, b and c: numbers, + - * / // % **, parentheses, and min/max/abs/round/floor/ceil/sqrt.": "对 a、b、c 做运算:数字、+ - * / // % **、括号,以及 min/max/abs/round/floor/ceil/sqrt。",
"Center side to side": "左右居中", "Center top to bottom": "上下居中",
"Choose how to reach the next ratio. Crop trims the picture and Pad adds fill.": "选择如何达到下一个比例:裁剪会切掉画面,扩边会补上填充。",
"Comma-separated text; a group is listed when its title contains any of it": "用逗号分隔的文字;分组标题包含其中任意一项就会列出",
"Drag a handle to set where the sound starts or stops. Drag the middle to slide it.": "拖动手柄设置声音的起点或终点,拖动中间可整体滑动。",
"Drag to change the Duration; the start stays.": "拖动来改变时长,起点不变。",
"Drag to move the clip; its Duration stays. Shift + arrow moves one frame.": "拖动来移动片段,时长不变。Shift + 方向键每次移动一帧。",
"Drag to slide the clip; its Duration stays.": "拖动来滑动片段,时长不变。",
"Fill #000000": "填充 #000000", "Fill #808080": "填充 #808080",
"Fill colour of the padding and rotation corners. Now #808080.": "扩边和旋转后空角的填充颜色。当前为 #808080。",
"Keep the canvas size.": "保持画布尺寸。", "Keep the whole picture and add fill to reach the selected ratio.": "保留整张图片,并补上填充以达到所选比例。",
"Trim the picture to the selected ratio.": "把图片裁剪到所选比例。",
"Pad to 16:9: keep every pixel and add fill around it.": "扩边到 16:9:保留每个像素,四周补上填充。",
"Pad to 1:1: keep every pixel and add fill around it.": "扩边到 1:1:保留每个像素,四周补上填充。",
"Pad to 21:9: keep every pixel and add fill around it.": "扩边到 21:9:保留每个像素,四周补上填充。",
"Pad to 3:2: keep every pixel and add fill around it.": "扩边到 3:2:保留每个像素,四周补上填充。",
"Pad to 4:3: keep every pixel and add fill around it.": "扩边到 4:3:保留每个像素,四周补上填充。",
"Tap a ratio to pad the picture to it (or crop it, with Fit on crop). Tap the lit one to go back to the whole picture.": "点一个比例,把图片扩边到该比例(“适应”选裁剪时则是裁剪)。再点亮着的那个可回到完整图片。",
"Show the portrait ratios": "显示竖版比例", "Show ratio, fit, align, fill, feather, center and resize settings": "显示比例、适应、对齐、填充、羽化、居中和缩放设置",
"Reset rotation, crop and padding, and turn the padlock off. Fill, feather, Align and the timeline stay.": "重置旋转、裁剪和扩边,并解除锁定。填充、羽化、对齐和时间线保持不变。",
"Show the whole picture again; rotation, padding and the timeline stay. With the padlock on, the bands it added to keep the shape go too.": "重新显示整张图片;旋转、扩边和时间线保持不变。锁定时,为保持形状而补的边也会去掉。",
"The diamonds and crop squares drag freely; the orange corners always keep the shape. Tap to hold this shape whatever you drag.": "菱形和裁剪方块可自由拖动;橙色角点始终保持形状。点一下,无论怎么拖都保持当前形状。",
"Make the canvas width and height multiples of this number before resizing. Padding grows or unpadded edges are trimmed. Use 1 to turn alignment off.": "缩放前先让画布宽高成为此数的倍数。扩边会加大,没扩边的边缘会被裁掉。填 1 表示不对齐。",
"Rounds each resized side to a multiple of this (32 for LTX and Wan, 8 or 64 for image models). Each side rounds on its own, so a large step can stretch the picture slightly; the readout warns above 1%.": "把缩放后的每条边取整为此数的倍数(LTX 和 Wan 用 32,图像模型用 8 或 64)。每条边各自取整,步长大时画面可能略有拉伸;超过 1% 时读数会提醒。",
"Output budget in megapixels (x 1024x1024). The size readout under the picture shows where it lands.": "输出像素预算,单位百万像素(x 1024x1024)。图片下方的尺寸读数会显示最终大小。",
"Resize the output to a megapixel budget, each side rounded to the step (32 for LTX and Wan).": "把输出缩放到像素预算,每条边取整到步长(LTX 和 Wan 用 32)。",
"Resize to the megapixel budget and round each side to the step.": "缩放到像素预算,每条边取整到步长。",
"Feather of the mask into the kept pixels; the image keeps a hard edge against the fill.": "遮罩向保留像素内的羽化;图片与填充之间保持硬边。",
"Feather of the mask into the kept frames, in pixels. The frames keep a hard edge against the fill whatever the feather, so a black-band outpaint still sees its bars.": "遮罩向保留画面内的羽化,单位像素。无论羽化多少,画面与填充之间都保持硬边,所以黑边外扩仍能看到黑条。",
"Where the clip starts in the source video.": "片段在源视频中的起点。", "Where the clip ends in the source video. Typing it changes the Duration.": "片段在源视频中的终点。输入它会改变时长。",
"Start the clip at the frame on the stage. The Duration stays.": "让片段从舞台上当前这一帧开始,时长不变。",
"How long the clip is. Counted in clip frames at the output rate.": "片段有多长,按输出帧率的片段帧数计算。",
"How long the sound is. Clear it, or type 0, to run to the end of the file.": "声音有多长。清空或输入 0 表示播到文件末尾。",
"Clean up": "清理", "For a voice recording. On cuts the quiet bits at the start and end, takes out hum and hiss, and evens out the volume. Off hands on the sound as it is.": "用于人声录音。开启后会剪掉开头和结尾的安静部分,去掉嗡嗡声和嘶嘶声,并让音量保持均匀。关闭则按原样输出声音。",
"Where the sound starts in the file, of 0:00.": "声音在文件中的起点,从 0:00 起算。", "Where the sound stops in the file. Typing it changes the Duration.": "声音在文件中的终点。输入它会改变时长。",
"Keep a frame count the video model takes: LTX wants 8n+1 (49, 97, 121), Wan 4n+1. The Duration steps to those counts. Any keeps every frame.": "保留视频模型能接受的帧数:LTX 需要 8n+1(49、97、121),Wan 需要 4n+1。时长会按这些帧数步进。选“任意”则保留每一帧。",
"Keep one frame in this many. Output fps is adjusted to keep real-time playback; the Duration counts the frames kept.": "每隔这么多帧保留一帧。输出帧率会随之调整以保持实时播放;时长按保留的帧数计算。",
"Use the whole video: start at 0 with no Duration limit. Keeps Every nth and Frames for.": "使用整段视频:从 0 开始,不限制时长。“每隔几帧”和“帧数用于”仍然有效。",
"Play it again and again": "循环播放", "Play the clip from its start": "从头播放片段", "Play the part that comes out": "播放最终输出的部分",
"Show times in frames: source frames for Start and Ends at, clip frames for Duration.": "以帧显示时间:起点和终点用源视频帧,时长用片段帧。", "Show times in seconds.": "以秒显示时间。",
"Playback frame rate; wire Load Video's fps output to match the source. A connected video input brings its own rate and overrides this widget. Fractional rates like 23.976 and 29.97 can be typed in.": "播放帧率;把加载视频的 fps 输出连过来可与源视频一致。连接了视频输入时会使用它自带的帧率,并覆盖这个控件。可以输入 23.976、29.97 这类小数帧率。",
"Play 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.": "先正放再倒放,让片段无缝循环。帧数和编码时间大约翻倍;转折处首尾帧不会重复。",
"On embeds the workflow in the video file, so dropping the file back on the canvas restores the graph that made it.": "开启后会把工作流嵌入视频文件,把文件拖回画布即可还原生成它的工作流。",
"Container and codec. mp4 h264 plays everywhere; mp4 h265 halves the size at the same quality where supported; the nvenc pair encodes on an NVIDIA GPU instead of the CPU (much faster, slightly larger); webm vp9 and webm av1 suit the web and mux Opus; mov prores": "封装格式和编码。mp4 h264 到处都能播放;mp4 h265 在支持的设备上同画质体积减半;两个 nvenc 选项用 NVIDIA 显卡而不是 CPU 编码(快得多,体积略大);webm vp9 和 webm av1 适合网页并封装 Opus;mov prores",
"Encode quality: lower is better and larger. 19 is visually lossless for h264; h265 and vp9 read the same scale (vp9 tolerates a few points higher).": "编码质量:数值越小画质越好、文件越大。h264 用 19 在视觉上无损;h265 和 vp9 用同样的刻度(vp9 可以高几个点)。",
"Show the clip here while it is being made: after each step, a few of its frames play in a loop, with a Stop button. Off by default.": "生成过程中在这里显示片段:每一步之后循环播放其中几帧,并带一个停止按钮。默认关闭。",
"Stop this run now. The next run in the queue still starts.": "立即停止这次运行。队列里的下一次运行仍会开始。",
"Moves each moment onto the nearest beat of the song. Pick off to keep your own seconds.": "把每个时刻移到歌曲最近的节拍上。选“关”则保留你自己写的秒数。",
"The second of the song to start from, so the clip gets the good part.": "从歌曲的第几秒开始,让片段用上最精彩的部分。",
"This video job uses the incoming clip, so Length is not used.": "这个视频任务使用传入的片段,所以不使用“长度”。", "From the clip": "取自片段",
"Plug a picture into picture_1 to name it @1 in your lines.": "把图片接到 picture_1,就能在文字里用 @1 称呼它。",
"Plug a picture into picture_2 to name it @2 in your lines.": "把图片接到 picture_2,就能在文字里用 @2 称呼它。",
"Plug a picture into picture_3 to name it @3 in your lines.": "把图片接到 picture_3,就能在文字里用 @3 称呼它。",
"Plug a picture into picture_4 to name it @4 in your lines.": "把图片接到 picture_4,就能在文字里用 @4 称呼它。",
"Plug a video into video to copy its moves, swap the person, keep it going or give it a new voice.": "把视频接到 video,可以复制它的动作、换人、接着往下拍,或换一个新声音。",
"Turn on when a swap keeps the video's own sound. Each line is timed from that sound, and words from anyone else are left out so only the new person's mouth moves.": "换人并保留视频原声时开启。每一行按原声计时,其他人的台词会被去掉,只有新人物的嘴在动。",
"Run the workflow once and the prompt the node writes shows here. Change it to send your own.": "运行一次工作流后,节点写出的提示词会显示在这里。修改它就会发送你自己的版本。",
"The prompt the node wrote on its last run. Change it here to send your own.": "节点上次运行写出的提示词。在这里修改即可发送你自己的版本。",
"Throw your edit away and send what the Simple tab writes again.": "放弃你的修改,重新发送“简易”标签页写出的内容。",
"What H3 gets. Type here to send your own text instead of the node's.": "H3 收到的内容。在这里输入即可用你自己的文字代替节点写的。",
"What happens, one line for each moment. A blank line cuts to a new place. @1 is Picture 1. Start a line with 3s: to put it on that second.": "发生了什么,每个时刻写一行。空行表示切到新的地点。@1 是图片 1。行首写 3s: 可把它放在第 3 秒。",
"Type what happens, one line for each thing. Picture 1 is @1. A blank line cuts to a new place.\n\nSwap: leave empty, or name who goes. Optional new look on its own line: @1 looks like a woman with blonde hair and a black hoodie.": "输入发生了什么,每件事一行。图片 1 是 @1。空行表示切到新的地点。\n\n换人:留空,或写明换掉谁。新造型可单独写一行:@1 是一位金发、穿黑色连帽衫的女士。",
"Your lines, the pictures and the menus. The node writes the full prompt from them.": "你写的文字、图片和各个菜单。节点会据此写出完整提示词。",
"What you can type in the words": "文字里可以怎么写", "rain on a window": "窗上的雨声", "slow piano: music makes it louder": "舒缓钢琴:加了音乐会更响", "(e.g. rain on a window)": "(例如:窗上的雨声)", "(e.g. slow piano)": "(例如:舒缓钢琴)",
"upscale, face": "放大, 人脸",
"Switching a row on switches the other rows off - for alternatives such as two upscalers.": "打开一行会关掉其他行,适合在两个放大器这类互斥方案之间切换。",
"Rows gives each switch a row with its own off | on. One pill makes the switches choices in a single pill, where one is always picked.": "“逐行”让每个开关各占一行,各自有关 | 开。“单选”把这些开关合成一个选项条,始终选中其中一个。",
"Show only the labels and their switches. Double-click a label, or right-click the node, to edit again.": "只显示名称和开关。双击名称或右键节点可重新编辑。",
"Select the nodes of one part on the canvas, then press this: they get one switch": "在画布上选中某一部分的节点再按这里,它们会得到一个开关",
"Set the nodes the way this choice should be, then press this and give it a name. Do it again for each choice: the card becomes one pill, and picking one sets the nodes that way.": "先把节点调成这个选项该有的样子,再按这里并起个名字。每个选项都这样做一遍:卡片会变成一个选项条,选中某项就会把节点设成对应状态。",
"What a switched-off part does. Bypass: its nodes hand their inputs straight through, so the rest of the workflow still runs. Mute: its nodes do not run, and nor does anything that needs their output.": "关闭的部分怎么处理。绕过:节点把输入直接传出去,工作流其余部分照常运行。静音:节点不运行,依赖它们输出的节点也不运行。",
"What off means, which groups get a switch of their own, and their order": "“关”是什么意思、哪些分组有各自的开关,以及它们的顺序",
"Which groups get a switch of their own, listed under the switches you made: none, every group, the numbered ones (titles starting with a digit, like 1 · Load), or titles matching text.": "哪些分组有各自的开关,列在你创建的开关下面:无、每个分组、编号分组(标题以数字开头,如 1 · Load),或标题匹配某段文字。",
"The order of the group rows. Canvas: the way the workflow reads, column by column from the left and top to bottom within a column. Title: by title, with numbers in numeric order.": "分组行的顺序。画布:按工作流的阅读顺序,从左到右逐列,每列从上到下。标题:按标题排序,数字按数值大小排。",
"Toggle looping for this saved preview": "切换此预览的循环播放",
// ---- tooltips of the nodes the Person Swap and Pika Remix workflows use
"A sound file in ComfyUI's input folder. Use Upload to add one.": "ComfyUI input 文件夹里的声音文件。用“上传”添加新的。",
"Fill colour of the padding and rotation corners. Video outpaint models key on it: the LTX IC-LoRA paints pure black (#000000) and leaves other colours alone. Now #000000.": "扩边和旋转后空角的填充颜色。视频外扩模型会以它为依据:LTX IC-LoRA 画纯黑(#000000),其他颜色保持不动。当前为 #000000。",
"Container and codec.": "封装格式和编码。mp4 h264 到处都能播放;mp4 h265 在支持的设备上同画质体积减半;两个 nvenc 选项用 NVIDIA 显卡而不是 CPU 编码(快得多,体积略大);webm vp9 和 webm av1 适合网页并封装 Opus;mov prores 是 ProRes HQ 剪辑母版;mkv ffv1 是逐位无损,文件非常大;gif 和 webp 没有声音、无限循环,并把每一帧都放进内存,只适合短片段。",
"Feather of the mask into the kept frames, in pixels. The frames keep a hard edge against the fill whatever the feather, so a black-band outpaint still sees its bars.": "遮罩向保留画面内的羽化,单位像素。无论羽化多少,画面与填充之间都保持硬边,所以黑边外扩仍能看到黑条。",
"From the picture keeps your photo's look. The others redraw it in that style.": "“取自图片”保留你照片原本的样子,其他选项会把它重绘成对应风格。",
"How long the clip is. Plan on about one moment a second at most.": "片段有多长。大约每秒最多安排一个时刻。",
"How many times larger each side gets. 1 keeps the size and only sharpens.": "每条边放大多少倍。1 表示尺寸不变,只做锐化。",
"How the camera moves the whole way through. As typed leaves it to your words; with a video wired it shows as from the video and keeps the video's own camera.": "镜头从头到尾怎么运动。“照输入”交给你写的文字;连了视频时显示为“取自视频”,沿用视频自带的镜头。",
"Keeps each frame's colours the same as your video. Leave it on.": "让每一帧的颜色与你的视频保持一致。建议保持开启。",
"Saved under the output folder; subfolders are created automatically.": "保存在 output 文件夹下;子文件夹会自动创建。",
"The FlashVSR model file, from ComfyUI/models/diffusion_models.": "FlashVSR 模型文件,位于 ComfyUI/models/diffusion_models。",
"The integer to output.": "要输出的整数。",
"The language of the words in quotes.": "引号里台词所用的语言。",
"The music, like a slow lo-fi beat. A clip with music comes out louder. Empty means no music.": "音乐,比如舒缓的 lo-fi 节奏。带音乐的片段声音会更响。留空表示没有音乐。",
"What you hear the whole way through, like rain on a window. Leave it empty for none.": "从头到尾都能听到的声音,比如窗上的雨声。留空表示没有。",
"Play": "播放",
"Load image": "加载图片",
"Load video": "加载视频",
"One at a time": "一次一个",
"applies to the next ratio": "应用于下一个比例",
"rain on a window": "窗上的雨声",
// ---- card tooltips and placeholders
"Size of the finished picture. 0 keeps the picture's own size.": "成品图片的大小。0 表示保持图片原有大小。",
"Used only while Fill holes is on.": "仅在“填补孔洞”开启时使用。",
"Used only while Edge is on.": "仅在“边缘”开启时使用。",
"Used only while Edge is matting.": "仅在“边缘”为抠图(matting)时使用。",
"the folder itself": "文件夹本身",
"Choose a folder inside ComfyUI's input or output folder.": "选择 ComfyUI 的 input 或 output 文件夹里的一个文件夹。",
"Prompt, caption, or shared text": "提示词、字幕或共用文字",
"type here": "在此输入",
"One line for each run": "每次运行写一行",
"A woman in a {red|blue|green} {sweater|jacket}. One choice is picked from each set.": "一位穿着{红色|蓝色|绿色}{毛衣|夹克}的女士。每组花括号里会随机选一项。",
"Prompt - describe the whole finished canvas": "提示词:描述整个成品画面",
"Negative prompt (ignored at CFG 1)": "负面提示词(CFG 为 1 时忽略)",
"On, the vision tower also sees the reference images. Use on for AnyPaint with a whole-canvas reference; use off for Registered Outpaint with a source-rectangle reference. Match the adapter's conditioning contract.": "开启时,视觉模块也会看到参考图。AnyPaint 配整张画布的参考图时开启;Registered Outpaint 配源矩形参考图时关闭。要与适配器的条件约定保持一致。",
"0 keeps the source width; set one side only to keep the aspect.": "0 表示保持源宽度;只设一边即可保持宽高比。",
"0 keeps the source height; set one side only to keep the aspect.": "0 表示保持源高度;只设一边即可保持宽高比。",
"Lock the untouched parts; step aside when the whole picture changes": "锁住没改动的部分;整张图都变了就不介入",
"Lock even when the whole picture changes": "即使整张图都变了也锁定",
"Do nothing": "什么都不做",
"A separate horizontal and vertical zoom plus a shift: how Qwen edits drift": "水平和垂直方向各自缩放,再加平移:Qwen 编辑后画面通常就是这样偏移的",
"Also a slight rotation or shear": "另外还修正轻微的旋转或倾斜",
"Stretch the nearest edge pixels": "拉伸最近的边缘像素",
"The original's pixels": "使用原图的像素",
"Flat #808080, for an inpaint pass": "纯 #808080,用于重绘",
"resize b to a's size": "把 b 缩放到 a 的尺寸",
"resize a to b's size": "把 a 缩放到 b 的尺寸",
// ---- panels, menus and lists of the same nodes
"Absorb chain LoRAs": "并入串联的 LoRA",
"Add your own trigger word...": "添加自己的触发词…",
"Adds 1 after each run. Tap for -1.": "每次运行后加 1。点一下改为减 1。",
"Advisory range for this LoRA; out-of-range strengths tint orange on the row.": "这个 LoRA 的建议范围;超出范围的强度会让该行显示为橙色。",
"Asks civitai.com about this one file, from this browser.": "由此浏览器向 civitai.com 查询这一个文件。",
"Audio preview unavailable ⓘ": "无法预览音频 ⓘ",
"Audio preview unavailable. Show details.": "无法预览音频。查看详情。",
"Back to defaults for this node type": "恢复此节点类型的默认值",
"Changed from the suggested value": "与建议值不同",
"Choice": "选项",
"Choose a source to set the clip": "先选择素材,再设置片段",
"Choose a source to begin": "选择素材后开始",
"Civitai lookup button": "Civitai 查询按钮",
"Civitai lookup failed": "Civitai 查询失败",
"Civitai picture": "Civitai 图片",
"Close without saving: puts back everything as it was when the editor opened (Esc)": "不保存关闭:恢复为打开编辑器时的样子(Esc)",
"Crop image — right-click to copy": "裁剪后的图片,右键可复制",
"Default strength": "默认强度",
"Drag to move the whole group": "拖动可移动整个分组",
"Drag to reorder": "拖动可调整顺序",
"Each line becomes a moment. A blank line between lines is a cut.": "每一行是一个时刻,两行之间的空行表示切换场景。",
"Enable or disable this LoRA": "启用或停用这个 LoRA",
"Fetching...": "获取中…",
"Fetch all LoRAs": "获取全部 LoRA",
"Fetch Civitai info for every LoRA in this stack that has none yet, one at a time.": "逐个为这组中还没有 Civitai 信息的每个 LoRA 获取信息。",
"Fetching Civitai info for every LoRA in this stack that has none yet, one at a time. Click to stop after the current one.": "正在逐个为这组中还没有 Civitai 信息的每个 LoRA 获取信息。点击可在当前这个完成后停止。",
"Civitai info for every LoRA": "为全部 LoRA 获取 Civitai 信息",
"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.": "逐个查询这组中还没有 Civitai 信息的每个 LoRA,方式与信息卡里的按钮相同。节点底部会显示进度;点击那里可停止。",
"Stopping...": "正在停止…",
"Civitai: checking · Stop": "Civitai:检查中 · 停止",
"Group name": "分组名称",
"Held": "已锁定",
"Hide file extension": "隐藏文件扩展名",
"Hide folder names": "隐藏文件夹名",
"Keeps this seed for every run. Tap for +1.": "每次运行都用这个种子。点一下改为加 1。",
"Loading…": "加载中…",
"Long names": "长名称",
"Mask feather in pixels.": "遮罩羽化,单位像素。",
"More ratios": "更多比例",
"Name this stack; saving over an existing name replaces it": "给这组 LoRA 起个名字;用已有名字保存会覆盖它",
"Not found on Civitai": "Civitai 上没有找到",
"Output budget in megapixels (x 1024x1024).": "输出像素预算,单位百万像素(x 1024x1024)。",
"Playhead frame / last frame": "当前帧 / 最后一帧",
"Preview thumbnails": "预览缩略图",
"Preview, base model, and trigger words": "预览图、基础模型和触发词",
"Put this seed back and pin it": "恢复这个种子并固定",
"Remove all padding.": "清除所有扩边。",
"Rotation in degrees: 1° per step, Shift for 0.1°. The crop stays over the same part of the picture.": "旋转角度:每步 1°,按住 Shift 为 0.1°。裁剪框保持在画面的同一部分上。",
"Rounds each resized side to a multiple of this (32 for LTX and Wan).": "把缩放后的每条边取整为此数的倍数(LTX 和 Wan 用 32)。",
"Rows on the box": "框上的行",
"Save current as...": "另存当前为…",
"Scrub strength on the name": "在名称上拖动调节强度",
"Search LoRAs": "搜索 LoRA",
"Search LoRAs...": "搜索 LoRA…",
"Seed settings": "种子设置",
"Select every node this switch turns off and on": "选中此开关控制的所有节点",
"Select nodes or groups on the canvas first, then add them to this switch": "先在画布上选中节点或分组,再把它们加入这个开关",
"Select nodes that run only while this is off, then take them off that side. They stay as they are.": "选中只在此项关闭时才运行的节点,再把它们放到“关”的一侧。节点本身保持原样。",
"Select nodes this switch holds first, then take them out of it": "先选中此开关管理的节点,再把它们移出",
"Select the nodes only this choice needs. They are switched off while another choice is picked.": "选中只有这个选项才需要的节点。选了其他选项时,它们会被关闭。",
"Separate model / CLIP strength": "分开设置模型 / CLIP 强度",
"Set the nodes the way this choice should be, then pick this": "先把节点调成这个选项该有的样子,再选中它",
"Show the mask on the picture": "在图片上显示遮罩",
"Stop on missing LoRA": "缺少 LoRA 时停止",
"Strength bars": "强度条",
"Strength step": "强度步长",
"Linked strength wires": "强度连线显示", "shown": "显示", "on hover": "悬停时显示", "hidden": "隐藏",
"Unlink strength": "断开强度连线", "link": "连线",
"Takes 1 off after each run. Tap for Random.": "每次运行后减 1。点一下改为随机。",
"The words come from the wire.": "文字来自连线。",
"from a link": "来自连线",
"Set by a link into this input. Remove the link to type a value here.": "由连到这个输入的连线设置。断开连线后可在此输入数值。",
"Tick to add with others": "勾选后与其他一起添加",
"Toggle this trigger word into the row's output": "把这个触发词加入或移出该行的输出",
"Trigger word separator": "触发词分隔符",
"Turn this group on or off. Each LoRA in it keeps its own switch.": "开启或关闭这个分组。组里的每个 LoRA 仍有各自的开关。",
"Untick every file": "取消勾选所有文件",
"seeds this node ran with": "此节点用过的历史种子",
"the last run delivered an empty string": "上次运行传来的是空字符串",
"Start and Ends at are places in the source video. Duration counts the frames the clip sends on, at the output rate.": "起点和终点是源视频里的位置。时长是片段送出的帧数,按输出帧率计算。",
"The frame this node outputs (frame_index).": "此节点输出的帧(frame_index)。",
"Pick a color": "选择颜色",
"Show the advanced mask controls": "显示高级遮罩控制",
"Reset rotation, crop, padding, fill, feather and Align. Keep the source, current frame, trim window, fixed length and picture.": "重置旋转、裁剪、扩边、填充、羽化和对齐。素材、当前帧、截取范围、固定长度和图片保持不变。",
"Up/Down chooses a row, Space toggles it, and Left/Right changes strength.": "上下键选择一行,空格切换开关,左右键调整强度。",
"Tint the paste mask the stitcher will use - the same mask math as the backend, at preview resolution.": "给拼回时使用的贴回遮罩上色,计算方式与后端一致,只是分辨率为预览分辨率。",
"Ramp where generated pixels fade over the source, in pixels of the output. Separate from the padding feather.": "生成的像素渐隐到原图上的过渡宽度,单位为输出像素。与扩边羽化相互独立。",
"Your own ratios from ausboss_presets.json. Picking one works like a ratio button.": "来自 ausboss_presets.json 的自定义比例。选中它的效果和点比例按钮一样。",
"Choose or upload an image": "选择或上传图片",
"Preview could not load this image": "预览无法加载这张图片",
"The strength at the top of the curve box. 1 is full strength.": "曲线框顶部对应的强度。1 为满强度。",
"The strength at the bottom of the curve box. 0 is off.": "曲线框底部对应的强度。0 为关闭。",
"flat": "平直", "fade out": "渐弱", "fade in": "渐强", "ease out": "缓出", "ease in": "缓入",
"The same strength all the way": "全程同一强度",
"Full at the start, gone at the end": "开头满强度,结尾消失",
"Off at the start, full at the end": "开头关闭,结尾满强度",
"Holds, fades out smoothly through the middle, then stays low": "先保持,中段平滑减弱,之后保持低位",
"Stays low, comes in smoothly through the middle, then holds": "先保持低位,中段平滑增强,之后保持",
"Point at": "点位置", "value": "数值", "start": "开始", "end": "结束",
"Drag a point. Double-click adds one, right-click removes it.": "拖动点。双击添加点,右键删除点。",
"Where the picked point sits in the run, from the start (0%) to the end (100%).": "选中的点在运行中的位置,从开始(0%)到结束(100%)。",
"The strength at the picked point.": "选中点的强度。",
"This LoRA follows the strength curve. Click to keep it steady.": "这个 LoRA 跟随强度曲线。点击改为固定强度。",
"This LoRA keeps one strength. Click to make it follow the strength curve.": "这个 LoRA 保持同一强度。点击让它跟随强度曲线。",
"Follow the strength curve": "跟随强度曲线", "Keep a steady strength": "保持固定强度",
// ---- image finishing nodes
"Auto": "自动", "1 \u00d7 = Auto's pick": "1 \u00d7 = 自动的选择", "1 \u00d7 = the match": "1 \u00d7 = 匹配结果", "match": "匹配",
"Amount": "颗粒量", "Roughness": "粗糙度", "Video grain": "视频颗粒", "moving": "逐帧变化",
"Clean edges": "清理边缘", "Clear haze": "清除薄雾", "Solid above": "高于此值为实", "Smooth video": "视频平滑",
"white part": "白色部分", "black part": "黑色部分",
"Detail size": "细节大小", "Detail": "细节", "color + light": "颜色 + 明暗", "light only": "仅明暗", "Edge safe": "保护边缘",
// ---- Check layout
"Check layout": "检查布局",
"Check again": "再检查一次",
"Look at the workflow again after a change": "改动之后再检查一遍工作流",
"Click an entry to jump to it. Nothing is moved.": "点击一项即可跳转过去。不会移动任何东西。",
"Nothing to fix": "没有要改的",
"Nothing to fix.": "没有要改的。",
"No overlaps, no hidden or backwards wires, and every node sits in a group.": "没有重叠,没有被挡住或反向的连线,每个节点都在分组里。",
"1 thing to look at": "1 处需要看一下",
"Overlapping": "重叠",
"Groups overlapping": "分组重叠",
"Under a node that grows": "在会变高的节点下面",
"Wire behind a node": "连线被节点挡住",
"Wire runs backwards": "连线反向",
"Outside every group": "不在任何分组里",
"Zoomed out too far": "缩得太小",
"No Workflow Note": "没有工作流说明",
"Title bars count too": "标题栏也算在内",
"One group crosses the other": "一个分组压到了另一个分组",
"Under:": "位于其下:",
"Behind:": "挡住它的:",
"Ends left of where it starts": "终点在起点左边",
"Move it into a group": "把它移进一个分组",
"Nothing here is in a group": "这里没有东西在分组里",
"Put each step in a numbered group": "把每一步放进带编号的分组",
"Saved zoom:": "保存的缩放:",
"Below 0.60 the text on nodes stops drawing": "低于 0.60 时节点上的文字不再显示",
"The Workflow Note has no title or steps": "工作流说明没有标题或步骤",
"Add a Workflow Note": "添加一个工作流说明",
"It tells people what the workflow does and how to run it": "它告诉大家这个工作流做什么、怎么运行",
"Inside:": "位于:",
};
// Strings that deliberately stay English on a Chinese face: names, symbols
// and technical terms with no everyday Chinese form.
export const STAYS_ENGLISH = new Set([
"W", "H", "FPS", "CFG", "LoRA", "VRAM", "Seed", "H3", "Civitai",
"lab", "rgb", "mkl", "bicubic", "bilinear", "lanczos", "nearest", "area",
"gif", "webp", "mp4 h264", "mp4 h265", "mp4 h264 nvenc", "mp4 h265 nvenc", "mov prores", "mkv ffv1", "webm vp9", "webm av1",
"big-lama.pt", "loras", "script", "video", "flashvsr_v1.1_fp16.safetensors", "f(a, b, c)", "a + b",
]);
// The hint js/shared/scrub_input.mjs adds to every number box's tooltip.
export const SCRUB_HINT_EN = "Drag to scrub, click to type a number or a sum (1024*1.5), arrows to step; Shift = fine.";
export const SCRUB_HINT_ZH = "拖动调节,点击输入数字或算式(如 1024*1.5),方向键步进;按住 Shift 精细调节。";
// A few strings carry a number or a name; the number stays and the words around it change.
export const PATTERNS = [
[/^Civitai (\d+) \/ (\d+) · Stop$/, (m, done, total) => `Civitai ${done} / ${total} · 停止`],
[/^The limits of what this is wired to: (.*)\.$/, (m, names) => `它所连接对象的取值范围:${names}。`],
[/^Set by "(.*)"\. Click to show it\. Right-click the row to unlink\.$/, (m, name) => `由“${name}”设置。点击可定位到它。右键该行可断开连线。`],
[/^Source · feather (\d+) px · Fill (#[0-9a-fA-F]{6})$/, (m, f, c) => `素材 · 羽化 ${f} px · 填充 ${c}`],
[/^Source · Fill (#[0-9a-fA-F]{6})$/, (m, c) => `素材 · 填充 ${c}`],
[/^(\d+):(\d+): reshape to this ratio\. The flip button on the left sets the orientation\.$/, (m, a, b) => `${a}:${b}:重塑为此比例。左侧的翻转按钮用来切换横竖方向。`],
[/^(\d+) things to look at$/, (m, n) => `${n} 处需要看一下`],
[/^(\d+) wires$/, (m, n) => `${n} 条连线`],
];
+14
View File
@@ -0,0 +1,14 @@
// Image Resize 🆎: which card rows the node reads for the values set. No DOM
// and no ComfyUI imports, so node:test covers it.
// Only a width × height box can disagree with the picture's shape; every other
// target takes its shape from the picture, and the node always fits it
// (nodes/_resize_helpers.py). So Fit is only read in width × height.
export function readsFit(values) {
return values?.target_mode === "width+height";
}
// The fill colour paints pad's bars, so it is read only where pad is.
export function readsFill(values) {
return readsFit(values) && values?.keep_proportion === "pad";
}
+1 -1
View File
@@ -9,7 +9,7 @@ import { app } from "../../../scripts/app.js";
// Must match `version` in pyproject.toml — scripts/release_preflight.py
// enforces it. The backend serves its copy at /ausboss/pack_version; a
// mismatch means the browser cached JavaScript from an older install.
export const AUSBOSS_JS_VERSION = "2.24.0";
export const AUSBOSS_JS_VERSION = "2.30.0";
export const BRAND = "#00b4aa"; // AusBoss teal — keep node accents consistent.
export const BRAND_DARK = "#007f78";
+46 -3
View File
@@ -107,16 +107,59 @@ export function outputRecordQuery(record, index = null) {
}).toString();
}
// The /view query of the small copy Save Image writes for its face
// ({ ausboss_preview: ["ausboss_preview/<name>.webp"] }, one for each entry
// of images, in the temp folder). Null when the record has none: an older
// run, another node, or the preview switched off.
export function lightPreviewQuery(record, index = null) {
const places = record?.ausboss_preview;
const count = outputRecordCount(record);
if (!count || !Array.isArray(places) || places.length !== count) return null;
const at = Number.isInteger(index) && index >= 0 && index < count ? index : count - 1;
const place = places[at];
if (typeof place !== "string" || !place) return null;
const slash = place.lastIndexOf("/");
return new URLSearchParams({
filename: place.slice(slash + 1),
subfolder: slash >= 0 ? place.slice(0, slash) : "",
type: "temp",
}).toString();
}
// How many pictures the node's last run left in its output record.
export function outputRecordCount(record) {
return Array.isArray(record?.images) ? record.images.length : 0;
}
// Is node.imgs the picture of this output record?
//
// The frontend loads a result into node.imgs with a time limit (two tries of
// about 8 seconds). A picture that takes longer, a big one over a slow link,
// is dropped without a word and node.imgs keeps the run before. `loadedFor`
// is the record that was current when node.imgs was last set; the file name
// is compared as well, for a newer run that arrived while a picture loaded.
export function ownResultIsCurrent(node, record, loadedFor) {
const images = node?.imgs;
const src = Array.isArray(images) && images.length ? images[images.length - 1]?.src : null;
if (typeof src !== "string" || !src) return false;
const wanted = outputRecordQuery(record);
// No stored picture to compare with, or a frame streamed during the run.
if (!wanted || !/[?&]filename=/.test(src)) return true;
if (loadedFor !== record) return false;
const have = new URLSearchParams(src.slice(src.indexOf("?") + 1));
const want = new URLSearchParams(wanted);
return ["filename", "subfolder", "type"].every((key) => (have.get(key) ?? "") === (want.get(key) ?? ""));
}
// What the panel shows, best first: this node's result (node.imgs, then the
// URL of its stored output), then whatever feeds it, then nothing.
export function describeNodePreview(node, inputName, storedUrl = null) {
return describeOwnResult(node)
?? (storedUrl ? { kind: "url", url: storedUrl } : null)
// `ownIsCurrent` false: node.imgs is an older run's (ownResultIsCurrent), so
// the stored output goes first.
export function describeNodePreview(node, inputName, storedUrl = null, ownIsCurrent = true) {
const stored = storedUrl ? { kind: "url", url: storedUrl } : null;
return (ownIsCurrent ? null : stored)
?? describeOwnResult(node)
?? stored
?? describeSourcePreview(upstreamNode(node, inputName));
}
+5 -2
View File
@@ -13,6 +13,7 @@
// what it always was. The turn is made in canvas pixels, so a turned box is a
// true rectangle on a canvas of any shape (nodes/_layout_boxes_helpers.py
// turns it the same way).
import { linkOrigin } from "./clip_rate.mjs";
export const DIM_MIN = 64;
export const DIM_MAX = 16384;
@@ -683,8 +684,10 @@ const isNumber = (value) => typeof value === "number" && Number.isFinite(value);
// (Integer, Primitive). Reroutes are followed. Null when the input is not
// wired or the value is only known once the workflow runs.
export function wiredNumber(node, inputName) {
const source = wiredSource(node, inputName);
return source ? wiredFrom(source.node, source.slot) : null;
// Through Reroutes and into subgraphs (js/shared/clip_rate.mjs), then
// this node's own rule for which numbers count.
const origin = linkOrigin(node, inputName);
return origin ? wiredFrom(origin.node, origin.slot) : null;
}
// The node (and its output slot) an input is wired to, through Reroutes.
+252
View File
@@ -0,0 +1,252 @@
// Check layout 🆎: what makes a workflow hard to read, worked out from plain
// numbers. No DOM and no ComfyUI imports, so node:test runs it
// (tests/layout_check_math.test.mjs); js/layout_check/ reads the canvas
// into this shape, shows the list and jumps to an entry. Nothing here moves
// anything.
//
// The graph, in canvas units:
// nodes: [{ id, title, x, y, w, h, grows, kind }] x, y is the top left of
// the body; the title bar sits above it, titleHeight tall. grows:
// the node gets taller when it shows a run's picture or text.
// kind: "note" for a Workflow Note, "callout" for a Callout.
// groups: [{ id, title, x, y, w, h }]
// links: [{ id, from, to, points: [[x, y], ...] }] the output socket, any
// reroutes on the way, then the input socket.
// scale: the zoom the workflow is saved at (top level only).
// noteFilled: for a top-level graph, whether a Workflow Note has a title
// and instructions (null when there is no note).
export const TITLE_HEIGHT = 30;
// Below this saved zoom ComfyUI stops drawing widget text
// (scripts/workflow_contract.py holds the same number).
export const MIN_ZOOM = 0.6;
// How much taller a node that shows a picture can get after a run. A node
// starting closer than this under it can end up covered.
export const GROW_ROOM = 300;
// A wire runs backwards when it ends further left than the node it starts
// from, by more than this. A wire from a node down to the next one in its
// column ends at the same left edge, which reads fine.
export const BACKWARD_SLACK = 10;
// The order the list shows its kinds in: what hides something first.
export const KINDS = [
"overlap",
"group-overlap",
"under-grower",
"hidden-wire",
"backward-wire",
"outside-group",
"no-groups",
"zoom",
"no-note",
];
const finite = (value, fallback = 0) => (Number.isFinite(Number(value)) ? Number(value) : fallback);
// [left, top, right, bottom] of a node with its title bar.
// A node drawn without a title bar (a Callout tile) gives its own
// `titleHeight` of 0.
export function nodeBox(node, titleHeight = TITLE_HEIGHT) {
const x = finite(node?.x);
const y = finite(node?.y);
const top = Number.isFinite(node?.titleHeight) ? node.titleHeight : titleHeight;
return [x, y - top, x + Math.max(0, finite(node?.w)), y + Math.max(0, finite(node?.h))];
}
export function groupBox(group) {
const x = finite(group?.x);
const y = finite(group?.y);
return [x, y, x + Math.max(0, finite(group?.w)), y + Math.max(0, finite(group?.h))];
}
// Two boxes share more than `slack` units both ways.
export function boxesOverlap(a, b, slack = 1) {
return Math.min(a[2], b[2]) > Math.max(a[0], b[0]) + slack && Math.min(a[3], b[3]) > Math.max(a[1], b[1]) + slack;
}
// `inner` sits wholly inside `outer`, give or take `slack`.
export function boxInside(inner, outer, slack = 1) {
return inner[0] >= outer[0] - slack && inner[1] >= outer[1] - slack && inner[2] <= outer[2] + slack && inner[3] <= outer[3] + slack;
}
export function unionBox(boxes) {
const list = boxes.filter(Boolean);
if (!list.length) return null;
return [
Math.min(...list.map((box) => box[0])),
Math.min(...list.map((box) => box[1])),
Math.max(...list.map((box) => box[2])),
Math.max(...list.map((box) => box[3])),
];
}
// Points along a wire, the way the canvas draws one: from each point to the
// next a curve that leaves to the right and arrives from the left, its
// handles a quarter of the distance long. `mode` "straight" or "linear"
// draws straight pieces instead.
export function wirePoints(points, mode = "spline", per = 24) {
const list = (Array.isArray(points) ? points : []).filter((p) => Array.isArray(p) && p.length >= 2).map((p) => [finite(p[0]), finite(p[1])]);
if (list.length < 2) return list;
const out = [list[0]];
for (let i = 1; i < list.length; i++) {
const [ax, ay] = list[i - 1];
const [bx, by] = list[i];
const reach = mode === "spline" ? Math.hypot(bx - ax, by - ay) * 0.25 : 0;
const c1 = [ax + reach, ay];
const c2 = [bx - reach, by];
for (let s = 1; s <= per; s++) {
const t = s / per;
const u = 1 - t;
out.push([
u * u * u * ax + 3 * u * u * t * c1[0] + 3 * u * t * t * c2[0] + t * t * t * bx,
u * u * u * ay + 3 * u * u * t * c1[1] + 3 * u * t * t * c2[1] + t * t * t * by,
]);
}
}
return out;
}
const inBox = (point, box, inset = 2) => point[0] > box[0] + inset && point[0] < box[2] - inset && point[1] > box[1] + inset && point[1] < box[3] - inset;
// A Callout standing in a Workflow Note's own column belongs to the note,
// the way scripts/workflow_contract.py reads it.
function besideNote(node, notes) {
if (node.kind !== "callout") return false;
const left = finite(node.x);
const right = left + finite(node.w);
return notes.some((note) => note.x <= left && right <= note.x + note.w + 1);
}
export function checkLayout(graph, options = {}) {
const titleHeight = finite(options.titleHeight, TITLE_HEIGHT);
const growRoom = finite(options.growRoom, GROW_ROOM);
const nodes = (graph?.nodes ?? []).filter((node) => node && node.id !== undefined && node.id !== null);
const groups = graph?.groups ?? [];
const links = graph?.links ?? [];
const box = new Map(nodes.map((node) => [node.id, nodeBox(node, titleHeight)]));
const issues = [];
const add = (kind, fields) => issues.push({ kind, nodes: [], groups: [], ...fields });
const overlapping = new Set();
for (let i = 0; i < nodes.length; i++) {
for (let j = i + 1; j < nodes.length; j++) {
const a = nodes[i];
const b = nodes[j];
if (!boxesOverlap(box.get(a.id), box.get(b.id))) continue;
overlapping.add(`${a.id}|${b.id}`).add(`${b.id}|${a.id}`);
add("overlap", { nodes: [a.id, b.id], focus: unionBox([box.get(a.id), box.get(b.id)]) });
}
}
for (let i = 0; i < groups.length; i++) {
for (let j = i + 1; j < groups.length; j++) {
const a = groupBox(groups[i]);
const b = groupBox(groups[j]);
// A group wholly inside another is a nested group, which is fine.
if (!boxesOverlap(a, b) || boxInside(a, b) || boxInside(b, a)) continue;
add("group-overlap", { groups: [groups[i].id, groups[j].id], focus: unionBox([a, b]) });
}
}
for (const grower of nodes.filter((node) => node.grows)) {
const top = box.get(grower.id);
for (const node of nodes) {
if (node === grower || overlapping.has(`${grower.id}|${node.id}`)) continue;
const below = box.get(node.id);
const sideways = Math.min(top[2], below[2]) - Math.max(top[0], below[0]);
const gap = below[1] - top[3];
if (sideways > 1 && gap >= -1 && gap < growRoom) {
add("under-grower", { nodes: [node.id, grower.id], gap: Math.max(0, Math.round(gap)), focus: unionBox([top, below]) });
}
}
}
// Two wires between the same two nodes (a model and a clip, say) are one
// entry that counts them.
const wireIssues = new Map();
const addWire = (kind, key, fields) => {
const seen = wireIssues.get(`${kind}|${key}`);
if (seen) {
seen.wires += 1;
seen.links.push(fields.link);
return;
}
const issue = { kind, nodes: [], groups: [], wires: 1, links: [fields.link], ...fields };
wireIssues.set(`${kind}|${key}`, issue);
issues.push(issue);
};
const mode = graph?.linkMode ?? "spline";
for (const link of links) {
const points = wirePoints(link.points, mode);
if (points.length < 2) continue;
const behind = nodes.filter((node) => node.id !== link.from && node.id !== link.to && points.some((p) => inBox(p, box.get(node.id))));
if (behind.length) {
addWire("hidden-wire", `${link.from}|${link.to}|${behind.map((node) => node.id).join(",")}`, {
link: link.id,
nodes: [link.from, link.to, ...behind.map((node) => node.id)],
behind: behind.map((node) => node.id),
focus: unionBox([...behind.map((node) => box.get(node.id)), unionBox(points.map((p) => [p[0], p[1], p[0], p[1]]))]),
});
}
const corners = link.points.map((p) => [finite(p[0]), finite(p[1])]);
const start = box.get(link.from)?.[0] ?? corners[0][0];
if (corners.some((p, i) => i > 0 && p[0] < start - BACKWARD_SLACK)) {
addWire("backward-wire", `${link.from}|${link.to}`, {
link: link.id,
nodes: [link.from, link.to],
focus: unionBox([box.get(link.from), box.get(link.to)].concat(corners.map((p) => [p[0], p[1], p[0], p[1]]))),
});
}
}
const notes = nodes.filter((node) => node.kind === "note");
if (nodes.length && !groups.length) {
add("no-groups", { focus: unionBox([...box.values()]) });
} else if (groups.length) {
const boxes = groups.map(groupBox);
for (const node of nodes) {
if (node.kind === "note" || besideNote(node, notes)) continue;
if (boxes.some((group) => boxInside(box.get(node.id), group))) continue;
add("outside-group", { nodes: [node.id], focus: box.get(node.id) });
}
}
const scale = Number(graph?.scale);
if (Number.isFinite(scale) && scale < MIN_ZOOM) add("zoom", { scale: Math.round(scale * 100) / 100 });
if (graph?.topLevel && nodes.length && !graph.noteFilled) {
add("no-note", notes.length ? { nodes: [notes[0].id], focus: box.get(notes[0].id), empty: true } : {});
}
return issues.sort((a, b) => KINDS.indexOf(a.kind) - KINDS.indexOf(b.kind));
}
// The issues of a graph and every subgraph inside it, each marked with the
// path of box names that leads to it. `graphs` is [{ path: [...names],
// graph }], the top level first.
export function checkAll(graphs, options = {}) {
const out = [];
for (const { path = [], graph } of graphs ?? []) {
for (const issue of checkLayout({ ...graph, topLevel: path.length === 0 && graph?.topLevel !== false }, options)) {
out.push({ ...issue, path });
}
}
return out;
}
// How many issues of each kind, in list order: [[kind, count], ...].
export function countByKind(issues) {
const counts = new Map();
for (const issue of issues ?? []) counts.set(issue.kind, (counts.get(issue.kind) ?? 0) + 1);
return KINDS.filter((kind) => counts.has(kind)).map((kind) => [kind, counts.get(kind)]);
}
// The part of the canvas a jump frames its target in: everything left of the
// Check layout panel, so what it names never lands under it. `view` and
// `panel` are screen boxes ({ left, top, width, height }); the result is
// [x, y, width, height] in the canvas's own pixels, or null for the whole
// canvas (no panel, or too little room beside it).
export function jumpViewport(view, panel, margin = 16, least = 320) {
if (!(view?.width > 0) || !(view?.height > 0) || !panel) return null;
const room = Math.min(view.width, panel.left - view.left - margin);
if (!(room >= least)) return null;
return [0, 0, room, view.height];
}
+140
View File
@@ -0,0 +1,140 @@
// Cut Out in the browser: the same maths as nodes/_cut_out_helpers.py, for the
// live preview (js/shared/live_stage.mjs). The mask becomes the alpha in a
// fixed order (white or black part, grow or shrink, feather, clear haze and
// solid core), and where the alpha is in between the colours are cleaned of
// the old background with the node's blur-fusion pass (clean_colours in
// nodes/_fine_edge_helpers.py).
import { areaResize, bilinearResize, boxBlur, gaussianBlur, makeImage, pyRound, slidingMax } from "./live_image.mjs";
export const SNAP = 1e-4;
export const CLEAN_RADII = [90, 6];
export const CLEAN_FOR = 1440;
// Grow (positive) or shrink (negative) a plane by whole pixels, soft values
// kept: a square maximum, or minimum, of 2n + 1 pixels.
export function growShrink(plane, w, h, pixels) {
const steps = Math.abs(Math.trunc(pixels));
if (steps === 0) return plane;
const sign = pixels > 0 ? 1 : -1;
let values = sign > 0 ? plane : Float32Array.from(plane, (v) => -v);
values = slidingMax(slidingMax(values, w, h, steps, true), w, h, steps, false);
return sign > 0 ? values : Float32Array.from(values, (v) => -v);
}
// A Gaussian feather, 3 sigma wide, edges repeated.
export function feather(plane, w, h, sigma) {
if (!(sigma > 0)) return plane;
const image = makeImage(w, h, 1, plane);
return gaussianBlur(image, sigma, Math.max(1, Math.ceil(sigma * 3))).data;
}
// The cut-out's alpha for one mask plane the picture's size: 1 where the
// picture is kept.
export function cutOutAlpha(mask, w, h, { keep = "white", grow = 0, feather: soft = 1, clearHaze = 0, solidAbove = 1 } = {}) {
let alpha = Float32Array.from(mask, (v) => (v < 0 ? 0 : v > 1 ? 1 : v));
if (keep === "black") alpha = Float32Array.from(alpha, (v) => 1 - v);
alpha = growShrink(alpha, w, h, grow);
alpha = feather(alpha, w, h, soft);
if (clearHaze > 0 || solidAbove < 1) {
const span = Math.max(solidAbove - clearHaze, 1e-6);
alpha = Float32Array.from(alpha, (v) => Math.min(1, Math.max(0, (v - clearHaze) / span)));
}
return Float32Array.from(alpha, (v) => (v >= 1 - SNAP ? 1 : v <= SNAP ? 0 : Math.min(1, Math.max(0, v))));
}
// The blur the colour clean-up uses: three box passes, on a smaller copy
// when it reaches far.
function blur(image, reach) {
const step = Math.max(1, Math.floor(reach / 3));
return boxBlur(boxBlur(boxBlur(image, step), step), step);
}
function wideBlur(image, reach) {
const shrink = Math.max(1, Math.floor(reach / 12));
if (shrink === 1) return blur(image, reach);
const small = areaResize(image, Math.max(1, Math.floor(image.h / shrink)), Math.max(1, Math.floor(image.w / shrink)));
return bilinearResize(blur(small, Math.max(1, Math.floor(reach / shrink))), image.h, image.w);
}
// How far the colour clean-up reaches for a picture whose long side is
// `longSide`: the wide pass.
export function cleanReach(longSide) {
return Math.max(1, pyRound(CLEAN_RADII[0] * (longSide / CLEAN_FOR)));
}
// The subject's own colour for every pixel of `rgb` (3 channels), given its
// alpha plane. `longSide` is the long side of the whole picture, so a window
// of a big picture reaches as far as the whole one would.
export function cleanColours(rgb, alpha, longSide = Math.max(rgb.w, rgb.h)) {
const { w, h } = rgb;
const n = w * h;
const image = makeImage(w, h, 3, Float32Array.from(rgb.data, (v) => (v < 0 ? 0 : v > 1 ? 1 : v)));
const cover = makeImage(w, h, 1, Float32Array.from(alpha, (v) => (v < 0 ? 0 : v > 1 ? 1 : v)));
const grow = longSide / CLEAN_FOR;
let thing = image;
let behind = image;
for (const base of CLEAN_RADII) {
const reach = Math.max(1, pyRound(base * grow));
const weight = wideBlur(cover, reach);
const byCover = makeImage(w, h, 3, new Float32Array(n * 3));
const byRest = makeImage(w, h, 3, new Float32Array(n * 3));
for (let i = 0; i < n; i += 1) {
for (let k = 0; k < 3; k += 1) {
byCover.data[i * 3 + k] = thing.data[i * 3 + k] * cover.data[i];
byRest.data[i * 3 + k] = behind.data[i * 3 + k] * (1 - cover.data[i]);
}
}
const blurThing = wideBlur(byCover, reach);
const blurBehind = wideBlur(byRest, reach);
const nextThing = new Float32Array(n * 3);
const nextBehind = new Float32Array(n * 3);
for (let i = 0; i < n; i += 1) {
for (let k = 0; k < 3; k += 1) {
const at = i * 3 + k;
const nearThing = blurThing.data[at] / (weight.data[i] + 1e-5);
const nearBehind = blurBehind.data[at] / (1 - weight.data[i] + 1e-5);
const t = nearThing + cover.data[i] * (image.data[at] - cover.data[i] * nearThing - (1 - cover.data[i]) * nearBehind);
nextThing[at] = t < 0 ? 0 : t > 1 ? 1 : t;
nextBehind[at] = nearBehind < 0 ? 0 : nearBehind > 1 ? 1 : nearBehind;
}
}
thing = makeImage(w, h, 3, nextThing);
behind = makeImage(w, h, 3, nextBehind);
}
return thing;
}
// How far past a window the mask must be read for the alpha inside it to be
// the whole picture's, and how far the colour clean-up looks.
export function cutOutReach({ grow = 0, feather: soft = 1, cleanEdges = true }, longSide) {
const alpha = Math.abs(Math.trunc(grow)) + Math.ceil(Math.max(soft, 0) * 3) + 1;
return alpha + (cleanEdges ? 3 * cleanReach(longSide) + 3 : 0);
}
// The cut-out as RGBA: `image` (c = 3 or 4) and its mask plane the same size.
// Pixels the alpha keeps fully solid keep their colours exactly.
export function cutOut(image, mask, { keep = "white", grow = 0, feather: soft = 1, cleanEdges = true, clearHaze = 0, solidAbove = 1, longSide = null } = {}) {
const { w, h, c } = image;
const n = w * h;
const alpha = cutOutAlpha(mask, w, h, { keep, grow, feather: soft, clearHaze, solidAbove });
const cover = Float32Array.from(alpha);
if (c === 4) for (let i = 0; i < n; i += 1) cover[i] *= Math.min(1, Math.max(0, image.data[i * 4 + 3]));
const rgb = c === 3 ? image : makeImage(w, h, 3, Float32Array.from({ length: n * 3 }, (_, at) => image.data[Math.floor(at / 3) * 4 + (at % 3)]));
let colours = rgb;
if (cleanEdges && cover.some((v) => v > 0 && v < 1)) {
const clean = cleanColours(rgb, cover, longSide ?? Math.max(w, h));
colours = makeImage(w, h, 3, Float32Array.from(rgb.data));
for (let i = 0; i < n; i += 1) {
if (cover[i] >= 1) continue;
for (let k = 0; k < 3; k += 1) colours.data[i * 3 + k] = clean.data[i * 3 + k];
}
}
const out = new Float32Array(n * 4);
for (let i = 0; i < n; i += 1) {
out[i * 4] = colours.data[i * 3];
out[i * 4 + 1] = colours.data[i * 3 + 1];
out[i * 4 + 2] = colours.data[i * 3 + 2];
out[i * 4 + 3] = cover[i];
}
return makeImage(w, h, 4, out);
}
+117
View File
@@ -0,0 +1,117 @@
// Keep Detail in the browser: the same maths as nodes/_detail_helpers.py, for
// the live preview (js/shared/live_stage.mjs). Both pictures are split into a
// base (the picture blurred by `detailSize` pixels) and detail (the ratio of
// each pixel to that base, in linear light); the result is the edit's base
// with the original's detail on it. See the Python file for why.
import { boxBlur, gaussianBlur, makeImage, pyRound } from "./live_image.mjs";
export const LIGHT_FLOOR = 2e-3;
const HUE_KEEP = 1e-6;
export const EDGE_STEP = 0.15;
const LUMA = [0.2126, 0.7152, 0.0722];
export function srgbToLinear(v) {
const x = v < 0 ? 0 : v > 1 ? 1 : v;
return x <= 0.04045 ? x / 12.92 : ((x + 0.055) / 1.055) ** 2.4;
}
export function linearToSrgb(v) {
const x = v < 0 ? 0 : v;
return x <= 0.0031308 ? x * 12.92 : 1.055 * Math.max(x, 1e-12) ** (1 / 2.4) - 0.055;
}
const mapImage = (image, fn) => makeImage(image.w, image.h, image.c, Float32Array.from(image.data, fn));
// The box radius that spreads as far as a Gaussian of this sigma.
export function boxRadius(sigma) {
return Math.max(1, pyRound(Math.sqrt(3 * Number(sigma) ** 2 + 0.25) - 0.5));
}
function guided(image, radius) {
const mean = boxBlur(image, radius);
const squares = boxBlur(mapImage(image, (v) => v * v), radius);
const keep = makeImage(image.w, image.h, image.c, new Float32Array(image.data.length));
const offset = makeImage(image.w, image.h, image.c, new Float32Array(image.data.length));
for (let i = 0; i < image.data.length; i += 1) {
const spread = Math.max(squares.data[i] - mean.data[i] * mean.data[i], 0);
keep.data[i] = spread / (spread + EDGE_STEP ** 2);
offset.data[i] = mean.data[i] - keep.data[i] * mean.data[i];
}
const keepBlur = boxBlur(keep, radius);
const offsetBlur = boxBlur(offset, radius);
const out = new Float32Array(image.data.length);
for (let i = 0; i < out.length; i += 1) out[i] = keepBlur.data[i] * image.data[i] + offsetBlur.data[i];
return makeImage(image.w, image.h, image.c, out);
}
// The base of linear light: what is left once detail smaller than
// `detailSize` pixels is smoothed away (on sRGB-curved values).
export function baseLight(light, detailSize, edgeSafe) {
const curved = mapImage(light, linearToSrgb);
const smooth = edgeSafe ? guided(curved, boxRadius(detailSize)) : gaussianBlur(curved, Math.max(Number(detailSize), 0.5));
return mapImage(smooth, srgbToLinear);
}
function lightOf(rgb, colorDetail) {
const { w, h, c } = rgb;
if (colorDetail) {
const out = new Float32Array(w * h * 3);
for (let i = 0; i < w * h; i += 1) for (let k = 0; k < 3; k += 1) out[i * 3 + k] = srgbToLinear(rgb.data[i * c + Math.min(k, c - 1)]);
return makeImage(w, h, 3, out);
}
const out = new Float32Array(w * h);
for (let i = 0; i < w * h; i += 1) {
let sum = 0;
for (let k = 0; k < 3; k += 1) sum += LUMA[k] * srgbToLinear(rgb.data[i * c + Math.min(k, c - 1)]);
out[i] = sum;
}
return makeImage(w, h, 1, out);
}
// How far a window must reach past what it shows for the result inside it to
// be the whole picture's: the guided filter boxes twice, the blur is cut at
// three sigma.
export function detailReach(detailSize, edgeSafe) {
return edgeSafe ? 2 * boxRadius(detailSize) + 1 : Math.ceil(3 * Math.max(Number(detailSize), 0.5)) + 1;
}
// The edit with the original's detail. `edit` and `original` are pictures of
// the same size (c = 3 or 4; alpha is left alone), `mask` one plane or null.
export function keepDetail(edit, original, { detailSize = 4, strength = 1, colorDetail = false, edgeSafe = true, mask = null } = {}) {
strength = Math.max(Number(strength), 0);
if (strength === 0) return edit;
const own = Math.max(0, 1 - strength);
const { w, h, c } = edit;
const editLight = lightOf(edit, colorDetail);
const origLight = lightOf(original, colorDetail);
const editBase = baseLight(editLight, detailSize, edgeSafe);
const origBase = baseLight(origLight, detailSize, edgeSafe);
const lc = editLight.c;
const out = new Float32Array(edit.data);
for (let i = 0; i < w * h; i += 1) {
const factor = [0, 0, 0];
for (let k = 0; k < lc; k += 1) {
const at = i * lc + k;
const base = editBase.data[at] + LIGHT_FLOOR;
const origDetail = (origLight.data[at] + LIGHT_FLOOR) / (origBase.data[at] + LIGHT_FLOOR);
const editDetail = (editLight.data[at] + LIGHT_FLOOR) / base;
const target = base * origDetail ** strength * editDetail ** own;
factor[k] = target / (editLight.data[at] + LIGHT_FLOOR);
}
const gate = mask ? mask[i] : 1;
const linears = [0, 1, 2].map((k) => srgbToLinear(edit.data[i * c + k]));
// Light only: the floor's light goes to each channel in proportion, so hue holds.
const luma = linears[0] * LUMA[0] + linears[1] * LUMA[1] + linears[2] * LUMA[2];
for (let k = 0; k < 3; k += 1) {
const f = lc === 1 ? factor[0] : factor[k];
const rgb = edit.data[i * c + k];
const linear = linears[k];
const share = lc === 1 ? (linear + HUE_KEEP) / (luma + HUE_KEEP) : 1;
const lit = linear * f + LIGHT_FLOOR * (f - 1) * share;
const change = (linearToSrgb(lit) - linearToSrgb(linear)) * gate;
const next = rgb + change;
out[i * c + k] = next < 0 ? 0 : next > 1 ? 1 : next;
}
}
return makeImage(w, h, c, out);
}
+302
View File
@@ -0,0 +1,302 @@
// Film Grain in the browser: the same maths as nodes/_grain_helpers.py, for
// the live preview (js/shared/live_stage.mjs), plus Auto's noise reading.
//
// What matches the node: the grain's size, roughness and colour shaping, the
// tone curve, the strength, the mask, and Auto's measure and picks. What
// does not: the random numbers. The node draws them with torch's generator;
// here a hash of the grain cell's position gives each cell its value, so a
// preview of a part of the picture (100%) has the same grain wherever it is
// panned to. The pattern is therefore another draw of the same grain: the
// same strength and look, not the same specks. tests/live_preview.test.mjs
// feeds this code the node's own random numbers (tests/fixtures/
// live_parity.json) and checks the result against the node's.
import { areaTaps, bicubicTaps, makeImage, planeStd, pyRound } from "./live_image.mjs";
// The same constants as nodes/_grain_helpers.py.
export const FULL_STRENGTH = 0.15;
export const TONE_FLOOR = 0.2;
export const CLUMP_DEPTH = 0.6;
export const CLUMP_SCALE = 4.0;
export const GRAIN_LIMIT = 3.0;
export const LUMA = [0.2126, 0.7152, 0.0722];
export const AUTO_AMOUNT = 0.25;
export const AUTO_SIZE_MEGAPIXELS = 1.0;
export const AUTO_AMOUNT_RANGE = [0.05, 1.0];
export const AUTO_SIZE_RANGE = [0.5, 16.0];
export const OWN_GRAIN_FLOOR = 0.0015;
export const NOISE_BINS = 4096;
export const NOISE_TOP = 0.25;
export const NOISE_GAIN = 6.0;
export const HALF_NORMAL_MEDIAN = 0.6744897501960817;
// ---------- random cells ----------
function mix32(a) {
let h = a | 0;
h = Math.imul(h ^ (h >>> 16), 0x85ebca6b);
h = Math.imul(h ^ (h >>> 13), 0xc2b2ae35);
return (h ^ (h >>> 16)) >>> 0;
}
// A normal random number for grid cell (i, j) of channel `ch`, from a seed.
// Two hashes give two uniform numbers, Box-Muller turns them into one normal.
export function cellNormal(seed, ch, i, j) {
let h = mix32(seed ^ 0x9e3779b9);
h = mix32(h + Math.imul(ch + 1, 0x632be5ab));
h = mix32(h + Math.imul(i + 0x10000, 0x85ebca6b));
const a = mix32(h + Math.imul(j + 0x10000, 0xc2b2ae35));
const b = mix32(a ^ 0x68e31da4);
const u = (a + 1) / 4294967297;
const v = b / 4294967296;
return Math.sqrt(-2 * Math.log(u)) * Math.cos(2 * Math.PI * v);
}
// The cell source for a frame's grain: the n-th field drawn gets its own
// stream, so fields never repeat each other.
//
// Grain far smaller than a pixel (a big picture shrunk to fit) averages
// hundreds of cells into each pixel. The average of n independent cells is a
// normal with 1 / sqrt(n) of their spread, so the browser draws that
// directly (`fast`) instead of drawing every cell: the same distribution,
// at the cost of the pixels shown.
export function hashedCells(seed) {
const base = mix32((Number(BigInt(seed) & 0xffffffffn) ^ Number((BigInt(seed) >> 32n) & 0xffffffffn)) >>> 0);
const source = (index) => (ch, i, j) => cellNormal(mix32(base + index * 0x9e3779b1), ch, i, j);
source.fast = true;
return source;
}
// ---------- grain ----------
// Noise in grains about `size` pixels across for a window of the picture
// (`win` = { x0, y0, w, h }) of a picture that is `height` x `width`, as C
// planes. The grid is laid over the whole picture, as the node does:
// round(height / size) rows by round(width / size) columns of random cells,
// smoothed up (bicubic) or, finer than the picture, averaged down (area).
export function field(cells, height, width, size, channels, win, fast = false) {
const rows = Math.max(1, pyRound(height / size));
const cols = Math.max(1, pyRound(width / size));
const { x0, y0 } = win;
const cw = win.w;
const ch = win.h;
const out = new Float32Array(channels * cw * ch);
if (rows === height && cols === width) {
for (let k = 0; k < channels; k += 1) {
for (let y = 0; y < ch; y += 1) for (let x = 0; x < cw; x += 1) out[(k * ch + y) * cw + x] = cells(k, y0 + y, x0 + x);
}
return out;
}
const area = rows > height || cols > width;
if (fast && rows > height && cols > width && rows * cols > 4 * height * width) {
const spread = Math.sqrt((height * width) / (rows * cols));
for (let k = 0; k < channels; k += 1) {
for (let y = 0; y < ch; y += 1) for (let x = 0; x < cw; x += 1) out[(k * ch + y) * cw + x] = cells(k, y0 + y, x0 + x) * spread;
}
return out;
}
// The cells each window column and row reads, with their weights.
const colTaps = area
? areaTaps(cols, width).slice(x0, x0 + cw).map(([a, b]) => ({ at: Array.from({ length: b - a }, (_, n) => a + n), weights: Array(b - a).fill(1 / (b - a)) }))
: bicubicTaps(cols, width, x0, cw);
const rowTaps = area
? areaTaps(rows, height).slice(y0, y0 + ch).map(([a, b]) => ({ at: Array.from({ length: b - a }, (_, n) => a + n), weights: Array(b - a).fill(1 / (b - a)) }))
: bicubicTaps(rows, height, y0, ch);
const used = (taps) => {
const set = new Set();
for (const tap of taps) for (const at of tap.at) set.add(at);
return [...set].sort((a, b) => a - b);
};
const usedRows = used(rowTaps);
const rowSlot = new Map(usedRows.map((row, slot) => [row, slot]));
for (let k = 0; k < channels; k += 1) {
// Each needed row of cells, smoothed across to the window's columns.
const across = new Float32Array(usedRows.length * cw);
for (let slot = 0; slot < usedRows.length; slot += 1) {
const cell = new Map();
for (let x = 0; x < cw; x += 1) {
let sum = 0;
const tap = colTaps[x];
for (let n = 0; n < tap.at.length; n += 1) {
const j = tap.at[n];
const key = j;
let value = cell.get(key);
if (value === undefined) {
value = cells(k, usedRows[slot], j);
cell.set(key, value);
}
sum += value * tap.weights[n];
}
across[slot * cw + x] = sum;
}
}
for (let y = 0; y < ch; y += 1) {
const tap = rowTaps[y];
for (let x = 0; x < cw; x += 1) {
let sum = 0;
for (let n = 0; n < tap.at.length; n += 1) sum += across[rowSlot.get(tap.at[n]) * cw + x] * tap.weights[n];
out[(k * ch + y) * cw + x] = sum;
}
}
}
if (!area) {
const spread = Math.max(planeStd(out), 1e-6);
for (let i = 0; i < out.length; i += 1) out[i] /= spread;
}
return out;
}
// One frame's grain for a window: C x h x w planes, C = 1 (monochrome) or 3.
export function grainFrame(cellsAt, height, width, size, roughness, color, win = { x0: 0, y0: 0, w: width, h: height }) {
size = Math.max(Number(size), 1e-3);
roughness = Math.min(Math.max(Number(roughness), 0), 1);
color = Math.min(Math.max(Number(color), 0), 1);
const n = win.w * win.h;
let drawn = 0;
const draw = (fieldSize, channels) => field(cellsAt(drawn++), height, width, fieldSize, channels, win, Boolean(cellsAt.fast));
// Drawn in the node's order, so a setting that adds a layer never changes
// the layers drawn before it.
let layers = [{ c: 1, d: draw(size, 1) }];
if (color > 0) layers.push({ c: 3, d: draw(size, 3) });
if (roughness > 0) {
const clump = draw(size * CLUMP_SCALE, 1);
const weight = Float32Array.from(clump, (v) => Math.exp(CLUMP_DEPTH * v));
const fine = layers.map((layer) => draw(size / 2, layer.c));
const rough = fine.map((f, index) => {
const out = new Float32Array(f.length);
for (let i = 0; i < f.length; i += 1) out[i] = f[i] * weight[i % n];
const scale = planeStd(f) / Math.max(planeStd(out), 1e-6);
for (let i = 0; i < out.length; i += 1) out[i] *= scale;
return out;
});
const mixer = Math.sqrt((1 - roughness) ** 2 + roughness ** 2);
layers = layers.map((layer, index) => {
const d = new Float32Array(layer.d.length);
for (let i = 0; i < d.length; i += 1) d[i] = ((1 - roughness) * layer.d[i] + roughness * rough[index][i]) / mixer;
return { c: layer.c, d };
});
}
let grain = layers[0].d;
let channels = 1;
if (color > 0) {
channels = 3;
const mixer = Math.sqrt((1 - color) ** 2 + color ** 2);
grain = new Float32Array(3 * n);
for (let k = 0; k < 3; k += 1) {
for (let i = 0; i < n; i += 1) grain[k * n + i] = ((1 - color) * layers[0].d[i] + color * layers[1].d[k * n + i]) / mixer;
}
}
for (let i = 0; i < grain.length; i += 1) grain[i] = GRAIN_LIMIT * Math.tanh(grain[i] / GRAIN_LIMIT);
return { c: channels, w: win.w, h: win.h, data: grain };
}
// How strong the grain is for a pixel of this luma: 1 at mid grey, falling to
// TONE_FLOOR at black and white.
export function toneWeight(luma) {
const l = Math.min(Math.max(luma, 0), 1);
return TONE_FLOOR + (1 - TONE_FLOOR) * 4 * l * (1 - l);
}
// The picture with the grain laid on: strength = amount * FULL_STRENGTH,
// `mask` (one plane the picture's size, or null) limits where.
export function layGrain(image, grain, amount, mask = null) {
const { w, h, c } = image;
const strength = Number(amount) * FULL_STRENGTH;
const out = new Float32Array(image.data);
const n = w * h;
for (let i = 0; i < n; i += 1) {
const r = image.data[i * c];
const g = c >= 3 ? image.data[i * c + 1] : r;
const b = c >= 3 ? image.data[i * c + 2] : r;
const tone = toneWeight(LUMA[0] * r + LUMA[1] * g + LUMA[2] * b);
const gate = mask ? mask[i] : 1;
for (let k = 0; k < Math.min(c, 3); k += 1) {
const value = grain.c === 3 ? grain.data[k * n + i] : grain.data[i];
const next = image.data[i * c + k] + value * tone * strength * gate;
out[i * c + k] = next < 0 ? 0 : next > 1 ? 1 : next;
}
}
return makeImage(w, h, c, out);
}
// A window of a picture with film grain, as the node would make it.
// `image` is the window's pixels; `height` x `width` is the whole picture
// the grain grid is laid over and `win` where the window sits in it.
export function filmGrain(image, { amount, size, roughness, color, cellsAt, height = image.h, width = image.w, win = null, mask = null }) {
if (!(Number(amount) > 0)) return image;
const window = win ?? { x0: 0, y0: 0, w: image.w, h: image.h };
const grain = grainFrame(cellsAt, height, width, size, roughness, color, window);
return layGrain(image, grain, amount, mask);
}
// ---------- Auto ----------
// How much fine noise the picture has in its flat areas (one standard
// deviation in 0-1 values), as nodes/_grain_helpers.py measure_noise does:
// the median of a Laplacian-difference filter's size, read from a histogram.
export function measureNoise(image) {
const { w, h, c } = image;
if (w < 3 || h < 3) return 0;
const luma = new Float32Array(w * h);
for (let i = 0; i < w * h; i += 1) {
const r = image.data[i * c];
const g = c >= 3 ? image.data[i * c + 1] : r;
const b = c >= 3 ? image.data[i * c + 2] : r;
luma[i] = c >= 3 ? LUMA[0] * r + LUMA[1] * g + LUMA[2] * b : r * (LUMA[0] + LUMA[1] + LUMA[2]);
}
const bins = new Int32Array(NOISE_BINS);
let count = 0;
const top = NOISE_TOP * (1 - 1e-6);
for (let y = 1; y < h - 1; y += 1) {
for (let x = 1; x < w - 1; x += 1) {
const at = y * w + x;
const d = Math.abs(
luma[at - w - 1] - 2 * luma[at - w] + luma[at - w + 1]
- 2 * luma[at - 1] + 4 * luma[at] - 2 * luma[at + 1]
+ luma[at + w - 1] - 2 * luma[at + w] + luma[at + w + 1],
);
bins[Math.floor((Math.min(d, top) / NOISE_TOP) * NOISE_BINS)] += 1;
count += 1;
}
}
let reached = 0;
let middle = NOISE_BINS - 1;
for (let b = 0; b < NOISE_BINS; b += 1) {
reached += bins[b];
if (reached >= count / 2) { middle = b; break; }
}
return ((middle + 0.5) / NOISE_BINS * NOISE_TOP) / (NOISE_GAIN * HALF_NORMAL_MEDIAN);
}
// Auto's picks for a picture: grain size follows the square root of the
// megapixels, the amount is the normal 0.25 plus the picture's own grain.
export function autoGrain(height, width, noise) {
const megapixels = Math.max((height * width) / 1e6, 1e-6);
const size = Math.sqrt(megapixels / AUTO_SIZE_MEGAPIXELS);
const amount = AUTO_AMOUNT + Math.max(0, noise - OWN_GRAIN_FLOOR) / FULL_STRENGTH;
const clamp = (v, [low, high]) => Math.min(Math.max(v, low), high);
return { amount: clamp(amount, AUTO_AMOUNT_RANGE), size: clamp(size, AUTO_SIZE_RANGE) };
}
// What Auto does for a picture: its own picks and the numbers used (the picks
// times the card's multipliers, kept inside the same limits as the node).
export function autoValues(height, width, noise, amountTimes, sizeTimes) {
const base = autoGrain(height, width, noise);
return {
baseAmount: base.amount,
baseSize: base.size,
amount: Math.min(Math.max(base.amount * Number(amountTimes), 0), 1),
size: Math.min(Math.max(base.size * Number(sizeTimes), AUTO_SIZE_RANGE[0]), AUTO_SIZE_RANGE[1]),
noise,
};
}
// The numbers used while Auto copies grain from a picture: the node's match
// times the card's three multipliers, inside the same limits as the node
// (nodes/_grain_match_helpers.py, matched_film_grain_values).
export function matchValues(match, amountTimes, sizeTimes, colorTimes) {
return {
amount: Math.min(Math.max(match.amount * Number(amountTimes), 0), 1),
size: Math.min(Math.max(match.size * Number(sizeTimes), AUTO_SIZE_RANGE[0]), AUTO_SIZE_RANGE[1]),
color: Math.min(Math.max(match.color * Number(colorTimes), 0), 1),
};
}
+262
View File
@@ -0,0 +1,262 @@
// Small picture maths for the live preview on Film Grain, Keep Detail and
// Cut Out (js/shared/live_stage.mjs). No DOM, no imports, so node:test runs
// it. These are the pieces the Python nodes get from torch: box and Gaussian
// blurs with repeated edges, area, bilinear and bicubic resizes, a sliding
// maximum. Each follows torch's own definition (edges repeated, the
// align_corners=False pixel centres, adaptive pooling for "area") so the
// browser's drawing of a node's result agrees with the node's.
//
// A picture is { w, h, c, data }: data is a Float32Array of c values per
// pixel, row by row, in 0-1 picture values.
export function makeImage(w, h, c, data = new Float32Array(w * h * c)) {
return { w, h, c, data };
}
// Python's round(): halves go to the even number, so a grid of
// round(height / size) rows is the same in both languages.
export function pyRound(value) {
const floor = Math.floor(value);
const diff = value - floor;
if (diff < 0.5) return floor;
if (diff > 0.5) return floor + 1;
return floor % 2 === 0 ? floor : floor + 1;
}
const clampIndex = (index, length) => (index < 0 ? 0 : index >= length ? length - 1 : index);
// The mean over a (2r+1)-square window, edges repeated: torch's
// avg_pool2d of a replicate-padded picture.
export function boxBlur(image, radius) {
const r = Math.max(0, Math.floor(radius));
if (r === 0) return image;
const { w, h, c } = image;
const win = 2 * r + 1;
const across = new Float32Array(image.data.length);
for (let y = 0; y < h; y += 1) {
for (let ch = 0; ch < c; ch += 1) {
const base = y * w * c + ch;
let sum = 0;
for (let k = -r; k <= r; k += 1) sum += image.data[base + clampIndex(k, w) * c];
for (let x = 0; x < w; x += 1) {
across[base + x * c] = sum / win;
sum += image.data[base + clampIndex(x + r + 1, w) * c] - image.data[base + clampIndex(x - r, w) * c];
}
}
}
const out = new Float32Array(image.data.length);
const row = w * c;
for (let x = 0; x < w; x += 1) {
for (let ch = 0; ch < c; ch += 1) {
const base = x * c + ch;
let sum = 0;
for (let k = -r; k <= r; k += 1) sum += across[base + clampIndex(k, h) * row];
for (let y = 0; y < h; y += 1) {
out[base + y * row] = sum / win;
sum += across[base + clampIndex(y + r + 1, h) * row] - across[base + clampIndex(y - r, h) * row];
}
}
}
return makeImage(w, h, c, out);
}
// A Gaussian of the given taps, edges repeated.
function convolve(image, kernel, radius) {
const { w, h, c } = image;
const across = new Float32Array(image.data.length);
for (let y = 0; y < h; y += 1) {
for (let x = 0; x < w; x += 1) {
for (let ch = 0; ch < c; ch += 1) {
let sum = 0;
for (let k = -radius; k <= radius; k += 1) sum += kernel[k + radius] * image.data[(y * w + clampIndex(x + k, w)) * c + ch];
across[(y * w + x) * c + ch] = sum;
}
}
}
const out = new Float32Array(image.data.length);
for (let y = 0; y < h; y += 1) {
for (let x = 0; x < w; x += 1) {
for (let ch = 0; ch < c; ch += 1) {
let sum = 0;
for (let k = -radius; k <= radius; k += 1) sum += kernel[k + radius] * across[(clampIndex(y + k, h) * w + x) * c + ch];
out[(y * w + x) * c + ch] = sum;
}
}
}
return makeImage(w, h, c, out);
}
export function gaussianKernel(sigma, radius) {
const kernel = new Float64Array(2 * radius + 1);
let total = 0;
for (let k = -radius; k <= radius; k += 1) {
kernel[k + radius] = Math.exp(-(k * k) / (2 * sigma * sigma));
total += kernel[k + radius];
}
for (let k = 0; k < kernel.length; k += 1) kernel[k] /= total;
return kernel;
}
// Gaussian blur. A wide one (sigma over WIDE_SIGMA) is worked out on a
// smaller copy, which is smooth anyway, the same shortcut the nodes take for
// their wide blurs; a narrow one is exact. `radius` defaults to torch's
// choice in Keep Detail (3 sigma, at most the picture's short side less one).
const WIDE_SIGMA = 12;
export function gaussianBlur(image, sigma, radius = null) {
if (!(sigma > 0)) return image;
if (sigma > WIDE_SIGMA) {
const shrink = Math.floor(sigma / 6);
const small = areaResize(image, Math.max(1, Math.floor(image.h / shrink)), Math.max(1, Math.floor(image.w / shrink)));
return bilinearResize(gaussianBlur(small, sigma / shrink, radius === null ? null : Math.ceil(radius / shrink)), image.h, image.w);
}
const taps = radius ?? Math.max(1, Math.min(Math.ceil(3 * sigma), Math.max(1, Math.min(image.w, image.h) - 1)));
return convolve(image, gaussianKernel(sigma, taps), taps);
}
// torch's adaptive average pooling (F.interpolate mode="area"): each output
// cell averages the input cells from floor(i * in / out) up to
// ceil((i + 1) * in / out).
export function areaTaps(inLength, outLength) {
const taps = [];
for (let i = 0; i < outLength; i += 1) {
const start = Math.floor((i * inLength) / outLength);
const end = Math.ceil(((i + 1) * inLength) / outLength);
taps.push([start, Math.max(end, start + 1)]);
}
return taps;
}
export function areaResize(image, outH, outW) {
if (outH === image.h && outW === image.w) return image;
const { w, h, c } = image;
const xs = areaTaps(w, outW);
const ys = areaTaps(h, outH);
const across = new Float32Array(h * outW * c);
for (let y = 0; y < h; y += 1) {
for (let ox = 0; ox < outW; ox += 1) {
const [a, b] = xs[ox];
for (let ch = 0; ch < c; ch += 1) {
let sum = 0;
for (let x = a; x < b; x += 1) sum += image.data[(y * w + x) * c + ch];
across[(y * outW + ox) * c + ch] = sum / (b - a);
}
}
}
const out = new Float32Array(outH * outW * c);
for (let oy = 0; oy < outH; oy += 1) {
const [a, b] = ys[oy];
for (let x = 0; x < outW; x += 1) {
for (let ch = 0; ch < c; ch += 1) {
let sum = 0;
for (let y = a; y < b; y += 1) sum += across[(y * outW + x) * c + ch];
out[(oy * outW + x) * c + ch] = sum / (b - a);
}
}
}
return makeImage(outW, outH, c, out);
}
// Bilinear with torch's align_corners=False pixel centres.
export function bilinearResize(image, outH, outW) {
if (outH === image.h && outW === image.w) return image;
const { w, h, c } = image;
const axis = (inLength, outLength) => {
const scale = inLength / outLength;
return Array.from({ length: outLength }, (_, o) => {
const src = Math.max(0, (o + 0.5) * scale - 0.5);
const i0 = Math.min(Math.floor(src), inLength - 1);
return [i0, Math.min(i0 + 1, inLength - 1), src - i0];
});
};
const xs = axis(w, outW);
const ys = axis(h, outH);
const out = new Float32Array(outH * outW * c);
for (let oy = 0; oy < outH; oy += 1) {
const [y0, y1, fy] = ys[oy];
for (let ox = 0; ox < outW; ox += 1) {
const [x0, x1, fx] = xs[ox];
for (let ch = 0; ch < c; ch += 1) {
const top = image.data[(y0 * w + x0) * c + ch] * (1 - fx) + image.data[(y0 * w + x1) * c + ch] * fx;
const bottom = image.data[(y1 * w + x0) * c + ch] * (1 - fx) + image.data[(y1 * w + x1) * c + ch] * fx;
out[(oy * outW + ox) * c + ch] = top * (1 - fy) + bottom * fy;
}
}
}
return makeImage(outW, outH, c, out);
}
// Cubic convolution weights for torch's bicubic (A = -0.75) at offsets
// -1, 0, 1, 2 around a source position with fraction t.
const CUBIC_A = -0.75;
export function cubicWeights(t) {
const near = (x) => ((CUBIC_A + 2) * x - (CUBIC_A + 3)) * x * x + 1;
const far = (x) => ((CUBIC_A * x - 5 * CUBIC_A) * x + 8 * CUBIC_A) * x - 4 * CUBIC_A;
return [far(t + 1), near(t), near(1 - t), far(2 - t)];
}
// A grid of values (rows x cols) sampled for the pixels of a window, for
// pictures that are `outH` x `outW`: the window starts at (x0, y0) and is
// cw x ch big. Returns the taps each window column and row reads.
export function bicubicTaps(inLength, outLength, start, count) {
const scale = inLength / outLength;
const taps = [];
for (let o = start; o < start + count; o += 1) {
const src = (o + 0.5) * scale - 0.5;
const i0 = Math.floor(src);
const weights = cubicWeights(src - i0);
taps.push({ at: [-1, 0, 1, 2].map((k) => clampIndex(i0 + k, inLength)), weights });
}
return taps;
}
export function crop(image, x0, y0, cw, ch) {
const out = new Float32Array(cw * ch * image.c);
for (let y = 0; y < ch; y += 1) {
const sy = clampIndex(y0 + y, image.h);
for (let x = 0; x < cw; x += 1) {
const sx = clampIndex(x0 + x, image.w);
for (let k = 0; k < image.c; k += 1) out[(y * cw + x) * image.c + k] = image.data[(sy * image.w + sx) * image.c + k];
}
}
return makeImage(cw, ch, image.c, out);
}
// Max over the 2 * steps + 1 pixels centred on each pixel along one axis
// (pixels off the picture count as nothing), with a monotonic queue: the
// work is the same however far it reaches.
export function slidingMax(plane, w, h, steps, alongX) {
const length = alongX ? w : h;
const lines = alongX ? h : w;
const out = new Float32Array(plane.length);
const queue = new Int32Array(length);
for (let line = 0; line < lines; line += 1) {
const at = (i) => (alongX ? line * w + i : i * w + line);
let head = 0;
let tail = 0;
let next = 0;
for (let i = 0; i < length; i += 1) {
const reach = Math.min(length - 1, i + steps);
while (next <= reach) {
const value = plane[at(next)];
while (tail > head && plane[at(queue[tail - 1])] <= value) tail -= 1;
queue[tail] = next;
tail += 1;
next += 1;
}
while (queue[head] < i - steps) head += 1;
out[at(i)] = plane[at(queue[head])];
}
}
return out;
}
export function planeStd(values) {
const n = values.length;
if (n < 2) return 0;
let mean = 0;
for (let i = 0; i < n; i += 1) mean += values[i];
mean /= n;
let sum = 0;
for (let i = 0; i < n; i += 1) sum += (values[i] - mean) ** 2;
return Math.sqrt(sum / (n - 1));
}

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