fix auto queue + video export

This commit is contained in:
Sxela
2025-02-08 23:50:52 +01:00
parent 5910348503
commit 0709c7e6ae
2 changed files with 66 additions and 48 deletions
+1 -1
View File
@@ -424,7 +424,7 @@ class RenderVideo:
print('Exporting video.')
save_video(indir=frames_input_dir, video_out=output_dir, batch_name=batch_name, start_frame=first_frame,
last_frame=last_frame, fps=fps, output_format=output_format, use_deflicker=use_deflicker)
raise Exception(f'Exported video successfully. This exception is raised to just stop the endless cycle :D.\n you can find your video at {output_dir}')
# raise Exception(f'Exported video successfully. This exception is raised to just stop the endless cycle :D.\n you can find your video at {output_dir}')
return ()
class SchedulerInt:
+65 -47
View File
@@ -1,54 +1,72 @@
import { app } from "../../scripts/app.js";
class QueueMany {
constructor(node) {
this.serializedCtx = {};
this.node = node;
for (const [i, w] of this.node.widgets.entries()) {
if (w.name === 'start') {
this.start = w;
}
if (w.name === 'end') {
this.end = w;
}
if (w.name === 'current_number') {
this.current_number = w;
}
}
this.current_number.value = this.start.value
console.log(this.start, this.end, this.current_number)
this.QueueButton = this.node.addWidget("button", 'Queue Many', null, () => {
console.log('lolo')
this.current_number.value = this.start.value
for (let i=this.start.value; i<=this.end.value; i++){
console.log('iiii', i)
app.queuePrompt(0, 1)
}
})
this.current_number.serializeValue = async (node, index) => {return this.current_number.value}
this.current_number.afterQueued = () => {
this.current_number.value += 1
if (this.current_number.value > this.end.value) {
this.current_number.value = this.start.value
}
}
constructor(node) {
this.serializedCtx = {};
this.node = node;
for (const [i, w] of this.node.widgets.entries()) {
if (w.name === "start") {
this.start = w;
}
if (w.name === "end") {
this.end = w;
}
if (w.name === "current_number") {
this.current_number = w;
}
}
this.QueueButton = this.node.addWidget(
"button",
"Queue from " + this.start.value,
null,
() => {
const ui = window.comfyAPI.app.app.ui;
ui.autoQueueMode = "instant"; // or whatever mode you want
ui.autoQueueEnabled = true; // or false to disable
this.current_number.value = this.start.value;
if (this.current_number.value <= this.end.value) {
app.queuePrompt(0, 1);
}
}
);
this.current_number.serializeValue = async (node, index) => {
return this.current_number.value;
};
this.current_number.afterQueued = () => {
this.current_number.value += 1;
for (const [i, w] of this.node.widgets.entries()) {
if (w.name === "start") {
this.start = w;
}
if (w.name === "end") {
this.end = w;
}
if (w.name === "current_number") {
this.current_number = w;
}
}
if (this.current_number.value > this.end.value) {
const ui = window.comfyAPI.app.app.ui;
ui.autoQueueMode = "disabled";
ui.autoQueueEnabled = false;
}
};
}
}
app.registerExtension({
name: "warpfusion.queuemany",
async beforeRegisterNodeDef(nodeType, nodeData, _app) {
// console.log(nodeData.name)
if (nodeData.name === "FixedQueue"){
const onNodeCreated = nodeType.prototype.onNodeCreated;
nodeType.prototype.onNodeCreated = function () {
onNodeCreated ? onNodeCreated.apply(this, []) : undefined;
this.queueMany = new QueueMany(this);
}
};
}})
name: "warpfusion.queuemany",
async beforeRegisterNodeDef(nodeType, nodeData, _app) {
if (nodeData.name === "FixedQueue") {
const onNodeCreated = nodeType.prototype.onNodeCreated;
nodeType.prototype.onNodeCreated = function () {
onNodeCreated ? onNodeCreated.apply(this, []) : undefined;
this.queueMany = new QueueMany(this);
};
}
},
});