Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
e1b1af9d
Commit
e1b1af9d
authored
Mar 30, 2023
by
comfyanonymous
Browse files
Merge branch 'node-execute-event' of
https://github.com/pythongosssss/ComfyUI
parents
5218e5d5
00c1ec49
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
13 deletions
+24
-13
execution.py
execution.py
+5
-2
web/scripts/app.js
web/scripts/app.js
+19
-11
No files found.
execution.py
View file @
e1b1af9d
...
@@ -65,8 +65,11 @@ def recursive_execute(server, prompt, outputs, current_item, extra_data={}):
...
@@ -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
]:
server
.
send_sync
(
"executed"
,
{
"node"
:
unique_id
,
"output"
:
outputs
[
unique_id
][
"ui"
]
},
server
.
client_id
)
if
server
.
client_id
is
not
None
:
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
):
...
...
web/scripts/app.js
View file @
e1b1af9d
...
@@ -617,6 +617,10 @@ class ComfyApp {
...
@@ -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,18 +743,22 @@ class ComfyApp {
...
@@ -739,18 +743,22 @@ class ComfyApp {
const
inputData
=
inputs
[
inputName
];
const
inputData
=
inputs
[
inputName
];
const
type
=
inputData
[
0
];
const
type
=
inputData
[
0
];
if
(
Array
.
isArray
(
type
))
{
if
(
inputData
[
1
]?.
forceInput
)
{
// Enums
Object
.
assign
(
config
,
widgets
.
COMBO
(
this
,
inputName
,
inputData
,
app
)
||
{});
}
else
if
(
`
${
type
}
:
${
inputName
}
`
in
widgets
)
{
// Support custom widgets by Type:Name
Object
.
assign
(
config
,
widgets
[
`
${
type
}
:
${
inputName
}
`
](
this
,
inputName
,
inputData
,
app
)
||
{});
}
else
if
(
type
in
widgets
)
{
// Standard type widgets
Object
.
assign
(
config
,
widgets
[
type
](
this
,
inputName
,
inputData
,
app
)
||
{});
}
else
{
// Node connection inputs
this
.
addInput
(
inputName
,
type
);
this
.
addInput
(
inputName
,
type
);
}
else
{
if
(
Array
.
isArray
(
type
))
{
// Enums
Object
.
assign
(
config
,
widgets
.
COMBO
(
this
,
inputName
,
inputData
,
app
)
||
{});
}
else
if
(
`
${
type
}
:
${
inputName
}
`
in
widgets
)
{
// Support custom widgets by Type:Name
Object
.
assign
(
config
,
widgets
[
`
${
type
}
:
${
inputName
}
`
](
this
,
inputName
,
inputData
,
app
)
||
{});
}
else
if
(
type
in
widgets
)
{
// Standard type widgets
Object
.
assign
(
config
,
widgets
[
type
](
this
,
inputName
,
inputData
,
app
)
||
{});
}
else
{
// Node connection inputs
this
.
addInput
(
inputName
,
type
);
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment