Added a migration feature to smoothly load workflows written in the traditional combo into nodes written in toggle.

This commit is contained in:
Lt.Dr.Data 2023-08-01 16:25:22 +09:00
parent 834ab278d2
commit f4595cc816

View File

@ -0,0 +1,21 @@
import { ComfyApp, app } from "../../scripts/app.js";
app.registerExtension({
name: "Comfy.ToggleMigration",
nodeCreated(node, app) {
for(let i in node.widgets) {
let widget = node.widgets[i];
if(widget.type == "toggle") {
Object.defineProperty(widget, "value", {
set: (value) => {
delete widget.value;
widget.value = value == true || value == widget.options.on;
},
get: () => { return false; }
});
}
}
}
});