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
9ac95e6a
Commit
9ac95e6a
authored
Mar 31, 2023
by
City
Browse files
Add human-readable name support for custom nodes
parent
e6e30ee7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
0 deletions
+7
-0
custom_nodes/example_node.py.example
custom_nodes/example_node.py.example
+5
-0
nodes.py
nodes.py
+2
-0
No files found.
custom_nodes/example_node.py.example
View file @
9ac95e6a
...
@@ -84,3 +84,8 @@ class Example:
...
@@ -84,3 +84,8 @@ class Example:
NODE_CLASS_MAPPINGS = {
NODE_CLASS_MAPPINGS = {
"Example": Example
"Example": Example
}
}
# A dictionary that contains the friendly/humanly readable titles for the nodes
NODE_DISPLAY_NAME_MAPPINGS = {
"Example": "Example Node"
}
nodes.py
View file @
9ac95e6a
...
@@ -1081,6 +1081,8 @@ def load_custom_node(module_path):
...
@@ -1081,6 +1081,8 @@ def load_custom_node(module_path):
module_spec
.
loader
.
exec_module
(
module
)
module_spec
.
loader
.
exec_module
(
module
)
if
hasattr
(
module
,
"NODE_CLASS_MAPPINGS"
)
and
getattr
(
module
,
"NODE_CLASS_MAPPINGS"
)
is
not
None
:
if
hasattr
(
module
,
"NODE_CLASS_MAPPINGS"
)
and
getattr
(
module
,
"NODE_CLASS_MAPPINGS"
)
is
not
None
:
NODE_CLASS_MAPPINGS
.
update
(
module
.
NODE_CLASS_MAPPINGS
)
NODE_CLASS_MAPPINGS
.
update
(
module
.
NODE_CLASS_MAPPINGS
)
if
hasattr
(
module
,
"NODE_DISPLAY_NAME_MAPPINGS"
)
and
getattr
(
module
,
"NODE_DISPLAY_NAME_MAPPINGS"
)
is
not
None
:
NODE_DISPLAY_NAME_MAPPINGS
.
update
(
module
.
NODE_DISPLAY_NAME_MAPPINGS
)
else
:
else
:
print
(
f
"Skip
{
module_path
}
module for custom nodes due to the lack of NODE_CLASS_MAPPINGS."
)
print
(
f
"Skip
{
module_path
}
module for custom nodes due to the lack of NODE_CLASS_MAPPINGS."
)
except
Exception
as
e
:
except
Exception
as
e
:
...
...
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