ActionExamples.cs
3.19 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
using System;
using System.Collections.Generic;
using UnityEditor.ShortcutManagement;
using UnityEditor.Timeline.Actions;
using UnityEngine;
using UnityEngine.Timeline;
namespace DocCodeExamples
{
class ActionExamples_HideAPI
{
#region declare-sampleClipAction
[MenuEntry("Custom Actions/Sample clip Action")]
public class SampleClipAction : ClipAction
{
public override ActionValidity Validate(IEnumerable<TimelineClip> clip)
{
return ActionValidity.Valid;
}
public override bool Execute(IEnumerable<TimelineClip> items)
{
Debug.Log("Test Action");
return true;
}
[TimelineShortcut("SampleClipAction", KeyCode.K)]
public static void HandleShortCut(ShortcutArguments args)
{
Invoker.InvokeWithSelectedClips<SampleClipAction>();
}
}
#endregion
#region declare-sampleMarkerAction
[MenuEntry("Custom Actions/Sample marker Action")]
public class SampleMarkerAction : MarkerAction
{
public override ActionValidity Validate(IEnumerable<IMarker> markers)
{
return ActionValidity.Valid;
}
public override bool Execute(IEnumerable<IMarker> items)
{
Debug.Log("Test Action");
return true;
}
[TimelineShortcut("SampleMarkerAction", KeyCode.L)]
public static void HandleShortCut(ShortcutArguments args)
{
Invoker.InvokeWithSelectedMarkers<SampleMarkerAction>();
}
}
#endregion
#region declare-sampleTrackAction
[MenuEntry("Custom Actions/Sample track Action")]
public class SampleTrackAction : TrackAction
{
public override ActionValidity Validate(IEnumerable<TrackAsset> tracks)
{
return ActionValidity.Valid;
}
public override bool Execute(IEnumerable<TrackAsset> tracks)
{
Debug.Log("Test Action");
return true;
}
[TimelineShortcut("SampleTrackAction", KeyCode.H)]
public static void HandleShortCut(ShortcutArguments args)
{
Invoker.InvokeWithSelectedTracks<SampleTrackAction>();
}
}
#endregion
#region declare-sampleTimelineAction
[MenuEntry("Custom Actions/Sample Timeline Action")]
public class SampleTimelineAction : TimelineAction
{
public override ActionValidity Validate(ActionContext context)
{
return ActionValidity.Valid;
}
public override bool Execute(ActionContext context)
{
Debug.Log("Test Action");
return true;
}
[TimelineShortcut("SampleTimelineAction", KeyCode.Q)]
public static void HandleShortCut(ShortcutArguments args)
{
Invoker.InvokeWithSelected<SampleTimelineAction>();
}
}
#endregion
}
}