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
33346fd9
"src/lib/vscode:/vscode.git/clone" did not exist on "af022947be382a2dd64d96083f878a950bc5579e"
Commit
33346fd9
authored
Jul 15, 2024
by
comfyanonymous
Browse files
Fix bug with custom nodes on other drives.
parent
136c93cb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
nodes.py
nodes.py
+15
-15
No files found.
nodes.py
View file @
33346fd9
...
@@ -1890,29 +1890,29 @@ NODE_DISPLAY_NAME_MAPPINGS = {
...
@@ -1890,29 +1890,29 @@ NODE_DISPLAY_NAME_MAPPINGS = {
EXTENSION_WEB_DIRS
=
{}
EXTENSION_WEB_DIRS
=
{}
def
get_
relative_
module_name
(
module_path
:
str
)
->
str
:
def
get_module_name
(
module_path
:
str
)
->
str
:
"""
"""
Returns the module name based on the given module path.
Returns the module name based on the given module path.
Examples:
Examples:
get_module_name("C:/Users/username/ComfyUI/custom_nodes/my_custom_node.py") -> "
custom_nodes.
my_custom_node"
get_module_name("C:/Users/username/ComfyUI/custom_nodes/my_custom_node.py") -> "my_custom_node"
get_module_name("C:/Users/username/ComfyUI/custom_nodes/my_custom_node") -> "
custom_nodes.
my_custom_node"
get_module_name("C:/Users/username/ComfyUI/custom_nodes/my_custom_node") -> "my_custom_node"
get_module_name("C:/Users/username/ComfyUI/custom_nodes/my_custom_node/") -> "
custom_nodes.
my_custom_node"
get_module_name("C:/Users/username/ComfyUI/custom_nodes/my_custom_node/") -> "my_custom_node"
get_module_name("C:/Users/username/ComfyUI/custom_nodes/my_custom_node/__init__.py") -> "
custom_nodes.
my_custom_node"
get_module_name("C:/Users/username/ComfyUI/custom_nodes/my_custom_node/__init__.py") -> "my_custom_node"
get_module_name("C:/Users/username/ComfyUI/custom_nodes/my_custom_node/__init__") -> "
custom_nodes.
my_custom_node"
get_module_name("C:/Users/username/ComfyUI/custom_nodes/my_custom_node/__init__") -> "my_custom_node"
get_module_name("C:/Users/username/ComfyUI/custom_nodes/my_custom_node/__init__/") -> "
custom_nodes.
my_custom_node"
get_module_name("C:/Users/username/ComfyUI/custom_nodes/my_custom_node/__init__/") -> "my_custom_node"
get_module_name("C:/Users/username/ComfyUI/custom_nodes/my_custom_node.disabled") -> "custom_nodes
.my
get_module_name("C:/Users/username/ComfyUI/custom_nodes/my_custom_node.disabled") -> "custom_nodes
Args:
Args:
module_path (str): The path of the module.
module_path (str): The path of the module.
Returns:
Returns:
str: The module name.
str: The module name.
"""
"""
relativ
e_path
=
os
.
path
.
relpath
(
module_path
,
folder_paths
.
bas
e_path
)
bas
e_path
=
os
.
path
.
basename
(
modul
e_path
)
if
os
.
path
.
isfile
(
module_path
):
if
os
.
path
.
isfile
(
module_path
):
relativ
e_path
=
os
.
path
.
splitext
(
relativ
e_path
)[
0
]
bas
e_path
=
os
.
path
.
splitext
(
bas
e_path
)[
0
]
return
relative_path
.
replace
(
os
.
sep
,
'.'
)
return
base_path
def
load_custom_node
(
module_path
:
str
,
ignore
=
set
())
->
bool
:
def
load_custom_node
(
module_path
:
str
,
ignore
=
set
()
,
module_parent
=
"custom_nodes"
)
->
bool
:
module_name
=
os
.
path
.
basename
(
module_path
)
module_name
=
os
.
path
.
basename
(
module_path
)
if
os
.
path
.
isfile
(
module_path
):
if
os
.
path
.
isfile
(
module_path
):
sp
=
os
.
path
.
splitext
(
module_path
)
sp
=
os
.
path
.
splitext
(
module_path
)
...
@@ -1939,7 +1939,7 @@ def load_custom_node(module_path: str, ignore=set()) -> bool:
...
@@ -1939,7 +1939,7 @@ def load_custom_node(module_path: str, ignore=set()) -> bool:
for
name
,
node_cls
in
module
.
NODE_CLASS_MAPPINGS
.
items
():
for
name
,
node_cls
in
module
.
NODE_CLASS_MAPPINGS
.
items
():
if
name
not
in
ignore
:
if
name
not
in
ignore
:
NODE_CLASS_MAPPINGS
[
name
]
=
node_cls
NODE_CLASS_MAPPINGS
[
name
]
=
node_cls
node_cls
.
RELATIVE_PYTHON_MODULE
=
get_relative
_module_name
(
module_path
)
node_cls
.
RELATIVE_PYTHON_MODULE
=
"{}.{}"
.
format
(
module_parent
,
get
_module_name
(
module_path
)
)
if
hasattr
(
module
,
"NODE_DISPLAY_NAME_MAPPINGS"
)
and
getattr
(
module
,
"NODE_DISPLAY_NAME_MAPPINGS"
)
is
not
None
:
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
)
NODE_DISPLAY_NAME_MAPPINGS
.
update
(
module
.
NODE_DISPLAY_NAME_MAPPINGS
)
return
True
return
True
...
@@ -1974,7 +1974,7 @@ def init_external_custom_nodes():
...
@@ -1974,7 +1974,7 @@ def init_external_custom_nodes():
if
os
.
path
.
isfile
(
module_path
)
and
os
.
path
.
splitext
(
module_path
)[
1
]
!=
".py"
:
continue
if
os
.
path
.
isfile
(
module_path
)
and
os
.
path
.
splitext
(
module_path
)[
1
]
!=
".py"
:
continue
if
module_path
.
endswith
(
".disabled"
):
continue
if
module_path
.
endswith
(
".disabled"
):
continue
time_before
=
time
.
perf_counter
()
time_before
=
time
.
perf_counter
()
success
=
load_custom_node
(
module_path
,
base_node_names
)
success
=
load_custom_node
(
module_path
,
base_node_names
,
module_parent
=
"custom_nodes"
)
node_import_times
.
append
((
time
.
perf_counter
()
-
time_before
,
module_path
,
success
))
node_import_times
.
append
((
time
.
perf_counter
()
-
time_before
,
module_path
,
success
))
if
len
(
node_import_times
)
>
0
:
if
len
(
node_import_times
)
>
0
:
...
@@ -2040,7 +2040,7 @@ def init_builtin_extra_nodes():
...
@@ -2040,7 +2040,7 @@ def init_builtin_extra_nodes():
import_failed
=
[]
import_failed
=
[]
for
node_file
in
extras_files
:
for
node_file
in
extras_files
:
if
not
load_custom_node
(
os
.
path
.
join
(
extras_dir
,
node_file
)):
if
not
load_custom_node
(
os
.
path
.
join
(
extras_dir
,
node_file
)
,
module_parent
=
"comfy_extras"
):
import_failed
.
append
(
node_file
)
import_failed
.
append
(
node_file
)
return
import_failed
return
import_failed
...
...
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