mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-14 15:32:35 +08:00
Avoid primitives being able to connect to wildcard reroutes
This commit is contained in:
parent
3d2ae0e85a
commit
5e600e6a6a
@ -111,12 +111,13 @@ app.registerExtension({
|
|||||||
} else {
|
} else {
|
||||||
// We've found an output
|
// We've found an output
|
||||||
const nodeOutType = node.inputs && node.inputs[link?.target_slot] && node.inputs[link.target_slot].type ? node.inputs[link.target_slot].type : null;
|
const nodeOutType = node.inputs && node.inputs[link?.target_slot] && node.inputs[link.target_slot].type ? node.inputs[link.target_slot].type : null;
|
||||||
outputWidget = node.inputs[link.target_slot]?.widget ?? null;
|
|
||||||
if (inputType && nodeOutType !== inputType && inputType !== "*") {
|
if (inputType && nodeOutType !== inputType && inputType !== "*") {
|
||||||
// The output doesnt match our input and is not a wildcard so disconnect it
|
// The output doesnt match our input and is not a wildcard so disconnect it
|
||||||
node.disconnectInput(link.target_slot);
|
node.disconnectInput(link.target_slot);
|
||||||
} else {
|
} else {
|
||||||
outputType = nodeOutType;
|
outputType = nodeOutType;
|
||||||
|
// We are not disconnecting the output node, so store the widget of the output node
|
||||||
|
outputWidget = node.inputs[link.target_slot]?.widget ?? null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,9 +142,10 @@ app.registerExtension({
|
|||||||
node.__outputType = displayType;
|
node.__outputType = displayType;
|
||||||
node.outputs[0].name = node.properties.showOutputText ? displayType : "";
|
node.outputs[0].name = node.properties.showOutputText ? displayType : "";
|
||||||
if (outputWidget) {
|
if (outputWidget) {
|
||||||
// Inherit the widget from the connected input
|
// Inherit the widget from the connected input
|
||||||
node.inputs[0].widget = outputWidget;
|
node.inputs[0].widget = outputWidget;
|
||||||
} else {
|
} else {
|
||||||
|
// Delete the widget if no output widget is found
|
||||||
delete node.inputs[0].widget;
|
delete node.inputs[0].widget;
|
||||||
}
|
}
|
||||||
node.size = node.computeSize();
|
node.size = node.computeSize();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user