Add support for IMAGE/LATENT

Remove STRING output, instead draw to node
This commit is contained in:
pythongosssss
2023-08-22 12:56:01 +01:00
parent 2b8d90b155
commit 77590b1723
2 changed files with 51 additions and 13 deletions
+21
View File
@@ -11,4 +11,25 @@ app.registerExtension({
return r;
};
},
beforeRegisterNodeDef(nodeType) {
if (nodeType.comfyClass === "MathExpression|pysssss") {
const onDrawForeground = nodeType.prototype.onDrawForeground;
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;
};
}
},
});