mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-27 14:50:20 +08:00
commit
5dcbadea0c
@ -266,15 +266,7 @@ app.registerExtension({
|
||||
this.outputs[0].name = type;
|
||||
this.outputs[0].widget = widget;
|
||||
|
||||
//make sure the seedControl is added to the correct Primitive node labelled "seed"
|
||||
if (widget.name === "seed") {
|
||||
const seed = this.#createWidget(widget.config, theirNode, widget.name);
|
||||
const seedControl = addSeedControlWidget(this, seed, "randomize");
|
||||
//this.widgets[0].link = [seedControl];//tried using all different links, not just link
|
||||
this.title = "seed";
|
||||
}
|
||||
else
|
||||
this.#createWidget(widget.config, theirNode, widget.name);
|
||||
this.#createWidget(widget.config, theirNode, widget.name);
|
||||
}
|
||||
|
||||
#createWidget(inputData, node, widgetName) {
|
||||
@ -286,12 +278,27 @@ app.registerExtension({
|
||||
|
||||
let widget;
|
||||
|
||||
if (type in ComfyWidgets) {
|
||||
widget = (ComfyWidgets[type](this, widgetName/*"value*"*/, inputData, app) || {}).widget;
|
||||
// ComfyWidgets allows a subtype of widgets which is defined by "<type>:<widgetName>"
|
||||
// common example is "INT:seed"
|
||||
// so let's check for those first
|
||||
let combinedWidgetType = type + ":" + widgetName;
|
||||
if (combinedWidgetType in ComfyWidgets) {
|
||||
// widget = (ComfyWidgets[combinedWidgetType](this, "value", inputData, app) || {}).widget;
|
||||
widget = (ComfyWidgets[combinedWidgetType](this, widgetName, inputData, app) || {}).widget;
|
||||
} else {
|
||||
widget = this.addWidget(type, widgetName /*"value"*/, null, () => { }, {});
|
||||
// we did not find a subtype, so proceed with "<type>" only
|
||||
if (type in ComfyWidgets) {
|
||||
widget = (ComfyWidgets[type](this, widgetName/*"value*"*/, inputData, app) || {}).widget;
|
||||
} else {
|
||||
widget = this.addWidget(type, widgetName /*"value"*/, null, () => { }, {});
|
||||
}
|
||||
|
||||
// addSeedControlWidget(node, seed.widget, "randomize");
|
||||
|
||||
if (widget.type === "number") {
|
||||
addSeedControlWidget(this, widget, "fixed seed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (node?.widgets && widget) {
|
||||
|
||||
@ -301,10 +308,6 @@ app.registerExtension({
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
const callback = widget.callback;
|
||||
|
||||
@ -11,8 +11,9 @@ function getNumberDefaults(inputData, defaultStep) {
|
||||
}
|
||||
|
||||
export function addSeedControlWidget(node, targetWidget, defaultValue = "randomize", values) {
|
||||
const seedControl = node.addWidget("combo", "seed control after generating", "randomize", function (v) { }, {
|
||||
values: ["fixed seed", "increment", "decrement", "randomize"]
|
||||
const seedControl = node.addWidget("combo", "seed control after generating", defaultValue, function (v) { }, {
|
||||
values: ["fixed seed", "increment", "decrement", "randomize"],
|
||||
serialize: false, // Don't include this in prompt.
|
||||
})
|
||||
seedControl.afterQueued = () => {
|
||||
|
||||
@ -59,7 +60,7 @@ function seedWidget(node, inputName, inputData) {
|
||||
const seedControl = addSeedControlWidget(node, seed.widget, "randomize");
|
||||
|
||||
seed.widget.linkedWidgets = [seedControl];
|
||||
return { widget: seed, seedControl };
|
||||
return seed;
|
||||
}
|
||||
|
||||
const MultilineSymbol = Symbol();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user