mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-01-25 15:55:18 +00:00
Allows nodes to return ui data and output data
Fire executed event on node when message received
This commit is contained in:
parent
7a7c4e7f73
commit
6f72c4c6ff
@ -65,8 +65,11 @@ def recursive_execute(server, prompt, outputs, current_item, extra_data={}):
|
|||||||
|
|
||||||
nodes.before_node_execution()
|
nodes.before_node_execution()
|
||||||
outputs[unique_id] = getattr(obj, obj.FUNCTION)(**input_data_all)
|
outputs[unique_id] = getattr(obj, obj.FUNCTION)(**input_data_all)
|
||||||
if "ui" in outputs[unique_id] and server.client_id is not None:
|
if "ui" in outputs[unique_id]:
|
||||||
|
if server.client_id is not None:
|
||||||
server.send_sync("executed", { "node": unique_id, "output": outputs[unique_id]["ui"] }, server.client_id)
|
server.send_sync("executed", { "node": unique_id, "output": outputs[unique_id]["ui"] }, server.client_id)
|
||||||
|
if "result" in outputs[unique_id]:
|
||||||
|
outputs[unique_id] = outputs[unique_id]["result"]
|
||||||
return executed + [unique_id]
|
return executed + [unique_id]
|
||||||
|
|
||||||
def recursive_will_execute(prompt, outputs, current_item):
|
def recursive_will_execute(prompt, outputs, current_item):
|
||||||
|
@ -617,6 +617,10 @@ class ComfyApp {
|
|||||||
|
|
||||||
api.addEventListener("executed", ({ detail }) => {
|
api.addEventListener("executed", ({ detail }) => {
|
||||||
this.nodeOutputs[detail.node] = detail.output;
|
this.nodeOutputs[detail.node] = detail.output;
|
||||||
|
const node = this.graph.getNodeById(detail.node);
|
||||||
|
if (node.onExecuted) {
|
||||||
|
node.onExecuted(detail.output);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
api.init();
|
api.init();
|
||||||
@ -739,6 +743,9 @@ class ComfyApp {
|
|||||||
const inputData = inputs[inputName];
|
const inputData = inputs[inputName];
|
||||||
const type = inputData[0];
|
const type = inputData[0];
|
||||||
|
|
||||||
|
if(inputData[1]?.forceInput) {
|
||||||
|
this.addInput(inputName, type);
|
||||||
|
} else {
|
||||||
if (Array.isArray(type)) {
|
if (Array.isArray(type)) {
|
||||||
// Enums
|
// Enums
|
||||||
Object.assign(config, widgets.COMBO(this, inputName, inputData, app) || {});
|
Object.assign(config, widgets.COMBO(this, inputName, inputData, app) || {});
|
||||||
@ -753,6 +760,7 @@ class ComfyApp {
|
|||||||
this.addInput(inputName, type);
|
this.addInput(inputName, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (const o in nodeData["output"]) {
|
for (const o in nodeData["output"]) {
|
||||||
const output = nodeData["output"][o];
|
const output = nodeData["output"][o];
|
||||||
|
Loading…
Reference in New Issue
Block a user