Logic¶
Purpose¶
Hosts pure, engine-light calculation kernels extracted from feature territories so they can be unit-tested in isolation.
Code lives here when it is genuinely deterministic logic — timing math, index/range planning, path derivation, blend/encoding math — with no render context, no editor lifecycle, and no scene state. Feature territories keep their orchestration and delegate the underlying calculation here.
This assembly exists primarily to make load-bearing logic referenceable by the RevGaming.SnapStudioPro.Tests assembly. Pure logic in the predefined Assembly-CSharp-Editor cannot be referenced by a test asmdef; living in this assembly is what makes it testable.
Owns¶
- Animation frame-index planning math (
FrameIndexCalculator) - Export path/file derivation (
ExportPaths.DeriveNormalMapPath,ExportPaths.BuildCaptureFileName) - Static-sprite output folder/file layout (
EnvironmentPathBuilder) - Normal-map gamma→linear pixel encoding (
NormalMapEncoding) - Overlay anchor placement (
OverlayLayout.ComputeTopLeft) - Overlay alpha-preserving "over" compositing (
OverlayCompositor.Composite) - Premultiplied box downscale for super-sampled export (
SupersampleDownscale.Resolve) — averaging RGB and alpha independently darkens every silhouette edge, so the resolve is pinned by unit tests rather than by a golden baseline that could be recaptured around the bug - Particle straight-alpha recovery from two backgrounds (
ParticleAlphaReconstruction) — including theMinResolvableCoveragenoise floor: the un-premultiply divides by recovered coverage, so without it a single LSB of sample error in an empty pixel becomes a mid-grey one - Local→world AABB transform (
BoundsTransform.TransformAabb) - Sprite-sheet grid slicing geometry (
SpriteSheetLayout.BuildFrameRects) - Animation export frame-count estimation (
AnimationExportEstimator) - Directional yaw snapping (
AngleSnapping.SnapToStep) - Sprite trim/pivot foundation (
PixelRect,OpaqueBounds,TrimPlan,PivotMath) — game-ready output L0 (tight crop bounds, uniform-size unification, post-trim pivot recompute) - Sprite-clip keyframe timing (
SpriteAnimationPlan→SpriteAnimationClipPlan/SpriteKeyframe) — game-ready output L1 (which frame shows at which time; clip length + fps + loop) - Directional facing plan and
Angle_###folder naming (DirectionalAnglePlan) — one convention for both writers (the evenly-divided animation sweep viaBuild, and the Static Sprite tab's arbitrary yaw range viaFolderNameFor), because Game-Ready reads them all back throughAngleFolders - Generated-shader path math (
GeneratedShaderPaths) — template→output derivation and which generated files no longer belong to the active pipeline, so the installer can sync in place instead of deleting the folder and re-minting every GUID - Headless capture job success rules (
CaptureJobOutcome) — whether a run may be reported as a success given what actually reached disk, kept out of the Unity-facing API so it can be tested
Does NOT Own¶
- Feature orchestration / workflow sequencing
- Render, capture, or material implementation
- Editor UI, panels, or preview scene lifecycle
- File I/O execution (it may derive paths; it does not write them)
Allowed Dependencies¶
Logic may depend on:
- Shared abstractions (interfaces it implements)
- Models (plain value types / enums such as
OverlayPosition) - Presets (serializable settings models such as
AnimationExportPreset) UnityEnginemath types (Mathf,Vector*,Bounds,Color,Rect) used as plain value math
Logic must NOT depend on feature territories, panels, preview, or pipelines. Dependencies point into this assembly, never out of it.
Notes¶
The calculators here are intentionally side-effect free and constructed without arguments, so tests can exercise them directly without a Unity render context. The IFrameIndexCalculator abstraction stays in Abstractions; the concrete kernel lives here.
Future Candidates¶
- Directional
GetDirectionCount/GetBaseYawcluster (needs theOrientationPreset/SideScrollOrientationenums relocated out of the predefined assembly intoEnumsfirst) - The
FlatAlbedoCapturealbedo-property-name predicate (small pure string guard)