feat: RotoBezier Phase 1.5 - Professional Shape Operations
Enhanced RotoBezier with 4 major professional features!
Phase 1.5 Features:
1. **Shape Operations (Boolean Masking)**
- Add/Subtract/Intersect per spline
- Complex boolean masking like Photoshop layers
- First spline always acts as Add (base layer)
- Per-spline operation mode in JSON: "add", "subtract", "intersect"
2. **Falloff Curve Types (Artistic Feathering)**
- Linear: Hard, linear falloff
- Smooth (default): Smoothstep S-curve for natural edges
- Gaussian: Soft, blur-like falloff
- User-selectable feather_type parameter
- Professional control over mask edge appearance
3. **Per-Spline Invert**
- Individual spline invert flag
- Mix additive and subtractive shapes in same mask
- Independent from global invert parameter
- Stored in spline.invert JSON field
4. **Preset Shape Generators**
- Circle: Perfect circle using 4 Bezier curves (κ ≈ 0.5522847498)
- Rectangle: Sharp-cornered rectangle
- Star: 5-pointed star (configurable)
- Quick workflow: Click button → shape appears → edit as needed
Technical Implementation:
Frontend (web/js/detonate_roto_bezier.js):
- Added operation and invert fields to BezierSpline class
- BezierSpline.createCircle() - mathematically accurate circle
- BezierSpline.createRectangle() - sharp corners
- BezierSpline.createStar() - parametric star generation
- UI buttons for "Add Circle", "Add Rectangle", "Add Star"
- Updated JSON serialization for new fields
Backend (nodes/matte/roto_bezier.py):
- Added feather_type parameter (Linear/Smooth/Gaussian)
- Rewrote rasterization to process splines individually
- Shape operation logic:
- Add: max(result, spline_mask)
- Subtract: max(result - spline_mask, 0)
- Intersect: result × spline_mask
- Enhanced _apply_feather() with 3 falloff types:
- Linear: t
- Smooth: t² (3 - 2t)
- Gaussian: exp(-0.5 × (x/σ)²)
- Per-spline invert applied before boolean operations
Documentation:
- Updated README with Phase 1.5 announcement
- NODE_SPECIFICATIONS.md v1.6 with detailed Phase 1.5 specs
- Rasterization pipeline updated with boolean operations
- Preset shapes mathematical documentation
Why This Matters:
- Matches Photoshop-level boolean masking workflow
- Professional artistic control over mask edges
- Quick shape creation speeds up workflow significantly
- Essential for complex compositing masks
Total Enhancement: 4 major professional features
Status: Tier 5 Phase 1.5 Complete
Version: Still 0.7.0 (enhancements to existing nodes)