ClipItem.cs
3.52 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
using System;
using UnityEngine.Timeline;
namespace UnityEditor.Timeline
{
class ClipItem : IBlendable, ITrimmable
{
readonly TimelineClip m_Clip;
public TimelineClip clip
{
get { return m_Clip; }
}
public ClipItem(TimelineClip clip)
{
m_Clip = clip;
}
public TrackAsset parentTrack
{
get { return m_Clip.parentTrack; }
set { m_Clip.parentTrack = value; }
}
public double start
{
get { return m_Clip.start; }
set { m_Clip.start = value; }
}
public double end
{
get { return m_Clip.end; }
}
public double duration
{
get { return m_Clip.duration; }
}
public bool IsCompatibleWithTrack(TrackAsset track)
{
return track.IsCompatibleWithClip(m_Clip);
}
public void PushUndo(string operation)
{
TimelineUndo.PushUndo(m_Clip.parentTrack, operation);
}
public TimelineItemGUI gui
{
get { return ItemToItemGui.GetGuiForClip(m_Clip); }
}
public bool supportsBlending
{
get { return m_Clip.SupportsBlending(); }
}
public bool hasLeftBlend
{
get { return m_Clip.hasBlendIn; }
}
public bool hasRightBlend
{
get { return m_Clip.hasBlendOut; }
}
public double leftBlendDuration
{
get { return m_Clip.hasBlendIn ? m_Clip.blendInDuration : m_Clip.easeInDuration; }
}
public double rightBlendDuration
{
get { return m_Clip.hasBlendOut ? m_Clip.blendOutDuration : m_Clip.easeOutDuration; }
}
public void SetStart(double time)
{
ClipModifier.SetStart(m_Clip, time);
}
public void SetEnd(double time, bool affectTimeScale)
{
ClipModifier.SetEnd(m_Clip, time, affectTimeScale);
}
public void Delete()
{
EditorClipFactory.RemoveEditorClip(m_Clip);
ClipModifier.Delete(m_Clip.parentTrack.timelineAsset, m_Clip);
}
public void TrimStart(double time)
{
ClipModifier.TrimStart(m_Clip, time);
}
public void TrimEnd(double time)
{
ClipModifier.TrimEnd(m_Clip, time);
}
public ITimelineItem CloneTo(TrackAsset parent, double time)
{
return new ClipItem(TimelineHelpers.Clone(m_Clip, TimelineEditor.inspectedDirector, TimelineEditor.inspectedDirector, time, parent));
}
public override string ToString()
{
return m_Clip.ToString();
}
public bool Equals(ClipItem otherClip)
{
if (ReferenceEquals(null, otherClip)) return false;
if (ReferenceEquals(this, otherClip)) return true;
return Equals(m_Clip, otherClip.m_Clip);
}
public override int GetHashCode()
{
return (m_Clip != null ? m_Clip.GetHashCode() : 0);
}
public bool Equals(ITimelineItem other)
{
return Equals((object)other);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
var other = obj as ClipItem;
return other != null && Equals(other);
}
}
}