ClipCaps.cs
2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
using System;
using UnityEngine.Playables;
namespace UnityEngine.Timeline
{
/// <summary>
/// Describes the timeline features supported by a clip
/// </summary>
[Flags]
public enum ClipCaps
{
/// <summary>
/// No features are supported.
/// </summary>
None = 0 ,
/// <summary>
/// The clip supports loops.
/// </summary>
Looping = 1 << 0,
/// <summary>
/// The clip supports clip extrapolation.
/// </summary>
Extrapolation = 1 << 1,
/// <summary>
/// The clip supports initial local times greater than zero.
/// </summary>
ClipIn = 1 << 2,
/// <summary>
/// The clip supports time scaling.
/// </summary>
SpeedMultiplier = 1 << 3,
/// <summary>
/// The clip supports blending between clips.
/// </summary>
Blending = 1 << 4,
/// <summary>
/// All features are supported.
/// </summary>
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;
}
}
}