- 3x3 aspect ratio grid (1:1, 16:9, 9:16, 2:1, 3:2, 2:3, 4:3, 3:4, 4:5) - Preset list with search, favorites, and recents tabs - Custom ratio and custom resolution override modes - Aspect ratio lock, random picker, clipboard copy - Keyboard navigation (Up/Down/Enter) - Fix: selected preset highlight (active color) now shows correctly - XFlow Green dark theme (Higgsfield AI inspired)
50 lines
1.7 KiB
Python
50 lines
1.7 KiB
Python
import logging
|
|
from typing import Tuple, Dict, Any
|
|
|
|
logger = logging.getLogger("XFlow")
|
|
|
|
class XFlowResolution:
|
|
"""
|
|
XFlow Resolution Node
|
|
|
|
A premium ComfyUI custom node that outputs width and height for latent/image generation.
|
|
All complex UI layout, aspect ratio selection, preset matching, and overrides are handled
|
|
via the JavaScript frontend extension, keeping the backend extremely clean and efficient.
|
|
"""
|
|
|
|
@classmethod
|
|
def INPUT_TYPES(cls) -> Dict[str, Any]:
|
|
return {
|
|
"required": {
|
|
# Width and height act as the primary backing inputs for the node.
|
|
# The frontend JavaScript overlay will visually replace these inputs,
|
|
# but their values will remain synced to ComfyUI's internal graph state.
|
|
"width": ("INT", {
|
|
"default": 1024,
|
|
"min": 64,
|
|
"max": 8192,
|
|
"step": 8,
|
|
"display": "number"
|
|
}),
|
|
"height": ("INT", {
|
|
"default": 1024,
|
|
"min": 64,
|
|
"max": 8192,
|
|
"step": 8,
|
|
"display": "number"
|
|
}),
|
|
}
|
|
}
|
|
|
|
RETURN_TYPES = ("INT", "INT")
|
|
RETURN_NAMES = ("width", "height")
|
|
FUNCTION = "execute"
|
|
CATEGORY = "XFlow/Utilities"
|
|
|
|
def execute(self, width: int, height: int) -> Tuple[int, int]:
|
|
"""
|
|
Executes the node and returns the validated width and height.
|
|
"""
|
|
logger.debug(f"XFlow Resolution: Outputting width={width}, height={height}")
|
|
return (width, height)
|