mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-23 21:00:16 +08:00
patch for imagesendWidget
* consider node.images is undefined * ugly indentation
This commit is contained in:
parent
6f99837c76
commit
185f314f37
@ -46,31 +46,31 @@ function imagesendWidget(node, inputName, inputData, app) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function callback() {
|
async function callback() {
|
||||||
if(node.images.length < 1)
|
if(node.images == undefined || node.images.length < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const image_name = node.images[0].filename;
|
const image_name = node.images[0].filename;
|
||||||
const copied = false;
|
const copied = false;
|
||||||
|
|
||||||
for(let i in app.graph._nodes) {
|
for(let i in app.graph._nodes) {
|
||||||
var n = app.graph._nodes[i];
|
var n = app.graph._nodes[i];
|
||||||
if(n.type == "LoadImage" || n.type == "LoadImageMask") {
|
if(n.type == "LoadImage" || n.type == "LoadImageMask") {
|
||||||
const imageWidget = n.widgets.find((w) => w.name === "image");
|
const imageWidget = n.widgets.find((w) => w.name === "image");
|
||||||
const recvWidget = n.widgets.find((w) => w.name === "recv img");
|
const recvWidget = n.widgets.find((w) => w.name === "recv img");
|
||||||
|
|
||||||
if(recvWidget.value == "enable") {
|
if(recvWidget.value == "enable") {
|
||||||
// copy current node image to 'recv img' enabled node
|
// copy current node image to 'recv img' enabled node
|
||||||
|
|
||||||
if(!copied) {
|
if(!copied) {
|
||||||
await api.sendOutputToInputImage(image_name);
|
await api.sendOutputToInputImage(image_name);
|
||||||
}
|
|
||||||
|
|
||||||
imageWidget.value = image_name;
|
|
||||||
const thatImageWidget = n.widgets.find((w) => w.value === "image");
|
|
||||||
await showImage(n,thatImageWidget,image_name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
imageWidget.value = image_name;
|
||||||
|
const thatImageWidget = n.widgets.find((w) => w.value === "image");
|
||||||
|
await showImage(n,thatImageWidget,image_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { widget: node.addWidget("button", inputName, "", () => { callback(); }, {}) };
|
return { widget: node.addWidget("button", inputName, "", () => { callback(); }, {}) };
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user