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
5ce4b9ec
Commit
5ce4b9ec
authored
Feb 13, 2023
by
Hacker 17082006
Browse files
Add custom node feature
parent
3fd6b702
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
custom_nodes/put_custom_nodes_here
custom_nodes/put_custom_nodes_here
+0
-0
nodes.py
nodes.py
+16
-1
No files found.
custom_nodes/put_custom_nodes_here
0 → 100644
View file @
5ce4b9ec
nodes.py
View file @
5ce4b9ec
...
...
@@ -16,6 +16,7 @@ sys.path.insert(0, os.path.join(sys.path[0], "comfy"))
import
comfy.samplers
import
comfy.sd
import
model_management
from
importlib
import
import_module
supported_ckpt_extensions
=
[
'.ckpt'
]
supported_pt_extensions
=
[
'.ckpt'
,
'.pt'
,
'.bin'
]
...
...
@@ -597,4 +598,18 @@ NODE_CLASS_MAPPINGS = {
"CLIPLoader"
:
CLIPLoader
,
}
def
load_custom_nodes
():
possible_modules
=
os
.
listdir
(
"custom_nodes"
)
possible_modules
.
remove
(
"put_custom_nodes_here"
)
for
possible_module
in
possible_modules
:
try
:
custom_nodes
=
import_module
(
possible_module
,
"custom_nodes"
)
if
getattr
(
custom_nodes
,
"NODE_CLASS_MAPPINGS"
)
is
not
None
:
NODE_CLASS_MAPPINGS
.
update
(
custom_nodes
.
NODE_CLASS_MAPPINGS
)
else
:
NODE_CLASS_MAPPINGS
[
possible_module
]
=
custom_nodes
except
ImportError
as
e
:
print
(
f
"Cannot import
{
possible_module
}
node."
)
print
(
e
)
load_custom_nodes
()
\ No newline at end of file
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