Files
DobidopandClaude Sonnet 4.5 a33c104559 Fix convergence sign preservation in CPU stereo fill modes
- Fix sign loss bug in all 6 CPU fill functions where even exponents
  (e.g., stereo_offset_exponent=2.0) caused depth values on opposite
  sides of the convergence point to produce identical offsets
- Changed from: offset = (normalized_depth ** exponent) * divergence
- Changed to: offset = sign(depth) * abs(depth)**exponent * divergence
- This matches the GPU warp implementation which was already correct
- Affected functions: enhanced_inverse_mapping_with_mask,
  naive_mapping_with_mask, inverse_mapping_with_mask,
  apply_stereo_divergence_inverse, apply_stereo_divergence_naive,
  apply_stereo_divergence_polylines

Additional fixes:
- Replace Unicode checkmarks (✓/✗) with ASCII ([OK]/[--]) in __init__.py
  for Windows cp1252 compatibility
- Add tests/ to .gitignore (tests kept in dev branch only)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-06 11:57:04 +01:00

73 lines
2.5 KiB
Python

"""
ComfyStereo - Comprehensive Stereoscopic 3D toolkit for ComfyUI
Combines three powerful stereo tools:
1. Stereo Image Generation - Depth-based stereo conversion with GPU acceleration
2. VR Viewing - Native PyOpenXR viewer for direct VR headset viewing
3. StereoDiffusion - AI-powered stereo generation using diffusion models
"""
# Import base stereo generation nodes (always available)
from .GenerateStereo import NODE_CLASS_MAPPINGS as STEREO_NODES
from .GenerateStereo import NODE_DISPLAY_NAME_MAPPINGS as STEREO_NAMES
# Import native VR viewer nodes (optional, requires PyOpenXR)
try:
from .native_nodes import NODE_CLASS_MAPPINGS as NATIVE_NODES
from .native_nodes import NODE_DISPLAY_NAME_MAPPINGS as NATIVE_NAMES
NATIVE_AVAILABLE = True
except ImportError as e:
NATIVE_NODES = {}
NATIVE_NAMES = {}
NATIVE_AVAILABLE = False
print("\n" + "="*60)
print("PyOpenXR not available. Native VR viewer nodes disabled.")
print("To enable native VR viewing:")
print(" pip install -r requirements.txt")
print("="*60 + "\n")
# Import StereoDiffusion nodes (optional, requires diffusers)
try:
from .stereodiffusion_nodes import NODE_CLASS_MAPPINGS as DIFFUSION_NODES
from .stereodiffusion_nodes import NODE_DISPLAY_NAME_MAPPINGS as DIFFUSION_NAMES
DIFFUSION_AVAILABLE = True
except ImportError as e:
DIFFUSION_NODES = {}
DIFFUSION_NAMES = {}
DIFFUSION_AVAILABLE = False
print("\n" + "="*60)
print("StereoDiffusion dependencies not available. AI stereo generation disabled.")
print("To enable StereoDiffusion:")
print(" pip install diffusers transformers accelerate einops tqdm scikit-image")
print("="*60 + "\n")
# Combine all node mappings
NODE_CLASS_MAPPINGS = {
**STEREO_NODES,
**NATIVE_NODES,
**DIFFUSION_NODES,
}
NODE_DISPLAY_NAME_MAPPINGS = {
**STEREO_NAMES,
**NATIVE_NAMES,
**DIFFUSION_NAMES,
}
# Print status
print("\n" + "="*60)
print("ComfyStereo - Loaded Modules:")
print("="*60)
print(f" [OK] Stereo Image Generation ({len(STEREO_NODES)} nodes)")
if NATIVE_AVAILABLE:
print(f" [OK] Native VR Viewer ({len(NATIVE_NODES)} nodes)")
else:
print(f" [--] Native VR Viewer (not available)")
if DIFFUSION_AVAILABLE:
print(f" [OK] StereoDiffusion ({len(DIFFUSION_NODES)} nodes)")
else:
print(f" [--] StereoDiffusion (not available)")
print(f"\nTotal: {len(NODE_CLASS_MAPPINGS)} nodes loaded")
print("="*60 + "\n")
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']