Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6d01458a8 | ||
|
|
60dca17f4a | ||
|
|
94b1ab1def | ||
|
|
f7fe1ceac8 | ||
|
|
07bb4d792b | ||
|
|
34995f9fdb | ||
|
|
8e00fd07fc | ||
|
|
eb1be4f36c |
@@ -2,6 +2,24 @@
|
||||
|
||||
All notable changes to ComfyUI-AusBoss are documented here.
|
||||
|
||||
## Unreleased
|
||||
|
||||
- **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
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="105" height="20" role="img" aria-label="release: v2.28.0">
|
||||
<title>release: v2.28.0</title>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="105" height="20" role="img" aria-label="release: v2.28.1">
|
||||
<title>release: v2.28.1</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.28.0</text>
|
||||
<text x="76.5" y="14">v2.28.1</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 425 B After Width: | Height: | Size: 425 B |
@@ -306,6 +306,8 @@ export const ZH = {
|
||||
"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": "触发词分隔符",
|
||||
|
||||
@@ -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
@@ -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.28.0";
|
||||
export const AUSBOSS_JS_VERSION = "2.28.1";
|
||||
|
||||
export const BRAND = "#00b4aa"; // AusBoss teal — keep node accents consistent.
|
||||
export const BRAND_DARK = "#007f78";
|
||||
|
||||
@@ -6,6 +6,7 @@ import { hideInputsInDef, hideWidget } from "./widget_visibility.mjs";
|
||||
import { mountTransformTrim } from "./transform_trim.mjs";
|
||||
import { mountClipWindow } from "./clip_window.mjs";
|
||||
import { clipOutputRate, inputNumber } from "./clip_rate.mjs";
|
||||
import { wiredFieldText, wiredNumber, wiredResize, wiredSummaryParts, wiredSwitch } from "./transform_wired.mjs";
|
||||
import { BRAND, chainCallback, keepDomWidgetWidthAuto, notifyAusbossChange, showToast } from "./index.mjs";
|
||||
import { WIDGET_FRAME, fillNodeHeight, holdVueNodeMinWidth, holdVuePanelMinHeight } from "./panel_layout.mjs";
|
||||
import { mediaViewQuery, unlistedMedia } from "./media_list.mjs";
|
||||
@@ -191,6 +192,7 @@ function installStyles() {
|
||||
.ausboss-transform-group-title{display:inline-flex;align-items:center;gap:6px;letter-spacing:.05em;text-transform:uppercase;white-space:nowrap}
|
||||
.ausboss-transform-group-caret{display:inline-block;color:${BRAND};font-size:11px;transition:transform .14s ease}
|
||||
.ausboss-transform-group.open .ausboss-transform-group-caret{transform:rotate(90deg)}
|
||||
.ausboss-transform-wired{display:inline-flex;align-items:center;justify-content:flex-end;min-height:24px;padding:0 6px;border:1px dashed #3a5352;border-radius:5px;color:#8ca8a5;font:500 11px system-ui;font-variant-numeric:tabular-nums;white-space:nowrap;cursor:default}
|
||||
.ausboss-transform-group-summary{display:inline-flex;align-items:center;gap:6px;min-width:0;color:#8ca8a5;font:500 11px system-ui;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||
.ausboss-transform-group-swatch{flex:none;width:10px;height:10px;border:1px solid #555b63;border-radius:3px;box-sizing:border-box}
|
||||
.ausboss-transform-group-meta{min-width:0;overflow:hidden;text-overflow:ellipsis}
|
||||
@@ -632,16 +634,9 @@ export function transformGroupSummary(state) {
|
||||
parts.push(`Custom ${ratioLabel(canvas.width, canvas.height)}`);
|
||||
}
|
||||
if (lockActive(state)) parts.push("held");
|
||||
const feather = Math.round(Number(value(node, "feather", 0)) || 0);
|
||||
if (feather > 0) parts.push(`feather ${feather} px`);
|
||||
const multiple = Math.round(Number(value(node, "canvas_multiple", 1)) || 1);
|
||||
if (multiple > 1) parts.push(`÷${multiple}`);
|
||||
if (widget(node, "resize_to_megapixels") && value(node, "resize_to_megapixels", false)) {
|
||||
const mp = Number(value(node, "megapixels", 1)) || 1;
|
||||
const steps = Math.round(Number(value(node, "resolution_steps", 1)) || 1);
|
||||
parts.push(`${mp.toFixed(2)} MP`);
|
||||
if (steps > 1 && multiple <= 1) parts.push(`÷${steps}`);
|
||||
}
|
||||
// Feather, Align and the resize as the run uses them: a linked input runs
|
||||
// with the wired value, not the widget's own (js/shared/transform_wired.mjs).
|
||||
parts.push(...wiredSummaryParts(node));
|
||||
return parts.join(" · ");
|
||||
}
|
||||
|
||||
@@ -933,6 +928,13 @@ export function installTransformNode(node, kind, mountPanel = null) {
|
||||
for (const trim of state.trimViews) trim.sync();
|
||||
}
|
||||
}
|
||||
// A wired value changed upstream (a Float typed to 24): the summary,
|
||||
// the face fields and the size readout follow it.
|
||||
if (!state.disposed) {
|
||||
const wired = JSON.stringify([wiredSummaryParts(node), wiredResize(node)]);
|
||||
if (state.wiredKey !== undefined && wired !== state.wiredKey) queueMicrotask(() => { if (!state.disposed) draw(state); });
|
||||
state.wiredKey = wired;
|
||||
}
|
||||
if (state.disposed || state.zoomRedraw || !panelBackingStale(state)) return;
|
||||
state.zoomRedraw = requestAnimationFrame(() => { state.zoomRedraw = null; if (!state.disposed) draw(state); });
|
||||
});
|
||||
@@ -956,6 +958,7 @@ export function installTransformNode(node, kind, mountPanel = null) {
|
||||
}
|
||||
chainCallback(node, "onConnectionsChange", () => queueMicrotask(() => {
|
||||
for (const trim of state.trimViews) trim.sync();
|
||||
if (!state.disposed) draw(state);
|
||||
}));
|
||||
chainCallback(node, "onConfigure", () => queueMicrotask(() => {
|
||||
if (state.disposed) return;
|
||||
@@ -1514,6 +1517,12 @@ function buildCanvasRow(state) {
|
||||
stepLabel.append(createElement("span", "", "Step"), steps.root);
|
||||
const hasResize = Boolean(widget(node, "resize_to_megapixels"));
|
||||
resizeRow.append(resizeLabel, budgetLabel, stepLabel);
|
||||
const wired = [
|
||||
wiredStandIn(node, "feather", feather, 0, (amount) => `${Math.round(amount)} px`),
|
||||
wiredStandIn(node, "canvas_multiple", multiple, 1, (amount) => `${Math.round(amount)} px`),
|
||||
wiredStandIn(node, "megapixels", budget, 1, (amount) => `${Number(amount).toFixed(2)} MP`),
|
||||
wiredStandIn(node, "resolution_steps", steps, 1, (amount) => `${Math.round(amount)} px`),
|
||||
];
|
||||
const sync = () => {
|
||||
fill.value = normalizeColor(value(node, "fill_color", "#808080"));
|
||||
fill.title = `${fill.title.split(" Now ")[0]} Now ${fill.value}.`;
|
||||
@@ -1523,7 +1532,9 @@ function buildCanvasRow(state) {
|
||||
resize.sync();
|
||||
budget.set(value(node, "megapixels", 1));
|
||||
steps.set(value(node, "resolution_steps", 1));
|
||||
const resizeOn = hasResize && Boolean(value(node, "resize_to_megapixels", false));
|
||||
for (const standIn of wired) standIn();
|
||||
const switched = wiredSwitch(node, "resize_to_megapixels", false);
|
||||
const resizeOn = hasResize && (!switched.known || Boolean(switched.value));
|
||||
resizeRow.style.display = hasResize ? "" : "none";
|
||||
budgetLabel.style.display = resizeOn ? "" : "none";
|
||||
stepLabel.style.display = resizeOn ? "" : "none";
|
||||
@@ -1537,6 +1548,22 @@ function buildCanvasRow(state) {
|
||||
return [alignRow, row, resizeRow];
|
||||
}
|
||||
|
||||
// A linked setting runs with the wired value, so its number box gives way to
|
||||
// that value (or "from a link" when only the run knows it). The box stays the
|
||||
// way to set the widget's own value once the link is gone. Returns the sync.
|
||||
function wiredStandIn(node, name, control, fallback, format) {
|
||||
const text = createElement("span", "ausboss-transform-wired");
|
||||
text.title = t("Set by a link into this input. Remove the link to type a value here.");
|
||||
text.style.display = "none";
|
||||
control.root.after(text);
|
||||
return () => {
|
||||
const shown = wiredFieldText(wiredNumber(node, name, fallback), format);
|
||||
control.root.style.display = shown === null ? "" : "none";
|
||||
text.style.display = shown === null ? "none" : "";
|
||||
if (shown !== null) text.textContent = shown === "from a link" ? t("from a link") : shown;
|
||||
};
|
||||
}
|
||||
|
||||
// Resize as an off | on pill, on the node face and in the editor.
|
||||
function resizeSwitch(state) {
|
||||
const node = state.node;
|
||||
@@ -1577,7 +1604,7 @@ function syncReadout(state) {
|
||||
const source = rotatedSize(state.sourceWidth, state.sourceHeight, current.rotation_degrees);
|
||||
const resize = resizeRequest(state.node);
|
||||
const chain = sizeChain(current, source, resize);
|
||||
const { tokens, warnings } = litTokens(state, sizeChainTokens(chain));
|
||||
const { tokens, warnings } = readoutTokens(state, chain);
|
||||
const prefix = createElement("span", "ausboss-transform-ellipsis");
|
||||
tokens.forEach((token, index) => {
|
||||
if (index) prefix.append(" → ");
|
||||
@@ -2334,6 +2361,12 @@ function buildControls(state, sidebar) {
|
||||
previewSection.append(finalPreview);
|
||||
state.finalPreviewCanvas = finalPreview;
|
||||
|
||||
const editorWired = [
|
||||
wiredStandIn(node, "feather", featherNumber, 24, (amount) => `${Math.round(amount)} px`),
|
||||
wiredStandIn(node, "canvas_multiple", multiple, 1, (amount) => `${Math.round(amount)} px`),
|
||||
...(budget ? [wiredStandIn(node, "megapixels", budget, 1, (amount) => `${Number(amount).toFixed(2)} MP`)] : []),
|
||||
...(steps ? [wiredStandIn(node, "resolution_steps", steps, 1, (amount) => `${Math.round(amount)} px`)] : []),
|
||||
];
|
||||
sidebar.append(cropSection, rotateSection, padSection);
|
||||
if (resizeSection) sidebar.append(resizeSection);
|
||||
sidebar.append(actions, previewSection);
|
||||
@@ -2343,6 +2376,7 @@ function buildControls(state, sidebar) {
|
||||
featherNumber.set(value(node, "feather", 24));
|
||||
multiple.set(value(node, "canvas_multiple", 1)); color.value = normalizeColor(value(node, "fill_color", "#808080"));
|
||||
resize?.sync(); budget?.set(value(node, "megapixels", 1)); steps?.set(value(node, "resolution_steps", 1));
|
||||
for (const standIn of editorWired) standIn();
|
||||
if (more) more.value = extra.includes(liveRequest(state) ?? "") ? liveRequest(state) : "";
|
||||
};
|
||||
}
|
||||
@@ -2891,10 +2925,23 @@ function drawScene(context, state, render, compact, interactive) {
|
||||
context.restore();
|
||||
}
|
||||
|
||||
// The resize the run makes, wired values included; null when it is off or a
|
||||
// link decides a part of it that only the run knows (resizeFromLink).
|
||||
function resizeRequest(node) {
|
||||
return value(node, "resize_to_megapixels", false)
|
||||
? { megapixels: value(node, "megapixels", 1), steps: value(node, "resolution_steps", 1) }
|
||||
: null;
|
||||
const resize = wiredResize(node);
|
||||
return resize && !resize.unknown ? resize : null;
|
||||
}
|
||||
|
||||
function resizeFromLink(node) {
|
||||
return Boolean(wiredResize(node)?.unknown);
|
||||
}
|
||||
|
||||
// The size chain's steps, ending on a resize a link decides when it does:
|
||||
// the size it lands on is only known at run time.
|
||||
function readoutTokens(state, chain) {
|
||||
const result = litTokens(state, sizeChainTokens(chain));
|
||||
if (resizeFromLink(state.node)) result.tokens = [...result.tokens, { label: "resize", text: "from a link" }];
|
||||
return result;
|
||||
}
|
||||
|
||||
// The size readout, drawn OUTSIDE the image: under the output rect, above
|
||||
@@ -2905,7 +2952,7 @@ function resizeRequest(node) {
|
||||
// amber line when the steps stretch the picture or the resize undoes Align.
|
||||
const READOUT_LINE = 15;
|
||||
function drawOutputSize(context, state, render) {
|
||||
const { tokens } = litTokens(state, sizeChainTokens(sizeChain(values(state.node), render.source, resizeRequest(state.node))));
|
||||
const { tokens } = readoutTokens(state, sizeChain(values(state.node), render.source, resizeRequest(state.node)));
|
||||
// The amber line is the settled note, as on the face: it waits for the hand.
|
||||
const warnings = shownNote(state).warnings;
|
||||
const { outputRect } = render;
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
// What the Crop + Rotate + Pad nodes will really use for a setting that can
|
||||
// be wired: a linked input runs with the wired value, not the widget's own.
|
||||
// A wired value also skips the input's range (ComfyUI only range-checks typed
|
||||
// values), so a Float of 24 wired into Megapixels resizes to 24 MP while the
|
||||
// widget still holds 16.
|
||||
//
|
||||
// Only typed numbers are read across the wire (clip_rate.mjs inputNumber):
|
||||
// a calculated value (Math Expression) stays unknown until the run, and the
|
||||
// face says the value comes from a link instead of showing a wrong one.
|
||||
//
|
||||
// Pure: reads `inputs`, `widgets` and `graph`, so tests run it on plain
|
||||
// objects.
|
||||
|
||||
import { inputNumber, linkOrigin } from "./clip_rate.mjs";
|
||||
|
||||
function widgetValue(node, name, fallback) {
|
||||
return node?.widgets?.find((item) => item.name === name)?.value ?? fallback;
|
||||
}
|
||||
|
||||
export function inputLinked(node, name) {
|
||||
const slot = node?.inputs?.find((input) => input?.name === name || input?.widget?.name === name);
|
||||
return slot?.link !== null && slot?.link !== undefined;
|
||||
}
|
||||
|
||||
// { value, linked, known } for a number setting. Unlinked: the widget's
|
||||
// value. Linked to a typed number: that number. Linked to anything else:
|
||||
// value null, known false.
|
||||
export function wiredNumber(node, name, fallback) {
|
||||
const own = widgetValue(node, name, fallback);
|
||||
if (!inputLinked(node, name)) return { value: own, linked: false, known: true };
|
||||
const read = inputNumber(node, name, own);
|
||||
return read === null ? { value: null, linked: true, known: false } : { value: read, linked: true, known: true };
|
||||
}
|
||||
|
||||
const SWITCHES = ["PrimitiveBoolean"];
|
||||
|
||||
// The same for an on/off setting.
|
||||
export function wiredSwitch(node, name, fallback) {
|
||||
const own = Boolean(widgetValue(node, name, fallback));
|
||||
if (!inputLinked(node, name)) return { value: own, linked: false, known: true };
|
||||
const origin = linkOrigin(node, name);
|
||||
const unknown = { value: null, linked: true, known: false };
|
||||
if (!origin) return unknown;
|
||||
const { node: source, slot } = origin;
|
||||
let read;
|
||||
if ((source.comfyClass ?? source.type) === "PrimitiveNode") read = source.widgets?.[0]?.value;
|
||||
else if (SWITCHES.includes(source.type) && slot === 0
|
||||
&& !source.inputs?.some((input) => input.name === "value" && input.link != null)) {
|
||||
read = source.widgets?.find((item) => item.name === "value")?.value;
|
||||
}
|
||||
return typeof read === "boolean" ? { value: read, linked: true, known: true } : unknown;
|
||||
}
|
||||
|
||||
// The resize the run makes: null when it is off, { megapixels, steps } when
|
||||
// every part is known, { unknown: true } when a link decides a part of it.
|
||||
export function wiredResize(node) {
|
||||
if (!node?.widgets?.some((item) => item.name === "resize_to_megapixels")) return null;
|
||||
const on = wiredSwitch(node, "resize_to_megapixels", false);
|
||||
if (on.known && !on.value) return null;
|
||||
const megapixels = wiredNumber(node, "megapixels", 1);
|
||||
const steps = wiredNumber(node, "resolution_steps", 1);
|
||||
if (!on.known || !megapixels.known || !steps.known) return { unknown: true };
|
||||
return { megapixels: Number(megapixels.value) || 1, steps: Number(steps.value) || 1 };
|
||||
}
|
||||
|
||||
// The end of the "Crop, pad & resize" summary: feather, Align, and the
|
||||
// resize, each as the run will use it.
|
||||
export function wiredSummaryParts(node) {
|
||||
const parts = [];
|
||||
const feather = wiredNumber(node, "feather", 0);
|
||||
if (!feather.known) parts.push("feather from a link");
|
||||
else if (Math.round(Number(feather.value) || 0) > 0) parts.push(`feather ${Math.round(Number(feather.value))} px`);
|
||||
const multiple = wiredNumber(node, "canvas_multiple", 1);
|
||||
const align = multiple.known ? Math.round(Number(multiple.value) || 1) : null;
|
||||
if (align === null) parts.push("align from a link");
|
||||
else if (align > 1) parts.push(`÷${align}`);
|
||||
if (!node?.widgets?.some((item) => item.name === "resize_to_megapixels")) return parts;
|
||||
const on = wiredSwitch(node, "resize_to_megapixels", false);
|
||||
if (on.known && !on.value) return parts;
|
||||
if (!on.known) parts.push("resize from a link");
|
||||
const megapixels = wiredNumber(node, "megapixels", 1);
|
||||
parts.push(megapixels.known ? `${(Number(megapixels.value) || 1).toFixed(2)} MP` : "MP from a link");
|
||||
const steps = wiredNumber(node, "resolution_steps", 1);
|
||||
if (!steps.known) parts.push("step from a link");
|
||||
else if (Math.round(Number(steps.value) || 1) > 1 && align !== null && align <= 1) parts.push(`÷${Math.round(Number(steps.value))}`);
|
||||
return parts;
|
||||
}
|
||||
|
||||
// What a face field shows for a linked setting in place of its number box:
|
||||
// the wired number, or that a link sets it.
|
||||
export function wiredFieldText(reading, format) {
|
||||
if (!reading.linked) return null;
|
||||
return reading.known ? format(reading.value) : "from a link";
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import { mountWidgetCard } from "../shared/widget_card.mjs";
|
||||
import { FONT_UI, THEME } from "../shared/theme.mjs";
|
||||
import { SOCKETLESS_CHOICE, SOCKETLESS_TEXT, commitWidgetValue, markSocketless, resetUnknownValues } from "../shared/widget_card_math.mjs";
|
||||
import { mediaViewQuery } from "../shared/media_list.mjs";
|
||||
import { readsFill, readsFit } from "../shared/image_resize_rows.mjs";
|
||||
import { gearIconSvg, openSettingsMenu } from "../shared/settings_menu.mjs";
|
||||
import { SEAM_MENU, SEAM_MUTE_TITLES, isBlendIn, seamCornerReserve } from "../shared/stitch_seam.mjs";
|
||||
import { NUMBER_LOOK_MENU, TEXT_LOOK_MENU, setTextLook, textLook, textLookCornerReserve } from "../shared/text_look.mjs";
|
||||
@@ -138,8 +139,8 @@ const CARDS = {
|
||||
{ widget: "edge_length", label: "Edge", suffix: "px", when: isMode("target_mode", "longest_edge", "shortest_edge") },
|
||||
{ widget: "megapixels", label: "Budget", suffix: "MP", when: isMode("target_mode", "megapixels") },
|
||||
{ widget: "scale_factor", label: "Scale", suffix: "×", when: isMode("target_mode", "scale_factor") },
|
||||
{ widget: "keep_proportion", label: "Fit", kind: "segment", labels: { cover_crop: "cover" } },
|
||||
{ widget: "fill_color", label: "Fill", kind: "color", when: isMode("keep_proportion", "pad") },
|
||||
{ widget: "keep_proportion", label: "Fit", kind: "segment", labels: { cover_crop: "cover" }, when: readsFit },
|
||||
{ widget: "fill_color", label: "Fill", kind: "color", when: readsFill },
|
||||
{ widget: "divisible_by", label: "Multiple" },
|
||||
{ widget: "interpolation", label: "Filter", kind: "select" },
|
||||
],
|
||||
|
||||
@@ -285,6 +285,8 @@ class EditLock:
|
||||
self.wide: float | None = None # share of the picture the lock would free, at the decision
|
||||
self.top: float | None = None # the strongest spot then, in units of the quiet level
|
||||
self.peak: float | None = None # and the strongest hundredth
|
||||
self.vae_channels: int | None = None # when the VAE and model disagree: the picture's channels
|
||||
self.model_channels: int | None = None # and the channels the model predicts
|
||||
self._sigma: float | None = None
|
||||
self._first = True
|
||||
self._first_sigma = 1.0
|
||||
@@ -328,6 +330,7 @@ class EditLock:
|
||||
latent = self.latent[:, :, 0] if self.latent.ndim == 5 else self.latent
|
||||
if latent.shape[1] != flat.shape[1]:
|
||||
self.status = "vae"
|
||||
self.vae_channels, self.model_channels = int(latent.shape[1]), int(flat.shape[1])
|
||||
return pred
|
||||
source = fit_latent(latent.to(device=flat.device, dtype=torch.float32), *flat.shape[-2:])
|
||||
if source is None:
|
||||
@@ -451,5 +454,11 @@ def describe(lock: EditLock) -> str:
|
||||
if lock.status == "video":
|
||||
return "Edit Lock did nothing: it works on single pictures, not video."
|
||||
if lock.status == "vae":
|
||||
return "Edit Lock did nothing: this VAE does not belong to this model."
|
||||
counts = ""
|
||||
if lock.vae_channels is not None and lock.model_channels is not None:
|
||||
counts = (f" (your VAE makes {lock.vae_channels}-channel pictures, "
|
||||
f"the model expects {lock.model_channels})")
|
||||
return ("Edit Lock did nothing: the VAE and the diffusion model don't match"
|
||||
f"{counts}. Either file can be the wrong one. Use the model and VAE listed "
|
||||
"in the workflow's notes. A GGUF or other converted model is a common cause.")
|
||||
return "Edit Lock has not run yet: plug its model output into the sampler."
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ name = "ausboss-nodes"
|
||||
# Manager/registry search matches against this text, so it names the actual
|
||||
# nodes instead of describing the collection abstractly.
|
||||
description = "ComfyUI-AusBoss (AusBoss nodes): image and video nodes: Image and Video Crop + Rotate + Pad, Load Image, Load Image + Pad, Image Folder, Image Resize, Align Image, Image Size, Color Match, Image Compare A/B, Image Toolbox, Realign to Source (experimental), Save Image (PNG, WebP/JXL, captions), Load Video, Load Audio, Save Video, Select Frame, Frame Interpolate, Mask Refine, Mask by Name and Mask by Touch, LaMa Inpaint, Crop For Inpaint, Stitch Inpaint, Tiled Upscale and Tiled Upscale Stitch, FlashVSR Upscale, Edit Lock and Edit Lock Restore, LoRA Loader, Krea 2 Encode and Outpaint Model Patch, Latent Size, Layout Boxes, Seed, Select Every Nth, Split Batch, Merge Batches, Text, Text Lines, Prompt Variations, H3 Prompt Writer, Integer, Float, Math Expression, Show Text, Free Memory, Workflow Note, Workflow Note Tile, Callout, Callout Tile, Workflow Switches, Run Timer, Step Preview, Pause for Shot, and Photo Camera. Examples for Qwen Image 2.1, Krea 2, Klein 9B and LTX 2.3."
|
||||
version = "2.28.0"
|
||||
version = "2.28.1"
|
||||
# comfy-cli serializes this to JSON verbatim, so `file` publishes the literal
|
||||
# string {"file": "LICENSE"} to the registry listing. `text` puts a readable
|
||||
# name there instead. Both forms are supported; the LICENSE file is unchanged.
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// Image Resize's card shows Fit and Fill only where the node reads them.
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { readsFill, readsFit } from "../js/shared/image_resize_rows.mjs";
|
||||
|
||||
const MODES = ["width+height", "longest_edge", "shortest_edge", "megapixels", "scale_factor"];
|
||||
const FITS = ["stretch", "fit", "cover_crop", "pad"];
|
||||
|
||||
test("Fit shows only for a width × height box, the one target the node fits", () => {
|
||||
for (const mode of MODES) {
|
||||
assert.equal(readsFit({ target_mode: mode }), mode === "width+height", mode);
|
||||
}
|
||||
});
|
||||
|
||||
test("Fill shows only where pad is read", () => {
|
||||
for (const mode of MODES) {
|
||||
for (const fit of FITS) {
|
||||
const expected = mode === "width+height" && fit === "pad";
|
||||
assert.equal(readsFill({ target_mode: mode, keep_proportion: fit }), expected, `${mode} ${fit}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -279,6 +279,18 @@ class EditLockTests(unittest.TestCase):
|
||||
lock.status = status
|
||||
self.assertIn("did nothing", describe(lock))
|
||||
|
||||
def test_a_vae_and_model_that_do_not_match_say_both_counts(self):
|
||||
source, other, redraw = latents()
|
||||
pred = local_prediction(source, other, redraw)
|
||||
lock = lock_for(source[:, :16].clone())
|
||||
self.assertTrue(torch.equal(run(lock, pred), pred))
|
||||
self.assertEqual(lock.status, "vae")
|
||||
text = describe(lock)
|
||||
self.assertIn("the VAE and the diffusion model don't match", text)
|
||||
self.assertIn(f"your VAE makes 16-channel pictures, the model expects {pred.shape[1]}", text)
|
||||
self.assertIn("workflow's notes", text)
|
||||
self.assertIn("GGUF", text)
|
||||
|
||||
def test_a_grid_one_cell_off_still_locks(self):
|
||||
source, other, redraw = latents(video=False)
|
||||
lock = lock_for(torch.nn.functional.interpolate(source, size=(H + 2, W + 1), mode="bilinear"))
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
// A linked setting on the Crop + Rotate + Pad nodes runs with the wired value
|
||||
// (js/shared/transform_wired.mjs). A Float of 24 wired into Megapixels
|
||||
// resized to 24 MP while the card summary, the MP field and the size readout
|
||||
// all said 16.00 MP, the widget's own value, and read as a 16 MP cap.
|
||||
|
||||
import assert from "node:assert/strict";
|
||||
import fs from "node:fs";
|
||||
import test from "node:test";
|
||||
|
||||
import { wiredFieldText, wiredNumber, wiredResize, wiredSummaryParts, wiredSwitch } from "../js/shared/transform_wired.mjs";
|
||||
|
||||
const WIDGETS = { feather: 24, canvas_multiple: 1, resize_to_megapixels: true, megapixels: 16, resolution_steps: 1 };
|
||||
|
||||
// A crop node whose inputs named in `wires` are linked to the given source
|
||||
// nodes, as plain objects.
|
||||
function cropNode(values = {}, wires = {}) {
|
||||
const nodes = new Map();
|
||||
const links = {};
|
||||
const graph = { links, getNodeById: (id) => nodes.get(id) ?? null };
|
||||
const merged = { ...WIDGETS, ...values };
|
||||
const node = {
|
||||
id: 1, graph,
|
||||
widgets: Object.entries(merged).map(([name, value]) => ({ name, value })),
|
||||
inputs: Object.keys(merged).map((name) => ({ name, widget: { name }, link: null })),
|
||||
};
|
||||
nodes.set(1, node);
|
||||
let next = 10;
|
||||
for (const [name, source] of Object.entries(wires)) {
|
||||
const id = next++;
|
||||
source.id = id;
|
||||
source.mode ??= 0;
|
||||
source.inputs ??= [];
|
||||
nodes.set(id, source);
|
||||
links[id] = { id, origin_id: id, origin_slot: 0, target_id: 1 };
|
||||
node.inputs.find((input) => input.name === name).link = id;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
const float = (value) => ({ type: "PrimitiveFloat", widgets: [{ name: "value", value }] });
|
||||
const int = (value) => ({ type: "PrimitiveInt", widgets: [{ name: "value", value }] });
|
||||
const math = () => ({ type: "AUSBOSS_NODES_MathExpression", widgets: [{ name: "expression", value: "a*2" }] });
|
||||
|
||||
test("unlinked settings read the widgets, as before", () => {
|
||||
const node = cropNode();
|
||||
assert.deepEqual(wiredNumber(node, "megapixels", 1), { value: 16, linked: false, known: true });
|
||||
assert.deepEqual(wiredSummaryParts(node), ["feather 24 px", "16.00 MP"]);
|
||||
assert.deepEqual(wiredResize(node), { megapixels: 16, steps: 1 });
|
||||
assert.equal(wiredFieldText(wiredNumber(node, "megapixels", 1), (v) => `${v} MP`), null);
|
||||
});
|
||||
|
||||
test("a typed number wired into Megapixels shows that number, past the 16 MP range", () => {
|
||||
const node = cropNode({}, { megapixels: float(24) });
|
||||
assert.deepEqual(wiredNumber(node, "megapixels", 1), { value: 24, linked: true, known: true });
|
||||
assert.deepEqual(wiredSummaryParts(node), ["feather 24 px", "24.00 MP"]);
|
||||
assert.deepEqual(wiredResize(node), { megapixels: 24, steps: 1 });
|
||||
assert.equal(wiredFieldText(wiredNumber(node, "megapixels", 1), (v) => `${v.toFixed(2)} MP`), "24.00 MP");
|
||||
});
|
||||
|
||||
test("a calculated value says it comes from a link instead of showing the widget's", () => {
|
||||
const node = cropNode({}, { megapixels: math() });
|
||||
assert.deepEqual(wiredNumber(node, "megapixels", 1), { value: null, linked: true, known: false });
|
||||
assert.deepEqual(wiredSummaryParts(node), ["feather 24 px", "MP from a link"]);
|
||||
assert.deepEqual(wiredResize(node), { unknown: true });
|
||||
assert.equal(wiredFieldText(wiredNumber(node, "megapixels", 1), String), "from a link");
|
||||
});
|
||||
|
||||
test("the other summary values follow their links too", () => {
|
||||
const node = cropNode({ resolution_steps: 1 }, { feather: int(8), canvas_multiple: math(), resolution_steps: int(32) });
|
||||
assert.deepEqual(wiredSummaryParts(node), ["feather 8 px", "align from a link", "16.00 MP"]);
|
||||
const steps = cropNode({}, { resolution_steps: int(32) });
|
||||
assert.deepEqual(wiredSummaryParts(steps), ["feather 24 px", "16.00 MP", "÷32"]);
|
||||
assert.deepEqual(wiredSummaryParts(cropNode({}, { feather: math() })), ["feather from a link", "16.00 MP"]);
|
||||
assert.deepEqual(wiredSummaryParts(cropNode({}, { resolution_steps: math() })), ["feather 24 px", "16.00 MP", "step from a link"]);
|
||||
});
|
||||
|
||||
test("a wired resize switch decides whether the resize shows", () => {
|
||||
const off = cropNode({}, { resize_to_megapixels: { type: "PrimitiveBoolean", widgets: [{ name: "value", value: false }] } });
|
||||
assert.deepEqual(wiredSwitch(off, "resize_to_megapixels", false), { value: false, linked: true, known: true });
|
||||
assert.deepEqual(wiredSummaryParts(off), ["feather 24 px"]);
|
||||
assert.equal(wiredResize(off), null);
|
||||
const typedOn = cropNode({ resize_to_megapixels: false }, { resize_to_megapixels: { type: "PrimitiveBoolean", widgets: [{ name: "value", value: true }] } });
|
||||
assert.deepEqual(wiredResize(typedOn), { megapixels: 16, steps: 1 });
|
||||
const unknown = cropNode({ resize_to_megapixels: false }, { resize_to_megapixels: math() });
|
||||
assert.deepEqual(wiredSummaryParts(unknown), ["feather 24 px", "resize from a link", "16.00 MP"]);
|
||||
assert.deepEqual(wiredResize(unknown), { unknown: true });
|
||||
});
|
||||
|
||||
test("a muted source is unknown, not the widget's value", () => {
|
||||
const source = float(24);
|
||||
source.mode = 2;
|
||||
const node = cropNode({}, { megapixels: source });
|
||||
assert.deepEqual(wiredSummaryParts(node), ["feather 24 px", "MP from a link"]);
|
||||
});
|
||||
|
||||
test("a node without the resize inputs (video) only gets feather and Align", () => {
|
||||
const node = cropNode();
|
||||
node.widgets = node.widgets.filter((item) => !["resize_to_megapixels", "megapixels", "resolution_steps"].includes(item.name));
|
||||
assert.deepEqual(wiredSummaryParts(node), ["feather 24 px"]);
|
||||
assert.equal(wiredResize(node), null);
|
||||
});
|
||||
|
||||
test("the transform face reads the summary, the fields and the size readout through the wire", () => {
|
||||
const source = fs.readFileSync(new URL("../js/shared/transform_editor.mjs", import.meta.url), "utf8");
|
||||
const summary = source.slice(source.indexOf("export function transformGroupSummary"), source.indexOf("function buildTransformGroup"));
|
||||
assert.match(summary, /wiredSummaryParts\(node\)/);
|
||||
assert.doesNotMatch(summary, /value\(node, "megapixels"/);
|
||||
const request = source.slice(source.indexOf("function resizeRequest"), source.indexOf("function resizeFromLink"));
|
||||
assert.match(request, /wiredResize\(node\)/);
|
||||
for (const name of ["feather", "canvas_multiple", "megapixels", "resolution_steps"]) {
|
||||
assert.match(source, new RegExp(`wiredStandIn\\(node, "${name}"`), `${name} has no stand-in on the face`);
|
||||
}
|
||||
});
|
||||
@@ -441,3 +441,24 @@ test("a lifted socket loses the row position the frontend stamped on it", () =>
|
||||
assert.equal("pos" in loose, false);
|
||||
assert.equal(loose.widget, undefined);
|
||||
});
|
||||
|
||||
// A row folded into a group shows only while that group is open, and only a
|
||||
// header row ({ group, label }) opens it. A card that folds rows away without
|
||||
// one leaves them out of reach (Photo Camera's Crop margin and 360 width).
|
||||
test("every group a card folds rows into has a header that opens it", () => {
|
||||
const source = readFileSync(join(ROOT, "js", "widget_cards", "index.js"), "utf-8");
|
||||
const ids = [...source.matchAll(/\n {2}(AUSBOSS_NODES_\w+): \{/g)].map((match) => match[1]);
|
||||
assert.ok(ids.length > 10, "no card entries found");
|
||||
for (const id of ids) {
|
||||
const lines = cardEntry(id).split("\n");
|
||||
const headers = new Set();
|
||||
const folded = new Set();
|
||||
for (const line of lines) {
|
||||
const group = line.match(/\bgroup: "([^"]+)"/)?.[1];
|
||||
if (!group) continue;
|
||||
if (/\b(widget|pair): /.test(line)) folded.add(group);
|
||||
else headers.add(group);
|
||||
}
|
||||
for (const group of folded) assert.ok(headers.has(group), `${id} folds rows into "${group}" with no header row to open it`);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user