Fix updated ComfyUI breaking power primitive widget naming.
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "rgthree-comfy"
|
||||
description = "Making ComfyUI more comfortable."
|
||||
version = "1.0.2610270041"
|
||||
version = "1.0.2610272322"
|
||||
license = { file = "LICENSE" }
|
||||
dependencies = []
|
||||
|
||||
|
||||
@@ -141,7 +141,15 @@ class RgthreePowerPrimitive extends RgthreeBaseServerNode {
|
||||
if (this.typeState == newTypeState) return;
|
||||
this.typeState = newTypeState;
|
||||
|
||||
// [🤮] Need to remove the widget first because we can no longer rename the widget and ComfyUI
|
||||
// frontend now forces an incremental name that can't be changes (e.g. "value#3").
|
||||
let value = this.valueWidget?.value ?? null;
|
||||
let newIndex = this.widgets.indexOf(this.valueWidget);
|
||||
if (this.valueWidget) {
|
||||
this.removeWidget(this.valueWidget);
|
||||
} else {
|
||||
newIndex = this.widgets.length;
|
||||
}
|
||||
let newWidget: IWidget | null = null;
|
||||
// If we're linked, then set the UI to an empty string widget input, since the ComfyUI is rather
|
||||
// confusing by showing a value that is not the actual value used (from the input).
|
||||
@@ -174,14 +182,10 @@ class RgthreePowerPrimitive extends RgthreeBaseServerNode {
|
||||
throw new Error(`Unsupported type "${type}".`);
|
||||
}
|
||||
|
||||
if (this.valueWidget) {
|
||||
this.replaceWidget(this.valueWidget, newWidget);
|
||||
} else {
|
||||
if (!this.widgets.includes(newWidget)) {
|
||||
this.addCustomWidget(newWidget);
|
||||
}
|
||||
moveArrayItem(this.widgets, newWidget, 1);
|
||||
if (!this.widgets.includes(newWidget)) {
|
||||
this.addCustomWidget(newWidget);
|
||||
}
|
||||
moveArrayItem(this.widgets, newWidget, newIndex);
|
||||
this.valueWidget = newWidget;
|
||||
|
||||
// Set the input data.
|
||||
|
||||
@@ -80,6 +80,13 @@ class RgthreePowerPrimitive extends RgthreeBaseServerNode {
|
||||
return;
|
||||
this.typeState = newTypeState;
|
||||
let value = (_e = (_c = this.valueWidget) === null || _c === void 0 ? void 0 : _c.value) !== null && _e !== void 0 ? _e : null;
|
||||
let newIndex = this.widgets.indexOf(this.valueWidget);
|
||||
if (this.valueWidget) {
|
||||
this.removeWidget(this.valueWidget);
|
||||
}
|
||||
else {
|
||||
newIndex = this.widgets.length;
|
||||
}
|
||||
let newWidget = null;
|
||||
if (linked) {
|
||||
newWidget = ComfyWidgets["STRING"](this, name, ["STRING"], app).widget;
|
||||
@@ -112,15 +119,10 @@ class RgthreePowerPrimitive extends RgthreeBaseServerNode {
|
||||
if (newWidget == null) {
|
||||
throw new Error(`Unsupported type "${type}".`);
|
||||
}
|
||||
if (this.valueWidget) {
|
||||
this.replaceWidget(this.valueWidget, newWidget);
|
||||
}
|
||||
else {
|
||||
if (!this.widgets.includes(newWidget)) {
|
||||
this.addCustomWidget(newWidget);
|
||||
}
|
||||
moveArrayItem(this.widgets, newWidget, 1);
|
||||
if (!this.widgets.includes(newWidget)) {
|
||||
this.addCustomWidget(newWidget);
|
||||
}
|
||||
moveArrayItem(this.widgets, newWidget, newIndex);
|
||||
this.valueWidget = newWidget;
|
||||
if (!((_d = this.inputs) === null || _d === void 0 ? void 0 : _d.length)) {
|
||||
this.addInput("value", "*", { widget: this.valueWidget });
|
||||
|
||||
Reference in New Issue
Block a user