io.atlasv.tools.timeline.core 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.attestation.p7m +0 -0
- package/Editor/AtlasV.Tools.Timeline.Core.Editor.asmdef +20 -0
- package/Editor/AtlasV.Tools.Timeline.Core.Editor.asmdef.meta +7 -0
- package/Editor/Common/AutoNameClipEditor.cs +24 -0
- package/Editor/Common/AutoNameClipEditor.cs.meta +2 -0
- package/Editor/Common/InterpolateParamClipEditor.cs +24 -0
- package/Editor/Common/InterpolateParamClipEditor.cs.meta +2 -0
- package/Editor/Common.meta +8 -0
- package/Editor/InterpolationParam/AInterpolateControlTrackWithSourceEditor.cs +33 -0
- package/Editor/InterpolationParam/AInterpolateControlTrackWithSourceEditor.cs.meta +2 -0
- package/Editor/InterpolationParam/GlobalShaderParamControlCilpEditors.cs +35 -0
- package/Editor/InterpolationParam/GlobalShaderParamControlCilpEditors.cs.meta +2 -0
- package/Editor/InterpolationParam/ShaderParamControlClipEditors.cs +35 -0
- package/Editor/InterpolationParam/ShaderParamControlClipEditors.cs.meta +2 -0
- package/Editor/InterpolationParam/ShaderParamControlTrackEditor.cs +11 -0
- package/Editor/InterpolationParam/ShaderParamControlTrackEditor.cs.meta +2 -0
- package/Editor/InterpolationParam.meta +8 -0
- package/Editor/Tools/SelectAndLockTimeline.cs +151 -0
- package/Editor/Tools/SelectAndLockTimeline.cs.meta +2 -0
- package/Editor/Tools.meta +8 -0
- package/Editor.meta +8 -0
- package/Runtime/AtlasV.Tools.Timeline.Core.Runtime.asmdef +17 -0
- package/Runtime/AtlasV.Tools.Timeline.Core.Runtime.asmdef.meta +7 -0
- package/Runtime/Common/AClipInfoTrack.cs +30 -0
- package/Runtime/Common/AClipInfoTrack.cs.meta +2 -0
- package/Runtime/Common/AClipWithInfo.cs +9 -0
- package/Runtime/Common/AClipWithInfo.cs.meta +2 -0
- package/Runtime/Common/AInterpolateControlClip.cs +24 -0
- package/Runtime/Common/AInterpolateControlClip.cs.meta +2 -0
- package/Runtime/Common/AInterpolatorPlayable.cs +44 -0
- package/Runtime/Common/AInterpolatorPlayable.cs.meta +2 -0
- package/Runtime/Common/ATrackEnterExitBehaviour.cs +54 -0
- package/Runtime/Common/ATrackEnterExitBehaviour.cs.meta +2 -0
- package/Runtime/Common/ClipInfo.cs +8 -0
- package/Runtime/Common/ClipInfo.cs.meta +2 -0
- package/Runtime/Common/IClipAutoName.cs +10 -0
- package/Runtime/Common/IClipAutoName.cs.meta +2 -0
- package/Runtime/Common/ValueCurveInterpolator.cs +114 -0
- package/Runtime/Common/ValueCurveInterpolator.cs.meta +2 -0
- package/Runtime/Common.meta +8 -0
- package/Runtime/GlobalShader/AGlobalShaderParamClip.cs +75 -0
- package/Runtime/GlobalShader/AGlobalShaderParamClip.cs.meta +2 -0
- package/Runtime/GlobalShader/GlobalShaderParamControlClipColor.cs +16 -0
- package/Runtime/GlobalShader/GlobalShaderParamControlClipColor.cs.meta +2 -0
- package/Runtime/GlobalShader/GlobalShaderParamControlClipFloat.cs +18 -0
- package/Runtime/GlobalShader/GlobalShaderParamControlClipFloat.cs.meta +2 -0
- package/Runtime/GlobalShader/GlobalShaderParamControlClipHDRColor.cs +17 -0
- package/Runtime/GlobalShader/GlobalShaderParamControlClipHDRColor.cs.meta +2 -0
- package/Runtime/GlobalShader/GlobalShaderParamControlClipVector2.cs +17 -0
- package/Runtime/GlobalShader/GlobalShaderParamControlClipVector2.cs.meta +2 -0
- package/Runtime/GlobalShader/GlobalShaderParamControlClipVector3.cs +17 -0
- package/Runtime/GlobalShader/GlobalShaderParamControlClipVector3.cs.meta +2 -0
- package/Runtime/GlobalShader/GlobalShaderParamControlClipVector4.cs +18 -0
- package/Runtime/GlobalShader/GlobalShaderParamControlClipVector4.cs.meta +2 -0
- package/Runtime/GlobalShader/GlobalShaderParamPlayable.cs +24 -0
- package/Runtime/GlobalShader/GlobalShaderParamPlayable.cs.meta +2 -0
- package/Runtime/GlobalShader/GlobalShaderParamTrack.cs +35 -0
- package/Runtime/GlobalShader/GlobalShaderParamTrack.cs.meta +2 -0
- package/Runtime/GlobalShader.meta +8 -0
- package/Runtime/InterpolationParam/AInterpolateControlClipDataProvider.cs +34 -0
- package/Runtime/InterpolationParam/AInterpolateControlClipDataProvider.cs.meta +2 -0
- package/Runtime/InterpolationParam/AInterpolateControlTrackDataProvider.cs +40 -0
- package/Runtime/InterpolationParam/AInterpolateControlTrackDataProvider.cs.meta +2 -0
- package/Runtime/InterpolationParam/AInterpolateControlTrackWithSource.cs +42 -0
- package/Runtime/InterpolationParam/AInterpolateControlTrackWithSource.cs.meta +2 -0
- package/Runtime/InterpolationParam/AInterpolatePlayableDataProvider.cs +39 -0
- package/Runtime/InterpolationParam/AInterpolatePlayableDataProvider.cs.meta +2 -0
- package/Runtime/InterpolationParam.meta +8 -0
- package/Runtime/Material/MaterialParamControlTrack.cs +28 -0
- package/Runtime/Material/MaterialParamControlTrack.cs.meta +2 -0
- package/Runtime/Material/ShaderParamControlClip.cs +57 -0
- package/Runtime/Material/ShaderParamControlClip.cs.meta +2 -0
- package/Runtime/Material/ShaderParamControlClipColor.cs +15 -0
- package/Runtime/Material/ShaderParamControlClipColor.cs.meta +2 -0
- package/Runtime/Material/ShaderParamControlClipFloat.cs +19 -0
- package/Runtime/Material/ShaderParamControlClipFloat.cs.meta +2 -0
- package/Runtime/Material/ShaderParamControlClipHDRColor.cs +15 -0
- package/Runtime/Material/ShaderParamControlClipHDRColor.cs.meta +2 -0
- package/Runtime/Material/ShaderParamControlClipVector2.cs +16 -0
- package/Runtime/Material/ShaderParamControlClipVector2.cs.meta +2 -0
- package/Runtime/Material/ShaderParamControlClipVector3.cs +16 -0
- package/Runtime/Material/ShaderParamControlClipVector3.cs.meta +2 -0
- package/Runtime/Material/ShaderParamControlClipVector4.cs +17 -0
- package/Runtime/Material/ShaderParamControlClipVector4.cs.meta +2 -0
- package/Runtime/Material/ShaderParamControlTrack.cs +33 -0
- package/Runtime/Material/ShaderParamControlTrack.cs.meta +2 -0
- package/Runtime/Material/ShaderParamPlayable.cs +10 -0
- package/Runtime/Material/ShaderParamPlayable.cs.meta +2 -0
- package/Runtime/Material/SkyboxParamControlTrack.cs +30 -0
- package/Runtime/Material/SkyboxParamControlTrack.cs.meta +2 -0
- package/Runtime/Material.meta +8 -0
- package/Runtime.meta +8 -0
- package/package.json +28 -0
- package/package.json.meta +7 -0
package/.attestation.p7m
ADDED
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "AtlasV.Tools.Timeline.Core.Editor",
|
|
3
|
+
"rootNamespace": "",
|
|
4
|
+
"references": [
|
|
5
|
+
"GUID:370df0095b71ed0438fa74206900dee0",
|
|
6
|
+
"GUID:f06555f75b070af458a003d92f9efb00",
|
|
7
|
+
"GUID:02f771204943f4a40949438e873e3eff"
|
|
8
|
+
],
|
|
9
|
+
"includePlatforms": [
|
|
10
|
+
"Editor"
|
|
11
|
+
],
|
|
12
|
+
"excludePlatforms": [],
|
|
13
|
+
"allowUnsafeCode": false,
|
|
14
|
+
"overrideReferences": false,
|
|
15
|
+
"precompiledReferences": [],
|
|
16
|
+
"autoReferenced": true,
|
|
17
|
+
"defineConstraints": [],
|
|
18
|
+
"versionDefines": [],
|
|
19
|
+
"noEngineReferences": false
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
using UnityEditor;
|
|
2
|
+
using UnityEditor.Timeline;
|
|
3
|
+
using UnityEngine.Timeline;
|
|
4
|
+
|
|
5
|
+
namespace AtlasV.Tools.Timeline
|
|
6
|
+
{
|
|
7
|
+
public class AutoNameClipEditor : ClipEditor
|
|
8
|
+
{
|
|
9
|
+
public override void OnClipChanged (TimelineClip clip)
|
|
10
|
+
{
|
|
11
|
+
IClipAutoName autoNameClip = clip.asset as IClipAutoName;
|
|
12
|
+
|
|
13
|
+
if ( autoNameClip == null )
|
|
14
|
+
return;
|
|
15
|
+
|
|
16
|
+
if ( string.IsNullOrEmpty (autoNameClip.autoName) )
|
|
17
|
+
return;
|
|
18
|
+
|
|
19
|
+
clip.displayName = autoNameClip.autoName;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
using System.Reflection;
|
|
2
|
+
using UnityEngine.Timeline;
|
|
3
|
+
|
|
4
|
+
namespace AtlasV.Tools.Timeline
|
|
5
|
+
{
|
|
6
|
+
public class InterpolateParamClipEditor : AutoNameClipEditor
|
|
7
|
+
{
|
|
8
|
+
|
|
9
|
+
static FieldInfo preField =
|
|
10
|
+
typeof(TimelineClip).GetField("m_PreExtrapolationMode",
|
|
11
|
+
BindingFlags.Instance | BindingFlags.NonPublic);
|
|
12
|
+
|
|
13
|
+
static FieldInfo postField =
|
|
14
|
+
typeof(TimelineClip).GetField("m_PostExtrapolationMode",
|
|
15
|
+
BindingFlags.Instance | BindingFlags.NonPublic);
|
|
16
|
+
|
|
17
|
+
public override void OnCreate (TimelineClip clip, TrackAsset track, TimelineClip clonedFrom)
|
|
18
|
+
{
|
|
19
|
+
preField?.SetValue (clip, TimelineClip.ClipExtrapolation.Hold);
|
|
20
|
+
postField?.SetValue (clip, TimelineClip.ClipExtrapolation.Hold);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
using UnityEditor;
|
|
2
|
+
using UnityEditor.Timeline;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
|
|
5
|
+
namespace AtlasV.Tools.Timeline
|
|
6
|
+
{
|
|
7
|
+
public abstract class AInterpolateControlTrackWithSourceEditor<TData, TPlayable> : Editor
|
|
8
|
+
where TData : UnityEngine.Object
|
|
9
|
+
where TPlayable : AInterpolatePlayableDataProvider<TData>, new()
|
|
10
|
+
{
|
|
11
|
+
|
|
12
|
+
SerializedProperty _cachedObject;
|
|
13
|
+
|
|
14
|
+
void OnEnable ()
|
|
15
|
+
{
|
|
16
|
+
_cachedObject = serializedObject.FindProperty ("_cachedObjects");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public override void OnInspectorGUI ()
|
|
20
|
+
{
|
|
21
|
+
base.OnInspectorGUI ();
|
|
22
|
+
var typedTarget = ( AInterpolateControlTrackWithSource<TData, TPlayable> ) target;
|
|
23
|
+
if ( typedTarget == null )
|
|
24
|
+
return;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
GUI.enabled = false;
|
|
28
|
+
EditorGUILayout.IntField ("Num of animated Objects", typedTarget.count);
|
|
29
|
+
GUI.enabled = true;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
using UnityEditor.Timeline;
|
|
2
|
+
|
|
3
|
+
namespace AtlasV.Tools.Timeline
|
|
4
|
+
{
|
|
5
|
+
[CustomTimelineEditor (typeof (GlobalShaderParamControlClipColor))]
|
|
6
|
+
public class GlobalShaderParamControlClipColorEditor : InterpolateParamClipEditor
|
|
7
|
+
{
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
[CustomTimelineEditor (typeof (GlobalShaderParamControlClipFloat))]
|
|
12
|
+
public class GlobalShaderParamControlClipFloatEditor : InterpolateParamClipEditor
|
|
13
|
+
{
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
[CustomTimelineEditor (typeof (GlobalShaderParamControlClipVector2))]
|
|
18
|
+
public class GlobalShaderParamControlClipVector2Editor : InterpolateParamClipEditor
|
|
19
|
+
{
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
[CustomTimelineEditor (typeof (GlobalShaderParamControlClipVector3))]
|
|
24
|
+
public class GlobalShaderParamControlClipVector3Editor : InterpolateParamClipEditor
|
|
25
|
+
{
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[CustomTimelineEditor (typeof (GlobalShaderParamControlClipVector4))]
|
|
30
|
+
public class GlobalShaderParamControlClipVector4Editor : InterpolateParamClipEditor
|
|
31
|
+
{
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
using UnityEditor.Timeline;
|
|
2
|
+
|
|
3
|
+
namespace AtlasV.Tools.Timeline
|
|
4
|
+
{
|
|
5
|
+
[CustomTimelineEditor (typeof (ShaderParamControlClipColor))]
|
|
6
|
+
public class ShaderParamControlClipColorEditor : InterpolateParamClipEditor
|
|
7
|
+
{
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
[CustomTimelineEditor (typeof (ShaderParamControlClipFloat))]
|
|
12
|
+
public class ShaderParamControlClipFloatEditor : InterpolateParamClipEditor
|
|
13
|
+
{
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
[CustomTimelineEditor (typeof (ShaderParamControlClipVector2))]
|
|
18
|
+
public class ShaderParamControlClipVector2Editor : InterpolateParamClipEditor
|
|
19
|
+
{
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
[CustomTimelineEditor (typeof (ShaderParamControlClipVector3))]
|
|
24
|
+
public class ShaderParamControlClipVector3Editor : InterpolateParamClipEditor
|
|
25
|
+
{
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[CustomTimelineEditor (typeof (ShaderParamControlClipVector4))]
|
|
30
|
+
public class ShaderParamControlClipVector4Editor : InterpolateParamClipEditor
|
|
31
|
+
{
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
using UnityEditor;
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
|
|
4
|
+
namespace AtlasV.Tools.Timeline
|
|
5
|
+
{
|
|
6
|
+
[CustomEditor (typeof (ShaderParamControlTrack))]
|
|
7
|
+
public class ShaderParamControlTrackEditor : AInterpolateControlTrackWithSourceEditor<Material, ShaderParamPlayable>
|
|
8
|
+
{
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
using UnityEditor.Toolbars;
|
|
2
|
+
using UnityEditor;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
using UnityEditor.Timeline;
|
|
5
|
+
using UnityEngine.Playables;
|
|
6
|
+
using System.IO;
|
|
7
|
+
using UnityEditor.SceneManagement;
|
|
8
|
+
using UnityEngine.SceneManagement;
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
public class SelectAndLockTimeline
|
|
12
|
+
{
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
const string kElementPath = "AtlasV/Select Timeline Dropdown";
|
|
17
|
+
|
|
18
|
+
static string[] timelinesName;
|
|
19
|
+
|
|
20
|
+
static PlayableDirector[] cachedTimelines = null;
|
|
21
|
+
static string currentSelection = "Not selected";
|
|
22
|
+
// static MainToolbarContent dropdownSelection = null;
|
|
23
|
+
|
|
24
|
+
[MainToolbarElement (kElementPath, defaultDockPosition = MainToolbarDockPosition.Middle)]
|
|
25
|
+
public static MainToolbarElement CreateSceneSelectorDropdown ()
|
|
26
|
+
{
|
|
27
|
+
currentSelection = "Not selected";
|
|
28
|
+
|
|
29
|
+
if ( Selection.activeObject is PlayableDirector director )
|
|
30
|
+
{
|
|
31
|
+
currentSelection = director.playableAsset.name;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var icon = EditorGUIUtility.IconContent("d_UnityEditor.Timeline.TimelineWindow").image as Texture2D;
|
|
35
|
+
var dropdownSelection = new MainToolbarContent(currentSelection, icon, "Select timeline");
|
|
36
|
+
return new MainToolbarDropdown (dropdownSelection, ShowDropdownMenu);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static void RefreshDirectorList ()
|
|
40
|
+
{
|
|
41
|
+
cachedTimelines = Object.FindObjectsByType<PlayableDirector> (FindObjectsInactive.Include, FindObjectsSortMode.None);
|
|
42
|
+
|
|
43
|
+
timelinesName = Directory.GetFiles ("Assets", "*.unity", SearchOption.AllDirectories);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static void ShowDropdownMenu (Rect dropDownRect)
|
|
47
|
+
{
|
|
48
|
+
var menu = new GenericMenu();
|
|
49
|
+
if ( timelinesName.Length == 0 )
|
|
50
|
+
{
|
|
51
|
+
menu.AddDisabledItem (new GUIContent ("No Scenes in Project"));
|
|
52
|
+
}
|
|
53
|
+
foreach ( PlayableDirector director in cachedTimelines )
|
|
54
|
+
{
|
|
55
|
+
string timelineName = director.playableAsset.name;
|
|
56
|
+
menu.AddItem (new GUIContent (timelineName), false, () =>
|
|
57
|
+
{
|
|
58
|
+
// dropdownSelection.text = timelineName;
|
|
59
|
+
currentSelection = timelineName;
|
|
60
|
+
SelectTimeline (director);
|
|
61
|
+
MainToolbar.Refresh (kElementPath);
|
|
62
|
+
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
menu.DropDown (dropDownRect);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static void SelectTimeline (PlayableDirector timeline)
|
|
69
|
+
{
|
|
70
|
+
if ( timeline != null )
|
|
71
|
+
{
|
|
72
|
+
Selection.activeObject = timeline;
|
|
73
|
+
|
|
74
|
+
OpenAndLockTimelineEditor (timeline);
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
static void SceneSwitched (Scene oldScene, Scene newScene)
|
|
80
|
+
{
|
|
81
|
+
MainToolbar.Refresh (kElementPath);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static SelectAndLockTimeline ()
|
|
85
|
+
{
|
|
86
|
+
RefreshDirectorList ();
|
|
87
|
+
EditorApplication.projectChanged += RefreshDirectorList;
|
|
88
|
+
SceneManager.activeSceneChanged += SceneSwitched;
|
|
89
|
+
EditorSceneManager.activeSceneChangedInEditMode += SceneSwitched;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
[MainToolbarElement ("AtlasV/Select Timeline Button", defaultDockPosition = MainToolbarDockPosition.Middle)]
|
|
94
|
+
public static MainToolbarElement SelectTimelineButton ()
|
|
95
|
+
{
|
|
96
|
+
var icon = EditorGUIUtility.IconContent("d_UnityEditor.Timeline.TimelineWindow").image as Texture2D;
|
|
97
|
+
var content = new MainToolbarContent(icon);
|
|
98
|
+
return new MainToolbarButton (content, SelectFirstTimeline);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
static void SelectFirstTimeline ()
|
|
102
|
+
{
|
|
103
|
+
PlayableDirector timeline = null;
|
|
104
|
+
if ( Selection.activeObject is GameObject go )
|
|
105
|
+
{
|
|
106
|
+
timeline = go.GetComponent<PlayableDirector> ();
|
|
107
|
+
|
|
108
|
+
if ( timeline != null )
|
|
109
|
+
{
|
|
110
|
+
OpenAndLockTimelineEditor (timeline);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
timeline = Object.FindFirstObjectByType<PlayableDirector> ();
|
|
117
|
+
if ( timeline != null )
|
|
118
|
+
{
|
|
119
|
+
Selection.activeObject = timeline;
|
|
120
|
+
|
|
121
|
+
OpenAndLockTimelineEditor (timeline);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
static void OpenAndLockTimelineEditor (PlayableDirector timeline)
|
|
127
|
+
{
|
|
128
|
+
|
|
129
|
+
if ( timeline == null )
|
|
130
|
+
return;
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
if ( !EditorApplication.ExecuteMenuItem ("Window/Sequencing/Timeline") )
|
|
134
|
+
{
|
|
135
|
+
Debug.LogError ("Impossible d�ouvrir la Timeline (menu introuvable)");
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
var timelineEditorWindow = TimelineEditor.GetWindow ();
|
|
140
|
+
|
|
141
|
+
if ( timelineEditorWindow != null )
|
|
142
|
+
{
|
|
143
|
+
// Find a Timeline component, then in case we are using Sequences, climb up to the root master sequence.
|
|
144
|
+
if ( timeline != null )
|
|
145
|
+
{
|
|
146
|
+
timelineEditorWindow.SetTimeline (timeline);
|
|
147
|
+
timelineEditorWindow.locked = true;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
package/Editor.meta
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "AtlasV.Tools.Timeline.Core.Runtime",
|
|
3
|
+
"rootNamespace": "",
|
|
4
|
+
"references": [
|
|
5
|
+
"GUID:f06555f75b070af458a003d92f9efb00",
|
|
6
|
+
"GUID:df380645f10b7bc4b97d4f5eb6303d95"
|
|
7
|
+
],
|
|
8
|
+
"includePlatforms": [],
|
|
9
|
+
"excludePlatforms": [],
|
|
10
|
+
"allowUnsafeCode": false,
|
|
11
|
+
"overrideReferences": false,
|
|
12
|
+
"precompiledReferences": [],
|
|
13
|
+
"autoReferenced": true,
|
|
14
|
+
"defineConstraints": [],
|
|
15
|
+
"versionDefines": [],
|
|
16
|
+
"noEngineReferences": false
|
|
17
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
using System.Collections.Generic;
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
using UnityEngine.Playables;
|
|
4
|
+
using UnityEngine.Timeline;
|
|
5
|
+
|
|
6
|
+
namespace AtlasV.Tools.Timeline
|
|
7
|
+
{
|
|
8
|
+
public abstract class AClipInfoTrack : TrackAsset
|
|
9
|
+
{
|
|
10
|
+
|
|
11
|
+
public override Playable CreateTrackMixer (PlayableGraph graph, GameObject go, int inputCount)
|
|
12
|
+
{
|
|
13
|
+
|
|
14
|
+
foreach ( var clip in GetClips () )
|
|
15
|
+
{
|
|
16
|
+
if ( clip.asset is AClipWithInfo controlClip )
|
|
17
|
+
{
|
|
18
|
+
controlClip.clipInfo = new ClipInfo ()
|
|
19
|
+
{
|
|
20
|
+
start = clip.start,
|
|
21
|
+
end = clip.end
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return base.CreateTrackMixer (graph, go, inputCount);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using UnityEngine.Playables;
|
|
3
|
+
|
|
4
|
+
namespace AtlasV.Tools.Timeline
|
|
5
|
+
{
|
|
6
|
+
public abstract class AInterpolateControlClip<TData, TPlayable, TInterpolator> : AClipWithInfo
|
|
7
|
+
where TPlayable : AInterpolatorPlayable<TData>, new()
|
|
8
|
+
where TInterpolator : ValueCurveInterpolator<TData>
|
|
9
|
+
{
|
|
10
|
+
public TInterpolator values;
|
|
11
|
+
|
|
12
|
+
public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
|
|
13
|
+
{
|
|
14
|
+
TPlayable behaviour = new TPlayable ()
|
|
15
|
+
{
|
|
16
|
+
clipInfo = clipInfo,
|
|
17
|
+
interpolator = values
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
Playable playable = ScriptPlayable <TPlayable>.Create ( graph, behaviour );
|
|
21
|
+
return playable;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using UnityEngine.Playables;
|
|
3
|
+
|
|
4
|
+
namespace AtlasV.Tools.Timeline
|
|
5
|
+
{
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
public abstract class AInterpolatePlayable : PlayableBehaviour
|
|
9
|
+
{
|
|
10
|
+
public ClipInfo clipInfo;
|
|
11
|
+
|
|
12
|
+
public override void ProcessFrame (Playable playable, FrameData info, object playerData)
|
|
13
|
+
{
|
|
14
|
+
if ( clipInfo == null )
|
|
15
|
+
return;
|
|
16
|
+
|
|
17
|
+
double time = playable.GetTime ( );
|
|
18
|
+
double ratio = time / clipInfo.duration;
|
|
19
|
+
float ratioF = (float) ratio;
|
|
20
|
+
RetrieveDataIfNeeded (playerData, info, playerData);
|
|
21
|
+
ApplyRatio (ratioF);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
protected virtual void RetrieveDataIfNeeded (object playerData1, FrameData info, object playerData2)
|
|
25
|
+
{
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
protected abstract void ApplyRatio (float ratio);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public abstract class AInterpolatorPlayable<TData>: AInterpolatePlayable
|
|
32
|
+
{
|
|
33
|
+
|
|
34
|
+
public ValueCurveInterpolator<TData> interpolator;
|
|
35
|
+
|
|
36
|
+
protected override void ApplyRatio (float ratio)
|
|
37
|
+
{
|
|
38
|
+
TData value = interpolator.ApplyRatio (ratio);
|
|
39
|
+
Apply (value);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
protected abstract void Apply (TData value);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using UnityEngine.Playables;
|
|
3
|
+
|
|
4
|
+
namespace AtlasV.Tools.Timeline
|
|
5
|
+
{
|
|
6
|
+
public abstract class ATrackEnterExitBehaviour : PlayableBehaviour
|
|
7
|
+
{
|
|
8
|
+
public ClipInfo clipInfo;
|
|
9
|
+
protected bool _firstFrame = false;
|
|
10
|
+
|
|
11
|
+
protected abstract void OnEnterClip (Playable playable, object playerData);
|
|
12
|
+
protected abstract void OnExitClip (Playable playable);
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
private object _objectData;
|
|
16
|
+
|
|
17
|
+
public override void ProcessFrame (Playable playable, FrameData info, object playerData)
|
|
18
|
+
{
|
|
19
|
+
_objectData = playerData;
|
|
20
|
+
if ( _firstFrame == false )
|
|
21
|
+
{
|
|
22
|
+
_firstFrame = true;
|
|
23
|
+
OnEnterClip (playable, playerData);
|
|
24
|
+
// Debug.LogWarning (Time.frameCount + ") A::Enter Clip: " + _objectData);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// epsilon is used (and that large) because unity editor doesn't have very good precision when aligning clips together
|
|
29
|
+
private const double epsilon = 0.000000001d;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
public override void OnBehaviourPause (Playable playable, FrameData info)
|
|
33
|
+
{
|
|
34
|
+
|
|
35
|
+
double time = playable.GetTime ();
|
|
36
|
+
double duration = playable.GetDuration ();
|
|
37
|
+
double delta = Math.Abs (duration - time);
|
|
38
|
+
double globalTime = playable.GetGraph ( ).GetRootPlayable ( 0 ).GetTime ( );
|
|
39
|
+
bool outsideClip = globalTime < clipInfo.start || delta < epsilon;
|
|
40
|
+
|
|
41
|
+
if ( _firstFrame && outsideClip )
|
|
42
|
+
{
|
|
43
|
+
// Debug.LogWarning (Time.frameCount + ") A::Exit Clip: " + _objectData);
|
|
44
|
+
OnExitClip (playable);
|
|
45
|
+
_firstFrame = false;
|
|
46
|
+
}
|
|
47
|
+
/*else if (_firstFrame)
|
|
48
|
+
{
|
|
49
|
+
Debug.LogWarning (Time.frameCount + ") A::NOT EXITING Clip: " + _objectData + " -> " + time + "/" + clipInfo.start );
|
|
50
|
+
}*/
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
}
|