From e30d922e2bc4d1b0f3ac22cdbcfdea1c56864d19 Mon Sep 17 00:00:00 2001 From: Lukas Julian Lambertz Date: Sat, 21 Jun 2025 14:00:44 +0200 Subject: [PATCH] Multiple changes --- __init__.py | 4 +++ nodes/text_processing.py | 6 ----- nodes/timing.py | 51 ++++++++++++++++++++++++++++++++++++++ nodes/utilities.py | 53 ---------------------------------------- 4 files changed, 55 insertions(+), 59 deletions(-) create mode 100644 nodes/timing.py diff --git a/__init__.py b/__init__.py index 4b02cbd..f0cc4a0 100644 --- a/__init__.py +++ b/__init__.py @@ -7,15 +7,19 @@ from .nodes.text_processing import NODE_CLASS_MAPPINGS as TEXT_NODES from .nodes.text_processing import NODE_DISPLAY_NAME_MAPPINGS as TEXT_DISPLAY_NAMES from .nodes.utilities import UTILITY_NODE_CLASS_MAPPINGS as UTILITY_NODES from .nodes.utilities import UTILITY_NODE_DISPLAY_NAME_MAPPINGS as UTILITY_DISPLAY_NAMES +from .nodes.timing import TIMING_NODE_CLASS_MAPPINGS as TIMING_NODES +from .nodes.timing import TIMING_NODE_DISPLAY_NAME_MAPPINGS as TIMING_DISPLAY_NAMES # Combine all node mappings NODE_CLASS_MAPPINGS = {} NODE_CLASS_MAPPINGS.update(TEXT_NODES) NODE_CLASS_MAPPINGS.update(UTILITY_NODES) +NODE_CLASS_MAPPINGS.update(TIMING_NODES) NODE_DISPLAY_NAME_MAPPINGS = {} NODE_DISPLAY_NAME_MAPPINGS.update(TEXT_DISPLAY_NAMES) NODE_DISPLAY_NAME_MAPPINGS.update(UTILITY_DISPLAY_NAMES) +NODE_DISPLAY_NAME_MAPPINGS.update(TIMING_DISPLAY_NAMES) __all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS'] diff --git a/nodes/text_processing.py b/nodes/text_processing.py index d5f9323..4f920b4 100644 --- a/nodes/text_processing.py +++ b/nodes/text_processing.py @@ -1,8 +1,3 @@ -""" -Text Processing Nodes for ComfyUI -Provides various text manipulation utilities -""" - class TextSplitter: """ Node for splitting text strings by a delimiter @@ -158,7 +153,6 @@ class ListInfo: return (count, first_item, last_item) -# Node mappings for ComfyUI NODE_CLASS_MAPPINGS = { "DebugPadawan_TextSplitter": TextSplitter, "DebugPadawan_TextJoiner": TextJoiner, diff --git a/nodes/timing.py b/nodes/timing.py new file mode 100644 index 0000000..8378e4f --- /dev/null +++ b/nodes/timing.py @@ -0,0 +1,51 @@ +import time + +# from https://github.com/pythongosssss/ComfyUI-Custom-Scripts +class AnyType(str): + def __ne__(self, __value: object) -> bool: + return False + +any = AnyType("*") + +class WaitNode: + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "value": (any, {"forceInput": True}), + "wait_time_ms": ("INT", { + "default": 1000, + "min": 0, + }), + } + } + + RETURN_TYPES = ("*",) + RETURN_NAMES = ("passthrough",) + + FUNCTION = "wait_and_pass" + CATEGORY = "DebugPadawan/Timing" + + def wait_and_pass(self, value, wait_time_ms): + """ + Wait for the specified time and pass the input through + + Args: + value: Any value to pass through + wait_time_ms (int): Time to wait in milliseconds + + Returns: + The same value (passthrough) + """ + time.sleep(wait_time_ms / 1000.0) + + return (value,) + + +TIMING_NODE_CLASS_MAPPINGS = { + "DebugPadawan_WaitNode": WaitNode, +} + +TIMING_NODE_DISPLAY_NAME_MAPPINGS = { + "DebugPadawan_WaitNode": "Wait Node", +} \ No newline at end of file diff --git a/nodes/utilities.py b/nodes/utilities.py index 15a26b6..97e6e30 100644 --- a/nodes/utilities.py +++ b/nodes/utilities.py @@ -1,10 +1,3 @@ -""" -Utility Nodes for ComfyUI -Provides various helper utilities -""" - -import time - # from https://github.com/pythongosssss/ComfyUI-Custom-Scripts class AnyType(str): def __ne__(self, __value: object) -> bool: @@ -98,58 +91,12 @@ class ConditionalString: """ return (true_string if condition else false_string,) - -class WaitNode: - """ - Node that waits for a specified number of milliseconds before passing the input through - """ - - @classmethod - def INPUT_TYPES(cls): - return { - "required": { - "value": (any, {"forceInput": True}), - "wait_time_ms": ("INT", { - "default": 1000, # Default wait time is 1000 ms (1 second) - "min": 0, # Minimum wait time is 0 ms - }), - } - } - - # Use wildcard for output type to pass through any type - RETURN_TYPES = ("*",) - RETURN_NAMES = ("passthrough",) - - FUNCTION = "wait_and_pass" - CATEGORY = "DebugPadawan/Utilities" - - def wait_and_pass(self, value, wait_time_ms): - """ - Wait for the specified time and pass the input through - - Args: - value: Any value to pass through - wait_time_ms (int): Time to wait in milliseconds - - Returns: - The same value (passthrough) - """ - # Convert milliseconds to seconds and wait - time.sleep(wait_time_ms / 1000.0) - - # Return the original value unchanged - return (value,) - - -# Add these to the main mappings if needed UTILITY_NODE_CLASS_MAPPINGS = { "DebugPadawan_DebugPrint": DebugPrint, "DebugPadawan_ConditionalString": ConditionalString, - "DebugPadawan_WaitNode": WaitNode, } UTILITY_NODE_DISPLAY_NAME_MAPPINGS = { "DebugPadawan_DebugPrint": "Debug Print", "DebugPadawan_ConditionalString": "Conditional String", - "DebugPadawan_WaitNode": "Wait Node", } \ No newline at end of file