Files
aodh-pack/README.md

151 lines
6.4 KiB
Markdown

# AODH Pack
A set of custom ComfyUI nodes designed to streamline the creation of images for anime and video game characters using structured JSON data.
## Nodes
### Character JSON Reader
The **Character JSON Reader** node allows you to load character definitions from JSON files stored in the `characters` directory. It parses the JSON and outputs individual strings for various character attributes, making it easy to build complex prompts.
#### Features:
- **Automatic File Discovery**: Scans the `nodes/character_reader/characters/` folder for `.json` files.
- **Selection Modes**:
- `manual`: Select a specific file from the dropdown.
- `sequential`: Cycles through files, starting from the selected file.
- `random`: Picks a random file. Uses a fresh random seed on every execution.
- **Repeat Count**: Keeps the same selection for a specified number of executions before changing.
- **Structured Outputs**: Provides 21 distinct output pins covering identity, wardrobe, and style.
- **Prompt-Ready Formatting**: Automatically appends a comma to every non-empty output string.
- **Robustness**: Ensures all outputs are valid strings, even if fields are missing from the JSON.
### Resolution Reader
The **Resolution Reader** node reads resolution configurations from text files. Each line in the text file should follow the format: `width, height, upscale`.
#### Features:
- **Selection Modes**:
- `manual`: Uses the selected line from the dropdown.
- `sequential`: Cycles through lines in the file, starting from the selected line.
- `random`: Picks a random line from the file. Uses a fresh random seed on every execution.
- **Repeat Count**: Keeps the same selection for a specified number of executions before changing.
- **Outputs**: Provides `width` (INT), `height` (INT), and `upscale` (FLOAT).
### Lora Selector
The **Lora Selector** node allows you to select a folder of Lora files (from `ComfyUI/models/Lora/Illustrious/`) and pick one `.safetensors` file at a time, either randomly or sequentially.
#### Features:
- **Folder Selection**: Scans `ComfyUI/models/Lora/Illustrious/` for subdirectories.
- **Selection Modes**:
- `Random`: Picks a random Lora from the folder. Uses a fresh random seed on every execution.
- `Sequential`: Cycles through the Lora files in the folder, starting from the `manual_index`.
- `Manual`: Selects the Lora at the specified `manual_index`.
- **Repeat Count**: Keeps the same selection for a specified number of executions before changing.
- **Manual Index**: Specifies the starting index for `Sequential` mode or the specific index for `Manual` mode.
- **Outputs**:
- `lora_name` (STRING): The relative path to the selected Lora.
- `total_loras` (INT): The total number of Lora files in the selected folder.
### Checkpoint Selector
The **Checkpoint Selector** node allows you to select a folder of Checkpoint files (from `ComfyUI/models/Stable-diffusion/`) and pick one `.safetensors` or `.ckpt` file at a time, either randomly or sequentially.
#### Features:
- **Folder Selection**: Scans `ComfyUI/models/Stable-diffusion/` (and other checkpoint paths) for subdirectories.
- **Selection Modes**:
- `Random`: Picks a random Checkpoint from the folder. Uses a fresh random seed on every execution.
- `Sequential`: Cycles through the Checkpoint files in the folder, starting from the `manual_index`.
- `Manual`: Selects the Checkpoint at the specified `manual_index`.
- **Repeat Count**: Keeps the same selection for a specified number of executions before changing.
- **Manual Index**: Specifies the starting index for `Sequential` mode or the specific index for `Manual` mode.
- **Outputs**:
- `checkpoint_name` (STRING): The relative path to the selected Checkpoint.
- `total_checkpoints` (INT): The total number of Checkpoint files in the selected folder.
### Checkpoint Loader (From String)
The **Checkpoint Loader (From String)** node loads a checkpoint model using a string input (e.g., from the **Checkpoint Selector** node).
#### Inputs:
- `ckpt_name` (STRING): The name/path of the checkpoint to load.
#### Outputs:
- `MODEL`: The loaded model.
- `CLIP`: The loaded CLIP model.
- `VAE`: The loaded VAE model.
### AODH Image Saver (Metadata)
The **AODH Image Saver (Metadata)** node saves images with comprehensive metadata in both A1111-compatible and extended ComfyUI formats.
#### Features:
- **Dynamic Directory Support**: Specify a `save_directory` with support for date formatting:
- `date:yyyy-MM-dd`: Replaces with formatted date (e.g., `2024-05-20`).
- Standard `strftime` patterns like `%Y-%m-%d`.
- **Comprehensive Metadata**: Embeds prompt, sampling parameters, model info, and LoRA details.
- **LoRA Handling**: Automatically strips directory paths from LoRA names for cleaner metadata.
- **Image Pass-through**: Includes an image output pin to continue the workflow after saving.
#### Inputs:
- `images` (IMAGE): The images to save.
- `filename_prefix` (STRING): The prefix for the saved files.
- `save_directory` (STRING): The folder to save images in (defaults to current date).
- Various optional metadata fields (prompts, checkpoint, lora, etc.).
#### Outputs:
- `images` (IMAGE): The input images passed through.
#### JSON Structure:
Place your character JSON files in the `nodes/character_reader/characters/` directory. The expected format is:
```json
{
"character_id": "unique_id",
"identity": {
"base_specs": "...",
"hair": "...",
"eyes": "...",
"expression": "...",
"hands": "...",
"arms": "...",
"torso": "...",
"pelvis": "...",
"legs": "...",
"feet": "...",
"distinguishing_marks": "..."
},
"wardrobe": {
"inner_layer": "...",
"outer_layer": "...",
"lower_body": "...",
"footwear": "...",
"gloves": "...",
"accessories": "..."
},
"styles": {
"aesthetic": "...",
"primary_color": "...",
"secondary_color": "...",
"tertiary_color": "..."
},
"lora":{
"lora_name": "...",
"lora_Weight": "...",
"lora_triggers": "..."
}
}
```
## Installation
1. Clone this repository into your `ComfyUI/custom_nodes/` directory.
2. Add your character JSON files to the `nodes/character_reader/characters/` folder.
3. Add your resolution text files to the `nodes/resolution_reader/resolutions/` folder.
4. Restart ComfyUI.
## Usage
Find the node under the `AODH Pack` category in the ComfyUI node menu. Select your character file from the dropdown, and connect the output pins to your prompt encoding nodes.