BREAKING CHANGE: Node categories now use emoji-based organization Add 6 new xyz-helper nodes adapted from comfyui-essentials-nodes: - FluxSamplerParams: FLUX-optimized parameter generator with batch support - LoRAFolderBatch: Batch process multiple LoRAs from folders - PlotParameters: Visualize parameter effects with graphs - SamplerSelectHelper: Intelligent sampler selection with recommendations - SchedulerSelectHelper: Optimal scheduler selection for samplers - TextEncodeSamplerParams: Combined text encoding and parameter management Changes: - Port and enhance nodes from comfyui-essentials (now in maintenance mode) - Add comprehensive documentation with attribution to original author (cubiq) - Create example workflows for xyz-helpers tools - Update all node categories to use emoji-based organization - Fix all unit tests to pass with new category system - Update README with xyz-helpers section and attribution Attribution: xyz-helpers adapted from github.com/cubiq/ComfyUI_essentials All tests passing (318 pass, 2 skip)
68 lines
2.1 KiB
Python
68 lines
2.1 KiB
Python
"""DisplayAny node for ComfyUI - displays any input value or tensor information."""
|
|
|
|
from typing import Any, Dict, Tuple
|
|
|
|
from ...base import ComfyAssetsBaseNode
|
|
from .logic import format_display_value, validate_display_mode
|
|
|
|
|
|
# Define AnyType for wildcard input matching
|
|
class AnyType(str):
|
|
"""A special type that matches any input type in ComfyUI."""
|
|
|
|
def __ne__(self, other):
|
|
return False
|
|
|
|
|
|
class DisplayAnyNode(ComfyAssetsBaseNode):
|
|
"""Display any input value or tensor shape information.
|
|
|
|
This node can display any type of input in two modes:
|
|
- Raw value: Shows the string representation of the input
|
|
- Tensor shape: Extracts and displays shapes of any tensors in the input
|
|
"""
|
|
|
|
@classmethod
|
|
def INPUT_TYPES(cls) -> Dict[str, Any]:
|
|
"""Define input types for the node."""
|
|
return {
|
|
"required": {
|
|
"input": (AnyType("*"), {}), # Accept any type of input
|
|
"mode": (["raw value", "tensor shape"],),
|
|
},
|
|
}
|
|
|
|
@classmethod
|
|
def VALIDATE_INPUTS(cls, **kwargs) -> bool:
|
|
"""Validate inputs - always returns True as we accept any input."""
|
|
return True
|
|
|
|
RETURN_TYPES = ("STRING",)
|
|
CATEGORY = "ComfyAssets/👁️ Display"
|
|
RETURN_NAMES = ("display_text",)
|
|
FUNCTION = "display"
|
|
OUTPUT_NODE = True # This node displays output in the UI
|
|
|
|
def display(self, input: Any, mode: str = "raw value") -> Dict[str, Any]:
|
|
"""Display the input value according to the selected mode.
|
|
|
|
Args:
|
|
input: Any input value to display
|
|
mode: Display mode - "raw value" or "tensor shape"
|
|
|
|
Returns:
|
|
Dictionary with UI display and result
|
|
"""
|
|
# Validate mode
|
|
if not validate_display_mode(mode):
|
|
mode = "raw value" # Default to raw value if invalid
|
|
|
|
# Format the display text
|
|
display_text = format_display_value(input, mode)
|
|
|
|
# Return both UI display and result
|
|
return {
|
|
"ui": {"text": [display_text]}, # UI expects array
|
|
"result": (display_text,),
|
|
}
|