mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-28 07:10:15 +08:00
make createWidget subtype aware
-> if (widget.name === "seed") is not necessary anymore
This commit is contained in:
parent
6cc52b42bb
commit
3fe76483fb
@ -275,9 +275,7 @@ app.registerExtension({
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
this.#createWidget(widget.config, theirNode, widget.name);
|
this.#createWidget(widget.config, theirNode, widget.name);
|
||||||
if (widget.name === "seed") {
|
|
||||||
addSeedControlWidget(this, this.widget, "randomize");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#createWidget(inputData, node, widgetName) {
|
#createWidget(inputData, node, widgetName) {
|
||||||
@ -289,12 +287,25 @@ app.registerExtension({
|
|||||||
|
|
||||||
let widget;
|
let widget;
|
||||||
|
|
||||||
if (type in ComfyWidgets) {
|
// ComfyWidgets allows a subtype of widgets which is defined by "<type>:<widgetName>"
|
||||||
widget = (ComfyWidgets[type](this, widgetName/*"value*"*/, inputData, app) || {}).widget;
|
// 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;
|
||||||
} else {
|
} 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, () => { }, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// if (widget.type === "number") {
|
||||||
|
// addSeedControlWidget(this, this.widget, "randomize");
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (node?.widgets && widget) {
|
if (node?.widgets && widget) {
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user