diff --git a/README.md b/README.md index 16f8b71..53d3839 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,134 @@ -# DebugPadawans-ComfyUI-Essentials +# DebugPadawan's ComfyUI Essentials -This is a useful collection of various nodes for different types of processing and manipulation in ComfyUI. +A collection of essential custom nodes for ComfyUI that provides useful utilities for text processing, data manipulation, and workflow enhancement. -## 🚀 Installation +## Features -### Step 1: Clone into custom_nodes -Clone this repository directly into your ComfyUI `custom_nodes` directory: +- **Text Processing Nodes**: Split, join, and manipulate text strings +- **Data Utilities**: Convert between different data types +- **Workflow Helpers**: Common operations to streamline your ComfyUI workflows +- **Debug Tools**: Print and inspect values during workflow execution +## Installation + +1. Clone this repository into your ComfyUI `custom_nodes` directory: ```bash -cd /path/to/your/ComfyUI/custom_nodes +cd ComfyUI/custom_nodes git clone https://github.com/DebugPadawan/DebugPadawans-ComfyUI-Essentials.git ``` -### Step 2: Install requirements -Navigate into the plugin folder and install the required dependencies: +2. Restart ComfyUI -```bash -cd DebugPadawans-ComfyUI-Essentials -pip install -r requirements.txt -``` +## Available Nodes -### Step 3: Start or Restart ComfyUI -Make sure ComfyUI is running. If not, start or restart it now. The nodes from this plugin will then appear in the "DebugPadawan" category inside ComfyUI. +### Text Processing -## 🔧 Requirements +#### Text Splitter +**Category**: DebugPadawan/Text -- ComfyUI -- Python 3.7 or higher -- Packages listed in `requirements.txt` +Splits a text string at a specified delimiter and returns a list of strings. + +**Inputs:** +- `text` (String): The text to split (supports multiline input) +- `delimiter` (String): The character(s) to split by (default: ",") +- `strip_whitespace` (Boolean, optional): Remove leading/trailing whitespace from each element (default: True) +- `remove_empty` (Boolean, optional): Remove empty strings from the result (default: True) + +**Outputs:** +- `text_list` (List): The split list of strings +- `count` (Integer): Number of elements in the list + +**Example:** +- Input: `"apple, banana, orange"` +- Delimiter: `","` +- Output: `["apple", "banana", "orange"]` and `3` + +Process CSV-like data, split tag lists, separate coordinates or parameters, create filename lists, and parse prompt components. --- -**Author:** DebugPadawan -**Created:** 2025-06-21 \ No newline at end of file +#### Text Joiner +**Category**: DebugPadawan/Text + +Combines a list of strings into a single text string with a customizable delimiter. + +**Inputs:** +- `text_list` (List): List of strings to join +- `delimiter` (String): Character(s) to join with (default: ", ") +- `prefix` (String, optional): Text to add at the beginning +- `suffix` (String, optional): Text to add at the end + +**Outputs:** +- `joined_text` (String): The combined text string + +**Example:** +- Input: `["red", "green", "blue"]` +- Delimiter: `" | "` +- Prefix: `"Colors: "` +- Suffix: `" - end"` +- Output: `"Colors: red | green | blue - end"` + +Combine prompt parts, convert lists to readable text, create tags for metadata, build filenames from components, and format output strings. + +--- + +### Debug Tools + +#### Debug Print +**Category**: DebugPadawan/Debug + +Prints values to the console without interrupting the workflow. Perfect for debugging and monitoring data values during execution. Accepts any input type including strings, integers, floats, booleans, lists, dictionaries, and complex objects. + +**Inputs:** +- `value` (*): Any value to print to console (supports all data types) +- `label` (String, optional): Label for the debug output (default: "Debug") + +**Outputs:** +- `passthrough` (*): The same value passed through unchanged + +**Console Output:** +``` +[MyLabel] list: ['Element1', 'Element2', 'Element3'] +[Debug] str: Hello World +[Checkpoint] int: 42 +[Data Flow] dict: {'key': 'value', 'count': 5} +[Boolean Test] bool: True +[Float Value] float: 3.14159 +``` + +Monitor values during workflow execution, debug complex workflows, verify data types and contents, set workflow checkpoints, and troubleshoot unexpected results. Use descriptive labels and remember that the node doesn't interrupt data flow. + +--- + +### Utility Nodes + +#### List Info +**Category**: DebugPadawan/Utilities + +Analyzes a list and returns useful information about it. + +**Inputs:** +- `input_list` (List): The list to analyze + +**Outputs:** +- `count` (Integer): Number of elements +- `first_item` (String): First element (as string) +- `last_item` (String): Last element (as string) + +Validate list processing results, get quick list statistics, check if lists are empty, and extract boundary values. + +#### Conditional String +**Category**: DebugPadawan/Logic + +Returns one of two strings based on a boolean condition. + +**Inputs:** +- `condition` (Boolean): The condition to evaluate +- `true_string` (String): String to return if True (default: "True") +- `false_string` (String): String to return if False (default: "False") + +**Outputs:** +- `result` (String): The selected string + +Conditional prompt modification, dynamic filename generation, workflow branching based on conditions, and status message generation. + diff --git a/nodes/__pycache__/utilities.cpython-312.pyc b/nodes/__pycache__/utilities.cpython-312.pyc index 18bfdd6..4dae3ec 100644 Binary files a/nodes/__pycache__/utilities.cpython-312.pyc and b/nodes/__pycache__/utilities.cpython-312.pyc differ diff --git a/nodes/utilities.py b/nodes/utilities.py index 4e14512..1792962 100644 --- a/nodes/utilities.py +++ b/nodes/utilities.py @@ -3,6 +3,13 @@ Utility Nodes for ComfyUI Provides various helper utilities """ +# from https://github.com/pythongosssss/ComfyUI-Custom-Scripts +class AnyType(str): + def __ne__(self, __value: object) -> bool: + return False + +any = AnyType("*") + class DebugPrint: """ Node for debugging - prints values to console @@ -12,8 +19,7 @@ class DebugPrint: def INPUT_TYPES(cls): return { "required": { - # Specify common types explicitly instead of using wildcard - "value": ("STRING", {"forceInput": True}), + "value": (any, {"forceInput": True}), }, "optional": { "label": ("STRING", { @@ -23,8 +29,8 @@ class DebugPrint: } } - # Match the input type exactly - RETURN_TYPES = ("STRING",) + # Use wildcard for output type to pass through any type + RETURN_TYPES = ("*",) RETURN_NAMES = ("passthrough",) FUNCTION = "debug_print" @@ -41,7 +47,11 @@ class DebugPrint: Returns: The same value (passthrough) """ - print(f"[{label}] {value}") + # Convert the value to a string for debugging purposes + debug_value = str(value) if not isinstance(value, str) else value + print(f"[{label}] {type(value).__name__}: {debug_value}") + + # Return the original value unchanged return (value,)