Closed chrisgoringe closed 11 months ago
Make inputs required on choosers?
Could make the outputs of 'preview' custom types which will only connect to the inputs of the chooser.
Is there a reason for not making it a single node? And maybe another just for Fabric? Something like And showing 'Go' / 'Cancel' / 'Restart from here' buttons based on state.
Yes, there is a reason for having two nodes... The images are only available at the end of the node execution - they are part of the output.
So you can't see the images and then determine the output of the same node. Hence the need to have two linked nodes...
Hmmm. Maybe....
if I added a custom event listener to the api:
import { api } from "../../scripts/api.js";
function earlyImageHandler(event) {
try {
let nodes = app.graph._nodes_by_id;
let node = nodes[event.detail.node_id];
if(!node) {
console.log(`invalid node id '${event.detail.node_id}'`);
return;
}
// do something with event.details.urls
}
catch(e) {
console.log(`exception occurs\n${e}`);
}
}
api.addEventListener("early-image-handler", earlyImageHandler);
then I think
PromptServer.instance.send_sync("early-image-handler", {"node_id": unique_id, "urls":[preview1, preview2, ...]})
//now wait
could send the images in mid-execution...
Done in new branch
Chooser nodes should always be directly downstream of a preview and fully connected: that way they can be closely integrated.
Should warn if this isn't the case (maybe even refuse to run?)