Register a ComfyUI node class to ComfyUI's global nodes' registry. Args: node_class (Type): The class of the node to be registered. name (str): The name of the node. description (str): The short user-friendly description of the node. Raises: ValueError:
(node_class: Type, name: str, description: str)
| 12 | |
| 13 | |
| 14 | def register_node(node_class: Type, name: str, description: str) -> None: |
| 15 | """ |
| 16 | Register a ComfyUI node class to ComfyUI's global nodes' registry. |
| 17 | |
| 18 | Args: |
| 19 | node_class (Type): The class of the node to be registered. |
| 20 | name (str): The name of the node. |
| 21 | description (str): The short user-friendly description of the node. |
| 22 | |
| 23 | Raises: |
| 24 | ValueError: If `node_class` is not a class, or `class_name` or `display_name` is not a string. |
| 25 | """ |
| 26 | |
| 27 | if not isinstance(node_class, type): |
| 28 | raise ValueError("`node_class` must be a class") |
| 29 | |
| 30 | if not isinstance(name, str): |
| 31 | raise ValueError("`name` must be a string") |
| 32 | |
| 33 | if not isinstance(description, str): |
| 34 | raise ValueError("`description` must be a string") |
| 35 | |
| 36 | NODE_CLASS_MAPPINGS[name] = node_class |
| 37 | NODE_DISPLAY_NAME_MAPPINGS[name] = description |
| 38 | |
| 39 | |
| 40 | def _is_v3_node(node_class: Type) -> bool: |