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
d5bf2314
Commit
d5bf2314
authored
Mar 26, 2023
by
Jairo Correa
Browse files
Mute nodes and shortcuts in README
parent
f13c0cef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
2 deletions
+96
-2
README.md
README.md
+7
-0
web/scripts/app.js
web/scripts/app.js
+89
-2
No files found.
README.md
View file @
d5bf2314
...
@@ -30,6 +30,13 @@ This ui will let you design and execute advanced stable diffusion pipelines usin
...
@@ -30,6 +30,13 @@ This ui will let you design and execute advanced stable diffusion pipelines usin
Workflow examples can be found on the
[
Examples page
](
https://comfyanonymous.github.io/ComfyUI_examples/
)
Workflow examples can be found on the
[
Examples page
](
https://comfyanonymous.github.io/ComfyUI_examples/
)
## Shortcuts
-
**Ctrl + C**
copy selected nodes
-
**Ctrl + V**
paste copied nodes
-
**Ctrl + A**
select all nodes
-
**Ctrl + M**
mute/unmute selected nodes
-
**Delete**
or
**Backspace**
delete selected nodes
# Installing
# Installing
## Windows
## Windows
...
...
web/scripts/app.js
View file @
d5bf2314
...
@@ -417,6 +417,59 @@ class ComfyApp {
...
@@ -417,6 +417,59 @@ class ComfyApp {
};
};
}
}
/**
* Handle keypress
*
* Ctrl + M mute/unmute selected nodes
*/
#
addProcessKeyHandler
()
{
const
self
=
this
;
const
origProcessKey
=
LGraphCanvas
.
prototype
.
processKey
;
LGraphCanvas
.
prototype
.
processKey
=
function
(
e
)
{
const
res
=
origProcessKey
.
apply
(
this
,
arguments
);
if
(
res
===
false
)
{
return
res
;
}
if
(
!
this
.
graph
)
{
return
;
}
var
block_default
=
false
;
if
(
e
.
target
.
localName
==
"
input
"
)
{
return
;
}
if
(
e
.
type
==
"
keydown
"
)
{
// Ctrl + M mute/unmute
if
(
e
.
keyCode
==
77
&&
e
.
ctrlKey
)
{
if
(
this
.
selected_nodes
)
{
for
(
var
i
in
this
.
selected_nodes
)
{
if
(
this
.
selected_nodes
[
i
].
mode
===
2
)
{
// never
this
.
selected_nodes
[
i
].
mode
=
0
;
// always
}
else
{
this
.
selected_nodes
[
i
].
mode
=
2
;
// never
}
}
}
block_default
=
true
;
}
}
this
.
graph
.
change
();
if
(
block_default
)
{
e
.
preventDefault
();
e
.
stopImmediatePropagation
();
return
false
;
}
return
res
;
};
}
/**
/**
* Draws group header bar
* Draws group header bar
*/
*/
...
@@ -465,10 +518,11 @@ class ComfyApp {
...
@@ -465,10 +518,11 @@ class ComfyApp {
* Draws node highlights (executing, drag drop) and progress bar
* Draws node highlights (executing, drag drop) and progress bar
*/
*/
#
addDrawNodeHandler
()
{
#
addDrawNodeHandler
()
{
const
orig
=
LGraphCanvas
.
prototype
.
drawNodeShape
;
const
orig
DrawNodeShape
=
LGraphCanvas
.
prototype
.
drawNodeShape
;
const
self
=
this
;
const
self
=
this
;
LGraphCanvas
.
prototype
.
drawNodeShape
=
function
(
node
,
ctx
,
size
,
fgcolor
,
bgcolor
,
selected
,
mouse_over
)
{
LGraphCanvas
.
prototype
.
drawNodeShape
=
function
(
node
,
ctx
,
size
,
fgcolor
,
bgcolor
,
selected
,
mouse_over
)
{
const
res
=
orig
.
apply
(
this
,
arguments
);
const
res
=
orig
DrawNodeShape
.
apply
(
this
,
arguments
);
let
color
=
null
;
let
color
=
null
;
if
(
node
.
id
===
+
self
.
runningNodeId
)
{
if
(
node
.
id
===
+
self
.
runningNodeId
)
{
...
@@ -517,6 +571,21 @@ class ComfyApp {
...
@@ -517,6 +571,21 @@ class ComfyApp {
return
res
;
return
res
;
};
};
const
origDrawNode
=
LGraphCanvas
.
prototype
.
drawNode
;
LGraphCanvas
.
prototype
.
drawNode
=
function
(
node
,
ctx
)
{
var
editor_alpha
=
this
.
editor_alpha
;
if
(
node
.
mode
===
2
)
{
// never
this
.
editor_alpha
=
0.4
;
}
const
res
=
origDrawNode
.
apply
(
this
,
arguments
);
this
.
editor_alpha
=
editor_alpha
;
return
res
;
};
}
}
/**
/**
...
@@ -588,6 +657,7 @@ class ComfyApp {
...
@@ -588,6 +657,7 @@ class ComfyApp {
document
.
body
.
prepend
(
canvasEl
);
document
.
body
.
prepend
(
canvasEl
);
this
.
#
addProcessMouseHandler
();
this
.
#
addProcessMouseHandler
();
this
.
#
addProcessKeyHandler
();
this
.
graph
=
new
LGraph
();
this
.
graph
=
new
LGraph
();
const
canvas
=
(
this
.
canvas
=
new
LGraphCanvas
(
canvasEl
,
this
.
graph
));
const
canvas
=
(
this
.
canvas
=
new
LGraphCanvas
(
canvasEl
,
this
.
graph
));
...
@@ -777,6 +847,11 @@ class ComfyApp {
...
@@ -777,6 +847,11 @@ class ComfyApp {
continue
;
continue
;
}
}
if
(
node
.
mode
===
2
)
{
// Don't serialize muted nodes
continue
;
}
const
inputs
=
{};
const
inputs
=
{};
const
widgets
=
node
.
widgets
;
const
widgets
=
node
.
widgets
;
...
@@ -816,6 +891,18 @@ class ComfyApp {
...
@@ -816,6 +891,18 @@ class ComfyApp {
};
};
}
}
// Remove inputs connected to removed nodes
for
(
const
o
in
output
)
{
for
(
const
i
in
output
[
o
].
inputs
)
{
if
(
Array
.
isArray
(
output
[
o
].
inputs
[
i
])
&&
output
[
o
].
inputs
[
i
].
length
===
2
&&
!
output
[
output
[
o
].
inputs
[
i
][
0
]])
{
delete
output
[
o
].
inputs
[
i
];
}
}
}
return
{
workflow
,
output
};
return
{
workflow
,
output
};
}
}
...
...
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