using System;
namespace UnityEngine.Timeline
{
///
/// Describes the timeline features supported by a clip
///
[Flags]
public enum ClipCaps
{
///
/// No features are supported.
///
None = 0,
///
/// The clip supports loops.
///
Looping = 1 << 0,
///
/// The clip supports clip extrapolation.
///
Extrapolation = 1 << 1,
///
/// The clip supports initial local times greater than zero.
///
ClipIn = 1 << 2,
///
/// The clip supports time scaling.
///
SpeedMultiplier = 1 << 3,
///
/// The clip supports blending between clips.
///
Blending = 1 << 4,
///
/// The clip supports time scaling, and sets the default trim mode in the editor to scale the clip
/// (speed multiplier) when the start/end of the clip is trimmed.
///
AutoScale = 1 << 5 | SpeedMultiplier,
///
/// All features are supported.
///
All = ~None
}
static class TimelineClipCapsExtensions
{
public static bool SupportsLooping(this TimelineClip clip)
{
return clip != null && (clip.clipCaps & ClipCaps.Looping) != ClipCaps.None;
}
public static bool SupportsExtrapolation(this TimelineClip clip)
{
return clip != null && (clip.clipCaps & ClipCaps.Extrapolation) != ClipCaps.None;
}
public static bool SupportsClipIn(this TimelineClip clip)
{
return clip != null && (clip.clipCaps & ClipCaps.ClipIn) != ClipCaps.None;
}
public static bool SupportsSpeedMultiplier(this TimelineClip clip)
{
return clip != null && (clip.clipCaps & ClipCaps.SpeedMultiplier) != ClipCaps.None;
}
public static bool SupportsBlending(this TimelineClip clip)
{
return clip != null && (clip.clipCaps & ClipCaps.Blending) != ClipCaps.None;
}
public static bool HasAll(this ClipCaps caps, ClipCaps flags)
{
return (caps & flags) == flags;
}
public static bool HasAny(this ClipCaps caps, ClipCaps flags)
{
return (caps & flags) != 0;
}
}
}