mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-08 08:12:34 +08:00
Fix widget creation for Primitive Node
widget creation in #createWidget is now aware of widget subtype like "INT:seed" meaning, it does not need special treatment for the randomizeWidget anymore
This commit is contained in:
parent
9a27030519
commit
5794ff7933
@ -271,10 +271,20 @@ app.registerExtension({
|
|||||||
}
|
}
|
||||||
|
|
||||||
let widget;
|
let widget;
|
||||||
if (type in ComfyWidgets) {
|
|
||||||
widget = (ComfyWidgets[type](this, "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;
|
||||||
} else {
|
} else {
|
||||||
widget = this.addWidget(type, "value", null, () => {}, {});
|
// we did not find a subtype, so proceed with "<type>" only
|
||||||
|
if (type in ComfyWidgets) {
|
||||||
|
widget = (ComfyWidgets[type](this, "value", inputData, app) || {}).widget;
|
||||||
|
} else {
|
||||||
|
widget = this.addWidget(type, "value", null, () => {}, {});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node?.widgets && widget) {
|
if (node?.widgets && widget) {
|
||||||
@ -284,10 +294,6 @@ app.registerExtension({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (widget.type === "number") {
|
|
||||||
addRandomizeWidget(this, widget, "Random after every gen");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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
|
||||||
const callback = widget.callback;
|
const callback = widget.callback;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user