random commit

This commit is contained in:
Julien Lubimiv 2023-03-30 19:21:25 -04:00
parent 378e02c114
commit ea5dc10e16
3 changed files with 9 additions and 11 deletions

View File

@ -5,9 +5,6 @@ const CONVERTED_TYPE = "converted-widget";
const VALID_TYPES = ["STRING", "combo", "number"]; const VALID_TYPES = ["STRING", "combo", "number"];
function isConvertableWidget(widget, config) { 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]); return VALID_TYPES.includes(widget.type) || VALID_TYPES.includes(config[0]);
} }
@ -176,6 +173,10 @@ app.registerExtension({
node.pos = pos; node.pos = pos;
node.connect(0, this, slot); node.connect(0, this, slot);
node.title = input.name; 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 // Prevent adding duplicates due to triple clicking
input[ignoreDblClick] = true; input[ignoreDblClick] = true;
@ -288,10 +289,9 @@ app.registerExtension({
} }
} }
if (widget.type === "combo") { if (widget.type === "combo")
addSeedControlWidget(this, widget, "randomize"); addSeedControlWidget(this, widget, "randomize");
}
// When our value changes, update other widgets to reflect our changes // When our value changes, update other widgets to reflect our changes
// e.g. so LoadImage shows correct image // e.g. so LoadImage shows correct image

View File

@ -1,4 +1,4 @@
import { ComfyWidgets } from "./widgets.js"; import { addSeedControlWidget, ComfyWidgets } from "./widgets.js";
import { ComfyUI } from "./ui.js"; import { ComfyUI } from "./ui.js";
import { api } from "./api.js"; import { api } from "./api.js";
import { defaultGraph } from "./defaultGraph.js"; import { defaultGraph } from "./defaultGraph.js";
@ -781,7 +781,6 @@ class ComfyApp {
} }
} }
} }
this.#invokeExtensions("loadedGraphNode", node); this.#invokeExtensions("loadedGraphNode", node);
} }
} }

View File

@ -57,7 +57,6 @@ function seedWidget(node, inputName, inputData) {
const seed = ComfyWidgets.INT(node, inputName, inputData); const seed = ComfyWidgets.INT(node, inputName, inputData);
const seedControl = addSeedControlWidget(node, seed.widget, "randomize"); const seedControl = addSeedControlWidget(node, seed.widget, "randomize");
seed.widget.linkedWidgets = [seedControl]; seed.widget.linkedWidgets = [seedControl];
return { widget: seed, seedControl }; return { widget: seed, seedControl };
} }