feat: 新增Show Any (UTK)节点和Extract Video Frames (UTK)节点

- 新增Show Any (UTK)节点:支持显示任意类型数据,参考comfyui-easy-use实现
- 新增Extract Video Frames (UTK)节点:支持从视频或图片序列中智能抽取帧
- 更新版本号至1.4.9
- 添加WEB_DIRECTORY导出以支持JavaScript文件加载
This commit is contained in:
Cyber Dick Lang
2025-12-04 01:48:10 +08:00
parent ca49258023
commit 522ff9b5ec
5 changed files with 695 additions and 3 deletions
+61
View File
@@ -0,0 +1,61 @@
import { app } from "../../scripts/app.js";
import { ComfyWidgets } from "../../scripts/widgets.js";
app.registerExtension({
name: "ShowAny_UTK",
async beforeRegisterNodeDef(nodeType, nodeData, app) {
if (nodeData.name === "ShowAny_UTK") {
function populate(text) {
if (!text || !Array.isArray(text)) {
return;
}
if (this.widgets) {
const pos = this.widgets.findIndex((w) => w.name === "text");
if (pos !== -1) {
for (let i = pos; i < this.widgets.length; i++) {
this.widgets[i].onRemove?.();
}
this.widgets.length = pos;
}
}
for (const list of text) {
const w = ComfyWidgets["STRING"](this, "text", ["STRING", { multiline: true }], app).widget;
w.inputEl.readOnly = true;
w.inputEl.style.opacity = 0.6;
w.value = list;
}
requestAnimationFrame(() => {
const sz = this.computeSize();
if (sz[0] < this.size[0]) {
sz[0] = this.size[0];
}
if (sz[1] < this.size[1]) {
sz[1] = this.size[1];
}
this.onResize?.(sz);
app.graph.setDirtyCanvas(true, false);
});
}
// When the node is executed we will be sent the input text, display this in the widget
const onExecuted = nodeType.prototype.onExecuted;
nodeType.prototype.onExecuted = function (message) {
onExecuted?.apply(this, arguments);
if (message && message.text) {
populate.call(this, message.text);
}
};
const onConfigure = nodeType.prototype.onConfigure;
nodeType.prototype.onConfigure = function () {
onConfigure?.apply(this, arguments);
if (this.widgets_values?.length) {
populate.call(this, this.widgets_values);
}
};
}
}
});