Only connect to any when there's inputs.
This commit is contained in:
@@ -286,10 +286,12 @@ LGraphNode.prototype.connectByType = function connectByType<T = any>(
|
||||
optsIn: string): T | null {
|
||||
// If we're droppiong on a node, and the last input is free and an "*" type, then connect there
|
||||
// first...
|
||||
for (const [index, input] of sourceNode.inputs.entries()) {
|
||||
if (!input.link && input.type === '*') {
|
||||
this.connect(slot, sourceNode, index);
|
||||
return null;
|
||||
if (sourceNode.inputs) {
|
||||
for (const [index, input] of sourceNode.inputs.entries()) {
|
||||
if (!input.link && input.type === '*') {
|
||||
this.connect(slot, sourceNode, index);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (oldLGraphNodeConnectByType && oldLGraphNodeConnectByType.call(this, slot, sourceNode, sourceSlotType, optsIn) || null) as T;
|
||||
|
||||
@@ -160,10 +160,12 @@ export class BaseAnyInputConnectedNode extends RgthreeBaseNode {
|
||||
}
|
||||
const oldLGraphNodeConnectByType = LGraphNode.prototype.connectByType;
|
||||
LGraphNode.prototype.connectByType = function connectByType(slot, sourceNode, sourceSlotType, optsIn) {
|
||||
for (const [index, input] of sourceNode.inputs.entries()) {
|
||||
if (!input.link && input.type === '*') {
|
||||
this.connect(slot, sourceNode, index);
|
||||
return null;
|
||||
if (sourceNode.inputs) {
|
||||
for (const [index, input] of sourceNode.inputs.entries()) {
|
||||
if (!input.link && input.type === '*') {
|
||||
this.connect(slot, sourceNode, index);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (oldLGraphNodeConnectByType && oldLGraphNodeConnectByType.call(this, slot, sourceNode, sourceSlotType, optsIn) || null);
|
||||
|
||||
Reference in New Issue
Block a user