mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-23 20:27:02 +08:00
Make seed randomize widget run before queued
This commit is contained in:
parent
29ccf9f471
commit
578097e907
@ -1581,6 +1581,21 @@ export class ComfyApp {
|
|||||||
({ number, batchCount } = this.#queueItems.pop());
|
({ number, batchCount } = this.#queueItems.pop());
|
||||||
|
|
||||||
for (let i = 0; i < batchCount; i++) {
|
for (let i = 0; i < batchCount; i++) {
|
||||||
|
const pBefore = await this.graphToPrompt();
|
||||||
|
|
||||||
|
for (const n of pBefore.workflow.nodes) {
|
||||||
|
const node = graph.getNodeById(n.id);
|
||||||
|
if (node.widgets) {
|
||||||
|
for (const widget of node.widgets) {
|
||||||
|
// Allow widgets to run callbacks after a prompt has been queued
|
||||||
|
// e.g. random seed after every gen
|
||||||
|
if (widget.beforeQueued) {
|
||||||
|
widget.beforeQueued();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const p = await this.graphToPrompt();
|
const p = await this.graphToPrompt();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -27,7 +27,7 @@ export function addValueControlWidget(node, targetWidget, defaultValue = "random
|
|||||||
values: ["fixed", "increment", "decrement", "randomize"],
|
values: ["fixed", "increment", "decrement", "randomize"],
|
||||||
serialize: false, // Don't include this in prompt.
|
serialize: false, // Don't include this in prompt.
|
||||||
});
|
});
|
||||||
valueControl.afterQueued = () => {
|
valueControl.beforeQueued = () => {
|
||||||
|
|
||||||
var v = valueControl.value;
|
var v = valueControl.value;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user