From 37f834e7b569af8894704b541b85e96a4d0d5ba8 Mon Sep 17 00:00:00 2001 From: Rainer Klaffehn Date: Sun, 10 Sep 2023 09:03:26 +0200 Subject: [PATCH] Allow input/widget conversion for type "combo." ComfyWidgets.COMBO creates widgets with "combo" as type. Custom widget will want to have that widget/input conversion. --- web/extensions/core/widgetInputs.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/web/extensions/core/widgetInputs.js b/web/extensions/core/widgetInputs.js index 895519dee..c3d907b0c 100644 --- a/web/extensions/core/widgetInputs.js +++ b/web/extensions/core/widgetInputs.js @@ -92,7 +92,10 @@ app.registerExtension({ if (type in ComfyWidgets) { widget = (ComfyWidgets[type](this, "value", inputData, app) || {}).widget; } else { - widget = this.addWidget(type, "value", null, () => { }, {}); + if (type == "combo") + widget = this.addWidget("combo", "value", null, () => {}, { values: inputData[1]?.values || [] }); + else + widget = this.addWidget(type, "value", null, () => {}, {}); } if (node?.widgets && widget) { @@ -154,7 +157,12 @@ app.registerExtension({ for (const k in config1[1]) { if (k !== "default" && k !== 'forceInput') { - if (config1[1][k] !== config2[1][k]) { + const lhs = config1[1][k]; + const rhs = config2[1][k]; + if (lhs instanceof Array && rhs instanceof Array) { + if (lhs.length != rhs.length || !lhs.reduce((state, value, index) => state && value === rhs[index], true)) + return false; + } else if (lhs !== rhs) { return false; } }