Skip to content

Commit 2dc7257

Browse files
committed
Allow connect premitive Node to "comfyiUI-nodes that have forceInput setting"
1 parent ebd7f9b commit 2dc7257

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

web/extensions/core/widgetInputs.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ app.registerExtension({
233233
// Fires before the link is made allowing us to reject it if it isn't valid
234234

235235
// No widget, we cant connect
236-
if (!input.widget) return false;
236+
if (!input.widget) {
237+
if (!(input.type in ComfyWidgets)) return false;
238+
}
237239

238240
if (this.outputs[slot].links?.length) {
239241
return this.#isValidConnection(input);
@@ -252,9 +254,18 @@ app.registerExtension({
252254
const input = theirNode.inputs[link.target_slot];
253255
if (!input) return;
254256

255-
const widget = input.widget;
256-
const { type, linkType } = getWidgetType(widget.config);
257257

258+
var _widget;
259+
if (!input.widget) {
260+
if (!(input.type in ComfyWidgets)) return;
261+
_widget = { "name": input.name, "config": [input.type, {}] }//fake widget
262+
} else {
263+
_widget = input.widget;
264+
}
265+
266+
const widget = _widget;
267+
const { type, linkType } = getWidgetType(widget.config);
268+
console.log({ "input": input });
258269
// Update our output to restrict to the widget type
259270
this.outputs[0].type = linkType;
260271
this.outputs[0].name = type;
@@ -274,7 +285,7 @@ app.registerExtension({
274285
if (type in ComfyWidgets) {
275286
widget = (ComfyWidgets[type](this, "value", inputData, app) || {}).widget;
276287
} else {
277-
widget = this.addWidget(type, "value", null, () => {}, {});
288+
widget = this.addWidget(type, "value", null, () => { }, {});
278289
}
279290

280291
if (node?.widgets && widget) {

0 commit comments

Comments
 (0)