Skip to content

Commit ec7a00a

Browse files
Fix extension widgets not working.
1 parent 5d5c320 commit ec7a00a

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

web/extensions/core/groupNode.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { app } from "../../scripts/app.js";
22
import { api } from "../../scripts/api.js";
3-
import { getWidgetType } from "../../scripts/widgets.js";
43
import { mergeIfValid } from "./widgetInputs.js";
54

65
const GROUP = Symbol();
@@ -332,7 +331,7 @@ export class GroupNodeConfig {
332331
const converted = new Map();
333332
const widgetMap = (this.oldToNewWidgetMap[node.index] = {});
334333
for (const inputName of inputNames) {
335-
let widgetType = getWidgetType(inputs[inputName], inputName);
334+
let widgetType = app.getWidgetType(inputs[inputName], inputName);
336335
if (widgetType) {
337336
const convertedIndex = node.inputs?.findIndex(
338337
(inp) => inp.name === inputName && inp.widget?.name === inputName

web/scripts/app.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ComfyLogging } from "./logging.js";
2-
import { ComfyWidgets, getWidgetType } from "./widgets.js";
2+
import { ComfyWidgets } from "./widgets.js";
33
import { ComfyUI, $el } from "./ui.js";
44
import { api } from "./api.js";
55
import { defaultGraph } from "./defaultGraph.js";
@@ -1377,6 +1377,20 @@ export class ComfyApp {
13771377
await this.#invokeExtensionsAsync("registerCustomNodes");
13781378
}
13791379

1380+
getWidgetType(inputData, inputName) {
1381+
const type = inputData[0];
1382+
1383+
if (Array.isArray(type)) {
1384+
return "COMBO";
1385+
} else if (`${type}:${inputName}` in this.widgets) {
1386+
return `${type}:${inputName}`;
1387+
} else if (type in this.widgets) {
1388+
return type;
1389+
} else {
1390+
return null;
1391+
}
1392+
}
1393+
13801394
async registerNodeDef(nodeId, nodeData) {
13811395
const self = this;
13821396
const node = Object.assign(
@@ -1391,7 +1405,7 @@ export class ComfyApp {
13911405
const type = inputData[0];
13921406

13931407
let widgetCreated = true;
1394-
const widgetType = getWidgetType(inputData, inputName);
1408+
const widgetType = self.getWidgetType(inputData, inputName);
13951409
if(widgetType) {
13961410
if(widgetType === "COMBO") {
13971411
Object.assign(config, self.widgets.COMBO(this, inputName, inputData, app) || {});

web/scripts/widgets.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,6 @@ function getNumberDefaults(inputData, defaultStep, precision, enable_rounding) {
2323
return { val: defaultVal, config: { min, max, step: 10.0 * step, round, precision } };
2424
}
2525

26-
export function getWidgetType(inputData, inputName) {
27-
const type = inputData[0];
28-
29-
if (Array.isArray(type)) {
30-
return "COMBO";
31-
} else if (`${type}:${inputName}` in ComfyWidgets) {
32-
return `${type}:${inputName}`;
33-
} else if (type in ComfyWidgets) {
34-
return type;
35-
} else {
36-
return null;
37-
}
38-
}
39-
4026
export function addValueControlWidget(node, targetWidget, defaultValue = "randomize", values, widgetName, inputData) {
4127
let name = inputData[1]?.control_after_generate;
4228
if(typeof name !== "string") {

0 commit comments

Comments
 (0)