mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-12 22:42:36 +08:00
fixing connection removal
This commit is contained in:
parent
6cae80e402
commit
1f75e8bf8e
@ -11,15 +11,22 @@ app.registerExtension({
|
|||||||
let outputSlots = []; // (int (node), int (slot))
|
let outputSlots = []; // (int (node), int (slot))
|
||||||
let inputSlots = [];
|
let inputSlots = [];
|
||||||
|
|
||||||
const refreshPins = async (subflowName) => {
|
const refreshNode = async (subflowName) => {
|
||||||
const subflowData = await api.getSubflow(subflowName);
|
const subflowData = await api.getSubflow(subflowName);
|
||||||
if (!subflowData.subflow) return;
|
if (!subflowData.subflow) return;
|
||||||
|
|
||||||
|
const subflowNodes = subflowData.subflow.nodes
|
||||||
|
updateSubflowPrompt(subflowData.subflow);
|
||||||
|
refreshPins(subflowNodes);
|
||||||
|
|
||||||
|
node.size[0] = computeSizeX(subflowName);
|
||||||
|
};
|
||||||
|
|
||||||
|
const refreshPins = (subflowNodes) => {
|
||||||
|
console.log(subflowNodes);
|
||||||
inputSlots = [];
|
inputSlots = [];
|
||||||
outputSlots = [];
|
outputSlots = [];
|
||||||
|
|
||||||
const subflowNodes = subflowData.subflow.nodes
|
|
||||||
updateSubflowPrompt(subflowData.subflow);
|
|
||||||
// remove all existing pins
|
// remove all existing pins
|
||||||
const numInputs = node.inputs?.length ?? 0;
|
const numInputs = node.inputs?.length ?? 0;
|
||||||
const numOutputs = node.outputs?.length ?? 0;
|
const numOutputs = node.outputs?.length ?? 0;
|
||||||
@ -30,6 +37,7 @@ app.registerExtension({
|
|||||||
node.removeOutput(i);
|
node.removeOutput(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add the new pins and keep track of where the exported vars go to within the inner nodes
|
||||||
for (const subflowNode of subflowNodes) {
|
for (const subflowNode of subflowNodes) {
|
||||||
const exports = subflowNode.properties.exports;
|
const exports = subflowNode.properties.exports;
|
||||||
if (exports) {
|
if (exports) {
|
||||||
@ -57,9 +65,13 @@ app.registerExtension({
|
|||||||
node.subflow = subflow;
|
node.subflow = subflow;
|
||||||
};
|
};
|
||||||
|
|
||||||
node.onAdded = () => refreshPins(node.widgets[0].value);
|
const computeSizeX = (subflowName) => {
|
||||||
node.onConfigure = () => refreshPins(node.widgets[0].value);
|
return Math.max(100, LiteGraph.NODE_TEXT_SIZE * subflowName.length * 0.45 + 160);
|
||||||
node.widgets[0].callback = (subflowName) => refreshPins(subflowName);
|
};
|
||||||
|
|
||||||
|
node.onAdded = () => updateSubflowPrompt(node.widgets[0].value);
|
||||||
|
node.onConfigure = () => updateSubflowPrompt(node.widgets[0].value);
|
||||||
|
node.widgets[0].callback = (subflowName) => refreshNode(subflowName);
|
||||||
|
|
||||||
node.getExportedOutput = (slot) => {
|
node.getExportedOutput = (slot) => {
|
||||||
return outputSlots[slot];
|
return outputSlots[slot];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user