1.6 KiB
1.6 KiB
description
| description |
|---|
| how to add or update nodes in ComfyUI-FrameIO |
Follow these steps to add a new node or update existing ones in this repository.
1. Implementation Principles
- Asynchronous I/O: Use
ThreadPoolExecutorfor disk-heavy operations (saving/loading). - PyTorch Optimization: Perform tensor normalization (
.float().div_(255.0)) directly in PyTorch rather than NumPy to avoid memory overhead. - Visual Feedback: Always include
comfy.utils.ProgressBar. - Standard Outputs: Every node should return an
INTas the second output representing thecountof items processed. - Detailed Descriptions: Include a
DESCRIPTIONclass attribute for ComfyUI tooltips.
2. Adding a New Node
- Create Python File: Create a new
.pyfile for your node (e.g.,new_node_feature.py). - Implement Node Class:
- Ensure
CATEGORY = "FrameIO". - Implement
DESCRIPTION. - Implement
RETURN_TYPES = ("IMAGE", "INT")(or similar).
- Ensure
- Register in
__init__.py:- Import
NODE_CLASS_MAPPINGSandNODE_DISPLAY_NAME_MAPPINGSfrom the new file. - Update the global mappings in
__init__.py.
- Import
- Update Documentation:
- Add the new node details to
README.mdunder the appropriate section.
- Add the new node details to
- Security Check:
- For saving nodes, use
os.path.commonpathto ensure the target directory is within the ComfyUIoutputfolder.
- For saving nodes, use
3. Update Checklist
- Add
DESCRIPTIONto class. - Ensure
INToutput for item count. - Use
ThreadPoolExecutorif I/O bound. - Update
README.md. - Register in
__init__.py.