Files
ComfyUI/custom_nodes/comfyui-inspire-pack/js/regional.js
jaidaken f09734b0ee
Some checks failed
Python Linting / Run Ruff (push) Has been cancelled
Python Linting / Run Pylint (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.10, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.11, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.12, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-unix-nightly (12.1, , linux, 3.11, [self-hosted Linux], nightly) (push) Has been cancelled
Execution Tests / test (macos-latest) (push) Has been cancelled
Execution Tests / test (ubuntu-latest) (push) Has been cancelled
Execution Tests / test (windows-latest) (push) Has been cancelled
Test server launches without errors / test (push) Has been cancelled
Unit Tests / test (macos-latest) (push) Has been cancelled
Unit Tests / test (ubuntu-latest) (push) Has been cancelled
Unit Tests / test (windows-2022) (push) Has been cancelled
Add custom nodes, Civitai loras (LFS), and vast.ai setup script
Includes 30 custom nodes committed directly, 7 Civitai-exclusive
loras stored via Git LFS, and a setup script that installs all
dependencies and downloads HuggingFace-hosted models on vast.ai.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 00:56:42 +00:00

64 lines
1.9 KiB
JavaScript

import { ComfyApp, app } from "../../scripts/app.js";
import { ComfyDialog, $el } from "../../scripts/ui.js";
import { api } from "../../scripts/api.js";
app.registerExtension({
name: "Comfy.Inspire.Regional",
async beforeRegisterNodeDef(nodeType, nodeData, app) {
if (nodeData.name === 'ApplyRegionalIPAdapters //Inspire') {
var input_name = "input";
var base_slot = 0;
switch(nodeData.name) {
case 'ApplyRegionalIPAdapters //Inspire':
input_name = "regional_ipadapter";
base_slot = 1;
break;
}
const onConnectionsChange = nodeType.prototype.onConnectionsChange;
nodeType.prototype.onConnectionsChange = function (type, index, connected, link_info) {
if(!link_info || type == 2)
return;
if(this.inputs[0].type == '*'){
const node = app.graph.getNodeById(link_info.origin_id);
let origin_type = node.outputs[link_info.origin_slot].type;
if(origin_type == '*') {
this.disconnectInput(link_info.target_slot);
return;
}
for(let i in this.inputs) {
let input_i = this.inputs[i];
if(input_i.name != 'select' && input_i.name != 'sel_mode')
input_i.type = origin_type;
}
}
if (!connected && (this.inputs.length > base_slot+1)) {
const stackTrace = new Error().stack;
if(
!stackTrace.includes('LGraphNode.prototype.connect') && // for touch device
!stackTrace.includes('LGraphNode.connect') && // for mouse device
!stackTrace.includes('loadGraphData')) {
this.removeInput(index);
}
}
let slot_i = 1;
for (let i = base_slot; i < this.inputs.length; i++) {
let input_i = this.inputs[i];
input_i.name = `${input_name}${slot_i}`
slot_i++;
}
let last_slot = this.inputs[this.inputs.length - 1];
if (last_slot.link != undefined) {
this.addInput(`${input_name}${slot_i}`, this.inputs[base_slot].type);
}
}
}
}});