Some checks failed
Python Linting / Run Ruff (push) Has been cancelled
Python Linting / Run Pylint (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.10, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.11, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.12, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-unix-nightly (12.1, , linux, 3.11, [self-hosted Linux], nightly) (push) Has been cancelled
Execution Tests / test (macos-latest) (push) Has been cancelled
Execution Tests / test (ubuntu-latest) (push) Has been cancelled
Execution Tests / test (windows-latest) (push) Has been cancelled
Test server launches without errors / test (push) Has been cancelled
Unit Tests / test (macos-latest) (push) Has been cancelled
Unit Tests / test (ubuntu-latest) (push) Has been cancelled
Unit Tests / test (windows-2022) (push) Has been cancelled
Includes 30 custom nodes committed directly, 7 Civitai-exclusive loras stored via Git LFS, and a setup script that installs all dependencies and downloads HuggingFace-hosted models on vast.ai. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
import { app } from "../../../scripts/app.js";
|
|
import { ComfyWidgets } from "../../../scripts/widgets.js";
|
|
|
|
app.registerExtension({
|
|
name: "pysssss.MathExpression",
|
|
init() {
|
|
const STRING = ComfyWidgets.STRING;
|
|
ComfyWidgets.STRING = function (node, inputName, inputData) {
|
|
const r = STRING.apply(this, arguments);
|
|
r.widget.dynamicPrompts = inputData?.[1].dynamicPrompts;
|
|
return r;
|
|
};
|
|
},
|
|
beforeRegisterNodeDef(nodeType) {
|
|
if (nodeType.comfyClass === "MathExpression|pysssss") {
|
|
const onDrawForeground = nodeType.prototype.onDrawForeground;
|
|
|
|
nodeType.prototype.onNodeCreated = function() {
|
|
// These are typed as any to bypass backend validation
|
|
// update frontend to restrict types
|
|
for(const input of this.inputs) {
|
|
input.type = "INT,FLOAT,IMAGE,LATENT";
|
|
}
|
|
}
|
|
|
|
nodeType.prototype.onDrawForeground = function (ctx) {
|
|
const r = onDrawForeground?.apply?.(this, arguments);
|
|
|
|
const v = app.nodeOutputs?.[this.id + ""];
|
|
if (!this.flags.collapsed && v) {
|
|
const text = v.value[0] + "";
|
|
ctx.save();
|
|
ctx.font = "bold 12px sans-serif";
|
|
ctx.fillStyle = "dodgerblue";
|
|
const sz = ctx.measureText(text);
|
|
ctx.fillText(text, this.size[0] - sz.width - 5, LiteGraph.NODE_SLOT_HEIGHT * 3);
|
|
ctx.restore();
|
|
}
|
|
|
|
return r;
|
|
};
|
|
}
|
|
},
|
|
});
|