diff --git a/js/FluxAttentionSeeker.js b/js/FluxAttentionSeeker.js new file mode 100644 index 0000000..4a7733f --- /dev/null +++ b/js/FluxAttentionSeeker.js @@ -0,0 +1,51 @@ +import { app } from "../../scripts/app.js"; + +app.registerExtension({ + name: "essentials.FluxAttentionSeeker", + async beforeRegisterNodeDef(nodeType, nodeData, app) { + if (!nodeData?.category?.startsWith("essentials")) { + return; + } + + if (nodeData.name === "FluxAttentionSeeker+") { + const onCreated = nodeType.prototype.onNodeCreated; + + nodeType.prototype.onNodeCreated = function () { + console.log(LGraphCanvas); + this.addWidget("button", "RESET ALL", null, () => { + this.widgets.forEach(w => { + if (w.type === "slider") { + w.value = 1.0; + } + }); + }); + + this.addWidget("button", "ZERO ALL", null, () => { + this.widgets.forEach(w => { + if (w.type === "slider") { + w.value = 0.0; + } + }); + }); + + this.addWidget("button", "REPEAT FIRST", null, () => { + var clip_value = undefined; + var t5_value = undefined; + this.widgets.forEach(w => { + if (w.name.startsWith('clip_l')) { + if (clip_value === undefined) { + clip_value = w.value; + } + w.value = clip_value; + } else if (w.name.startsWith('t5')) { + if (t5_value === undefined) { + t5_value = w.value; + } + w.value = t5_value; + } + }); + }); + }; + } + }, +}); \ No newline at end of file diff --git a/misc.py b/misc.py index 237a0a7..071cb95 100644 --- a/misc.py +++ b/misc.py @@ -3,6 +3,7 @@ import torch from .utils import AnyType import comfy.model_management from nodes import MAX_RESOLUTION +import time any = AnyType("*")