Files
AEmotionStudio-ComfyUI-Shad…/utils/__init__.py
T
AEmotionStudio e79e49506d refactor: Major codebase restructuring for separation of concerns
## New Directory Structure
- utils/: Shared utilities (color_utils, shape_masks, noise_utils)
- core/: Central logic (params, constants, blending, transforms, model_compat, sampler, debug, logging)
- shaders/: Shader generators with BaseNoiseGenerator ABC and plugin registry
- nodes/: ComfyUI node class definitions

## Key Changes
- Centralized color interpolation logic eliminating duplication across shader files
- Unified shape mask generation with 20+ shape types
- Consolidated simplex/FBM/perlin noise implementations
- Created ShaderParams class for parameter normalization and validation
- Implemented ShaderRegistry for plugin-based shader registration
- Extracted blending operations and noise transforms to dedicated modules
- Added model compatibility layer for channel detection
- Moved stub visualizer/debugger to core/debug.py
- Added centralized logging configuration

## Refactored Shaders
- domain_warp.py: Now uses shared utilities and BaseNoiseGenerator
- tensor_field.py: Now uses shared utilities and BaseNoiseGenerator
- curl_noise.py: Now uses shared utilities and BaseNoiseGenerator
- temporal_coherent_noise.py: Now uses shared utilities and BaseNoiseGenerator

## Cleanup
- Removed duplicate SHADER_GENERATORS registry
- Added comprehensive type hints to all new modules
- Maintained backward compatibility with legacy API
2026-01-26 19:48:23 -08:00

50 lines
1002 B
Python

"""
Shared utilities for ComfyUI-ShaderNoiseKSampler.
This package provides common functionality used across shader generators:
- color_utils: Color scheme interpolation and application
- shape_masks: Shape mask generation and application
- noise_utils: Noise generation (simplex, FBM, etc.)
"""
from .color_utils import (
COLOR_SCHEMES,
lerp,
hsv_to_rgb,
interpolate_colors,
apply_color_scheme,
)
from .shape_masks import (
SHAPE_TYPES,
smoothstep,
apply_shape_mask,
)
from .noise_utils import (
simplex_noise_2d,
simplex_noise_3d,
fbm_noise,
random_gradient,
create_coordinate_grid,
)
__all__ = [
# Color utilities
"COLOR_SCHEMES",
"lerp",
"hsv_to_rgb",
"interpolate_colors",
"apply_color_scheme",
# Shape masks
"SHAPE_TYPES",
"smoothstep",
"apply_shape_mask",
# Noise utilities
"simplex_noise_2d",
"simplex_noise_3d",
"fbm_noise",
"random_gradient",
"create_coordinate_grid",
]