Files
kk8bit 56c2b6d353 Remove the Run feature now that ComfyUI ships partial execution
Run and Run Group in the context menu, and the Alt+R shortcut, all
predate ComfyUI's own partial execution and now only duplicate it. Worse,
they existed only to drive a queuePrompt override that intercepted every
queue call, and that interception is what broke the official partial
execution and the preview method chosen in the UI.

Deleting the feature removes the override entirely, which is a better
answer than forwarding its arguments correctly. Set/Get, the other half
of this extension, is untouched.

Drops the KayTool.ShowRunOption and KayTool.ShiftR settings and their
translations. Closes #30, #31, #32.
2026-09-20 18:13:31 +08:00

38 lines
1.5 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { app } from "../../../scripts/app.js";
const UNSUPPORTED_NODES = new Set(["Group", "Reroute", "Note"]);
function addNode(name, nextTo, options = {}) {
options = { side: "left", select: true, shiftY: 0, shiftX: 0, ...options };
const node = LiteGraph.createNode(name);
app.graph.add(node);
node.pos = [
options.side === "left" ? nextTo.pos[0] - (node.size[0] + options.offset) : nextTo.pos[0] + nextTo.size[0] + options.offset,
nextTo.pos[1] + options.shiftY,
];
if (options.select) {
app.canvas.selectNode(node, false);
}
return node;
}
app.registerExtension({
name: "KayTool.QuickAdd",
beforeRegisterNodeDef(nodeType, nodeData) {
if (nodeData.input?.required && !UNSUPPORTED_NODES.has(nodeData.name)) {
const originalGetExtraMenuOptions = nodeType.prototype.getExtraMenuOptions;
nodeType.prototype.getExtraMenuOptions = function(_, options) {
originalGetExtraMenuOptions?.apply(this, arguments);
if (UNSUPPORTED_NODES.has(this.type)) return;
if (app.ui.settings.getSettingValue("KayTool.ShowSetGetOptions")) {
options.unshift(
{ content: "𝙆 🛜 Set", callback: () => { addNode("KaySetNode", this, { side: "right", offset: 20 }); } },
{ content: "𝙆 🛜 Get", callback: () => { addNode("KayGetNode", this, { side: "left", offset: 20 }); } }
);
}
};
}
}
});