Class AnimationClipPreviewSampling
Pure decision logic behind AnimationClipPreviewScrubber's per-repaint sampling: whether a resample
is due, where the playhead clamps to, and how well the previewed instance's hierarchy actually covers the
clip's authored binding paths. Kept free of UnityEngine.Object.Instantiate(UnityEngine.Object)/SampleAnimation
so the decision itself stays testable without a live preview session.
Inheritance
AnimationClipPreviewSampling
Assembly: Serenity.AnimationHub.Editor.dll
Syntax
public static class AnimationClipPreviewSampling
Methods
ClampSampleTime(float, float)
Clamps into [0, clipLength], never negative even for a zero-or-negative length clip. NaN
degrades to zero rather than propagating into AnimationClip.SampleAnimation.
Declaration
public static float ClampSampleTime(float time, float clipLength)
Parameters
Returns
CountDistinctBindingPaths(AnimationClip)
Declaration
public static int CountDistinctBindingPaths(AnimationClip clip)
Parameters
| Type |
Name |
Description |
| AnimationClip |
clip |
|
Returns
Counts distinct binding PATHS in clip that do not resolve under
instanceRoot — a curve authored against a bone or child the previewed instance does
not actually have (a stale rig, a mismatched hierarchy). Multiple bindings sharing an unresolved path
(position + rotation on the same missing bone) count once, since the coverage message is about
hierarchy mismatch, not curve count. An empty path always resolves to the root itself.
Declaration
public static int CountUnresolvedBindingPaths(AnimationClip clip, Transform instanceRoot)
Parameters
| Type |
Name |
Description |
| AnimationClip |
clip |
|
| Transform |
instanceRoot |
|
Returns
DescribeBindingCoverage(int, int)
Human-readable coverage summary for the viewport's status chip — empty when every binding
path resolved, so a healthy preview adds nothing to SerenityModelPreviewSession.StatusText.
Declaration
public static string DescribeBindingCoverage(int unresolvedPathCount, int totalPathCount)
Parameters
| Type |
Name |
Description |
| int |
unresolvedPathCount |
|
| int |
totalPathCount |
|
Returns
ShouldResample(float, float, bool)
A resample is due when the instance's content changed underneath the scrubber (a curve was
added/removed/committed, or the instance was reloaded) or the requested playhead moved since the last
sample. Comparing with UnityEngine.Mathf.Approximately(System.Single,System.Single) avoids a resample-every-repaint loop from
float round-trip noise on an unchanged scrub position.
Declaration
public static bool ShouldResample(float lastSampledTime, float requestedTime, bool contentDirty)
Parameters
| Type |
Name |
Description |
| float |
lastSampledTime |
|
| float |
requestedTime |
|
| bool |
contentDirty |
|
Returns