trying some things but no luck

This commit is contained in:
FizzleDorf 2023-03-31 01:14:10 -04:00
parent c8e0185921
commit 505821d982
5 changed files with 18 additions and 22 deletions

Binary file not shown.

View File

@ -7,6 +7,6 @@
"\\web\\lib",
"\\web\\scripts"
],
"SelectedNode": "\\web\\scripts\\ui.js",
"SelectedNode": "\\web\\scripts\\widgets.js",
"PreviewInSolutionExplorer": false
}

Binary file not shown.

View File

@ -5,6 +5,9 @@ const CONVERTED_TYPE = "converted-widget";
const VALID_TYPES = ["STRING", "combo", "number"];
function isConvertableWidget(widget, config) {
if (widget.name == "seed control after generating")
widget.allowConvertToInput = false;
else
return VALID_TYPES.includes(widget.type) || VALID_TYPES.includes(config[0]);
}
@ -173,10 +176,6 @@ app.registerExtension({
node.pos = pos;
node.connect(0, this, slot);
node.title = input.name;
if (node.title == "seed") {
node.widgets.addSeedControlWidget(node, node.widgets[0], "randomize");
value.widget.linkedWidgets = [seedControl];
}
// Prevent adding duplicates due to triple clicking
input[ignoreDblClick] = true;
@ -193,7 +192,7 @@ app.registerExtension({
constructor() {
this.addOutput("connect to widget input", "*");
this.serialize_widgets = true;
this.isVirtualNode = true;
this.isVirtualNode = true;
}
applyToGraph() {
@ -276,11 +275,19 @@ app.registerExtension({
}
let widget;
if (type in ComfyWidgets) {
widget = (ComfyWidgets[type](this, "value", inputData, app) || {}).widget;
widget = (ComfyWidgets[type](this, widgetName/*"value*"*/, inputData, app) || {}).widget;
if (widgetName == "seed") {
addSeedControlWidget(node, node.widgets[0],"randomize");
}
} else {
widget = this.addWidget(type, "value", null, () => {}, {});
widget = this.addWidget(type, widgetName /*"value"*/, null, () => { }, {});
if (widgetName == "seed") {
addSeedControlWidget(node, node.widgets[0], "randomize");
}
}
if (node?.widgets && widget) {
const theirWidget = node.widgets.find((w) => w.name === widgetName);
@ -288,9 +295,6 @@ app.registerExtension({
widget.value = theirWidget.value;
}
}
if (widget.type === "combo") {
addSeedControlWidget(this, widget, "randomize");
}
// When our value changes, update other widgets to reflect our changes
// e.g. so LoadImage shows correct image

View File

@ -1,4 +1,4 @@
import { addSeedControlWidget, ComfyWidgets } from "./widgets.js";
import { ComfyWidgets } from "./widgets.js";
import { ComfyUI } from "./ui.js";
import { api } from "./api.js";
import { defaultGraph } from "./defaultGraph.js";
@ -771,23 +771,15 @@ class ComfyApp {
widget.value = widget.value.slice(7);
}
}
if (widget.name == "seed control after generating") {
if (widget.value == true) {
widget.value = "randomize";
}
}
}
}
if (widget.name == "seed control after generating") {
if (widget.value == true) {
widget.value = "randomize";
}
}
}
this.#invokeExtensions("loadedGraphNode", node);
}
this.#invokeExtensions("loadedGraphNode", node);
}
}