parent
720b17442d
commit
bd2d3e27d7
8
main.py
8
main.py
|
@ -81,7 +81,7 @@ import yaml
|
||||||
import execution
|
import execution
|
||||||
import server
|
import server
|
||||||
from server import BinaryEventTypes
|
from server import BinaryEventTypes
|
||||||
from nodes import init_builtin_extra_nodes, init_external_custom_nodes
|
import nodes
|
||||||
import comfy.model_management
|
import comfy.model_management
|
||||||
|
|
||||||
def cuda_malloc_warning():
|
def cuda_malloc_warning():
|
||||||
|
@ -219,11 +219,7 @@ if __name__ == "__main__":
|
||||||
for config_path in itertools.chain(*args.extra_model_paths_config):
|
for config_path in itertools.chain(*args.extra_model_paths_config):
|
||||||
load_extra_path_config(config_path)
|
load_extra_path_config(config_path)
|
||||||
|
|
||||||
init_builtin_extra_nodes()
|
nodes.init_extra_nodes(init_custom_nodes=not args.disable_all_custom_nodes)
|
||||||
if not args.disable_all_custom_nodes:
|
|
||||||
init_external_custom_nodes()
|
|
||||||
else:
|
|
||||||
logging.info("Skipping loading of custom nodes")
|
|
||||||
|
|
||||||
cuda_malloc_warning()
|
cuda_malloc_warning()
|
||||||
|
|
||||||
|
|
35
nodes.py
35
nodes.py
|
@ -1888,30 +1888,6 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||||
EXTENSION_WEB_DIRS = {}
|
EXTENSION_WEB_DIRS = {}
|
||||||
|
|
||||||
|
|
||||||
def get_module_name(module_path: str) -> str:
|
|
||||||
"""
|
|
||||||
Returns the module name based on the given module path.
|
|
||||||
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") -> "custom_nodes.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/__init__.py") -> "custom_nodes.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__/") -> "custom_nodes.my_custom_node"
|
|
||||||
get_module_name("C:/Users/username/ComfyUI/custom_nodes/my_custom_node.disabled") -> "custom_nodes.my
|
|
||||||
|
|
||||||
Args:
|
|
||||||
module_path (str): The path of the module.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
str: The module name.
|
|
||||||
"""
|
|
||||||
relative_path = os.path.relpath(module_path, folder_paths.base_path)
|
|
||||||
if os.path.isfile(module_path):
|
|
||||||
relative_path = os.path.splitext(relative_path)[0]
|
|
||||||
return relative_path.replace(os.sep, '.')
|
|
||||||
|
|
||||||
|
|
||||||
def load_custom_node(module_path, ignore=set()):
|
def load_custom_node(module_path, ignore=set()):
|
||||||
module_name = os.path.basename(module_path)
|
module_name = os.path.basename(module_path)
|
||||||
try:
|
try:
|
||||||
|
@ -2039,6 +2015,17 @@ def init_builtin_extra_nodes():
|
||||||
if not load_custom_node(os.path.join(extras_dir, node_file)):
|
if not load_custom_node(os.path.join(extras_dir, node_file)):
|
||||||
import_failed.append(node_file)
|
import_failed.append(node_file)
|
||||||
|
|
||||||
|
return import_failed
|
||||||
|
|
||||||
|
|
||||||
|
def init_extra_nodes(init_custom_nodes=True):
|
||||||
|
import_failed = init_external_custom_nodes()
|
||||||
|
|
||||||
|
if init_custom_nodes:
|
||||||
|
init_external_custom_nodes()
|
||||||
|
else:
|
||||||
|
logging.info("Skipping loading of custom nodes")
|
||||||
|
|
||||||
if len(import_failed) > 0:
|
if len(import_failed) > 0:
|
||||||
logging.warning("WARNING: some comfy_extras/ nodes did not import correctly. This may be because they are missing some dependencies.\n")
|
logging.warning("WARNING: some comfy_extras/ nodes did not import correctly. This may be because they are missing some dependencies.\n")
|
||||||
for node in import_failed:
|
for node in import_failed:
|
||||||
|
|
Loading…
Reference in New Issue