logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    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
    object
    AnimationClipPreviewSampling
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Editor.AnimationHub.Engine
    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
    Type Name Description
    float time
    float clipLength
    Returns
    Type Description
    float

    CountDistinctBindingPaths(AnimationClip)

    Counts distinct binding paths in clip — the denominator for DescribeBindingCoverage(int, int), deduplicated the same way as CountUnresolvedBindingPaths(AnimationClip, Transform) so the two counts are always comparable.

    Declaration
    public static int CountDistinctBindingPaths(AnimationClip clip)
    Parameters
    Type Name Description
    AnimationClip clip
    Returns
    Type Description
    int

    CountUnresolvedBindingPaths(AnimationClip, Transform)

    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
    Type Description
    int

    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
    Type Description
    string

    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
    Type Description
    bool
    In this article
    © 2026 Serenity. All Rights Reserved