|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Build & Setup |
| 6 | + |
| 7 | +This is an Unreal Engine 5.5 plugin project. There are no CLI build scripts — all compilation happens through the UE editor or Visual Studio 2022. |
| 8 | + |
| 9 | +**Setup steps:** |
| 10 | +1. Right-click `TransitionFX_Dev.uproject` → **Generate Visual Studio project files** |
| 11 | +2. Open `TransitionFX_Dev.uproject` in UE 5.5; click **Yes** to rebuild missing modules |
| 12 | +3. First launch compiles shaders (several minutes) |
| 13 | + |
| 14 | +**Requirements:** Visual Studio 2022 (C++ Game Development workload), UE 5.5+, Windows with DX12/SM6 GPU. |
| 15 | + |
| 16 | +**Testing:** No automated test suite. Test manually using: |
| 17 | +- The `L_ShowCase` level (showcases all 26 transition effects) |
| 18 | +- The in-editor **Transition Preview Panel** (real-time playback with easing/duration controls) |
| 19 | + |
| 20 | +## Architecture |
| 21 | + |
| 22 | +TransitionFX is a **data-driven, GameInstance-scoped** transition system built on two C++ modules: |
| 23 | + |
| 24 | +### Module Boundaries |
| 25 | + |
| 26 | +| Module | Path | Role | |
| 27 | +|--------|------|------| |
| 28 | +| `TransitionFX` (Runtime) | `Plugins/TransitionFX/Source/TransitionFX/` | Core state machine, effect rendering, Blueprint API | |
| 29 | +| `TransitionFXEditor` (Editor) | `Plugins/TransitionFX/Source/TransitionFXEditor/` | Preview panel, GIF exporter, asset type actions | |
| 30 | + |
| 31 | +### Data Flow |
| 32 | + |
| 33 | +``` |
| 34 | +Blueprint / C++ call |
| 35 | + ↓ |
| 36 | +UTransitionBlueprintLibrary (latent actions — PlayTransitionAndWait, OpenLevelWithTransition) |
| 37 | + ↓ |
| 38 | +UTransitionManagerSubsystem (GameInstance subsystem — state machine, pooling, event broadcasting) |
| 39 | + ↓ |
| 40 | +ITransitionEffect / UPostProcessTransitionEffect (PostProcess volume + dynamic material instance) |
| 41 | + ↓ |
| 42 | +Material parameter "Progress" [0.0→1.0] drives SDF shader on screen |
| 43 | +``` |
| 44 | + |
| 45 | +### Core Classes |
| 46 | + |
| 47 | +| Class | File | Role | |
| 48 | +|-------|------|------| |
| 49 | +| `UTransitionManagerSubsystem` | `Public/TransitionManagerSubsystem.h` | Central tick-driven state machine; manages effect pool, audio, input blocking, level transitions, and sequences | |
| 50 | +| `UTransitionPreset` | `Public/TransitionPreset.h` | Data Asset holding all config: effect class, material, duration, easing, audio, input blocking | |
| 51 | +| `ITransitionEffect` | `Public/ITransitionEffect.h` | Interface for effect implementations (`Initialize`, `UpdateProgress`, `Cleanup`, `SetInvert`) | |
| 52 | +| `UPostProcessTransitionEffect` | `Public/PostProcessTransitionEffect.h` | Concrete implementation: creates a PostProcess volume + dynamic material instance | |
| 53 | +| `UTransitionBlueprintLibrary` | `Public/TransitionBlueprintLibrary.h` | Blueprint-callable latent actions and helper nodes | |
| 54 | +| `UTransitionSequence` | `Public/TransitionSequence.h` | Data Asset for chaining multiple transitions; each `FTransitionSequenceEntry` holds preset, mode, duration override, delay | |
| 55 | +| `UTransitionFXConfig` | `Public/TransitionFXConfig.h` | Compile-time constants: material parameter names (`Progress`, `Invert`, `TransitionColor`), default asset path | |
| 56 | + |
| 57 | +### Effect Pool |
| 58 | + |
| 59 | +`UTransitionManagerSubsystem` maintains a `TMap<UClass*, FTransitionEffectPool>` capped at **3 instances per class**. Always return effects to the pool via `CleanupAndPoolCurrentEffect()` — never destroy them directly. |
| 60 | + |
| 61 | +### Easing |
| 62 | + |
| 63 | +Easing is applied in the subsystem's `Tick()` using `ETransitionEasing` (12+ built-in curves + `UCurveFloat` custom). The raw `[0,1]` progress is eased before being written to the material's `Progress` parameter. |
| 64 | + |
| 65 | +### Level Transition Pattern |
| 66 | + |
| 67 | +`OpenLevelWithTransition()` uses a two-step delegate chain: |
| 68 | +1. Fade-out completes → `OnLevelTransitionFadeOutFinished()` opens the level |
| 69 | +2. `OnPostLoadMapWithWorld()` fires → auto-reverse fade-in plays |
| 70 | + |
| 71 | +`PrepareAutoReverseTransition()` stores state so it survives level unload. |
| 72 | + |
| 73 | +### Sequence System (Phase 1, unreleased v1.2.0) |
| 74 | + |
| 75 | +Sequence logic lives inline in `UTransitionManagerSubsystem` with a comment marking it for extraction into a `UTransitionSequencePlayer` in Phase 2. The `bIsDispatchingSequenceStep` flag prevents external `StartTransition()` calls from interrupting internal sequence steps. |
| 76 | + |
| 77 | +## Key Files |
| 78 | + |
| 79 | +``` |
| 80 | +Plugins/TransitionFX/ |
| 81 | +├── Source/TransitionFX/ |
| 82 | +│ ├── Public/ |
| 83 | +│ │ ├── TransitionManagerSubsystem.h ← all public API + delegates |
| 84 | +│ │ ├── TransitionPreset.h ← data asset schema |
| 85 | +│ │ ├── ITransitionEffect.h ← effect interface |
| 86 | +│ │ ├── TransitionBlueprintLibrary.h ← Blueprint nodes |
| 87 | +│ │ ├── TransitionSequence.h ← sequence data asset |
| 88 | +│ │ └── TransitionFXConfig.h ← material param name constants |
| 89 | +│ └── Private/ |
| 90 | +│ ├── TransitionManagerSubsystem.cpp ← ~1,000 LOC, core tick loop |
| 91 | +│ └── TransitionBlueprintLibrary.cpp ← latent action implementations |
| 92 | +├── Source/TransitionFXEditor/ |
| 93 | +│ ├── Public/TransitionPreviewPanel.h ← editor preview UI |
| 94 | +│ └── Private/ |
| 95 | +│ ├── STransitionPreviewPanel.cpp ← preview panel (800+ LOC) |
| 96 | +│ └── GifEncoder.cpp ← GIF89a encoder for docs |
| 97 | +└── Content/ |
| 98 | + ├── Data/ ← 26 DA_*.uasset transition presets |
| 99 | + ├── Materials/ ← M_Transition_*.uasset master materials + instances |
| 100 | + └── MaterialFunctions/ ← 9 reusable SDF helper functions |
| 101 | +``` |
| 102 | + |
| 103 | +## Conventions |
| 104 | + |
| 105 | +- **PCH**: `PCHUsage = UseExplicitOrSharedPCHs` — always include the module's own header explicitly. |
| 106 | +- **UPROPERTY Transient**: All runtime state (pool, current effect, audio component) uses `UPROPERTY(Transient)` to avoid serialization. |
| 107 | +- **Weak pointers for cache**: `TWeakObjectPtr` for `CachedPlayerController` to handle destruction safely. |
| 108 | +- **Category**: All `UFUNCTION`/`UPROPERTY` use `Category = "TransitionFX"` or `"TransitionFX|Sequence"`. |
| 109 | +- **No Blueprint-only builds assumption**: The plugin must work for both Blueprint-only and C++ projects; keep all required logic in the Runtime module. |
| 110 | + |
| 111 | +## Platform & Compatibility Notes |
| 112 | + |
| 113 | +- **Win64 only** (DX12 SM6). Console and mobile are untested — SDF effects are GPU-bound. |
| 114 | +- **Not compatible with UEFN** (Unreal Editor for Fortnite). |
| 115 | +- **PostProcess limitation**: Transitions do not cover UMG/Slate UI layers. |
| 116 | +- **Single active transition**: One subsystem per GameInstance; no simultaneous transitions. |
| 117 | +- **No multiplayer replication**: Operates locally per client. |
| 118 | + |
| 119 | +## CI/CD |
| 120 | + |
| 121 | +`.github/workflows/release.yml` triggers on version tags (`v*`) to build a distribution ZIP (excluding binaries/intermediates), parse CHANGELOG.md, and publish a GitHub release. |
0 commit comments