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.
Files changed (94) hide show
  1. package/.attestation.p7m +0 -0
  2. package/Editor/AtlasV.Tools.Timeline.Core.Editor.asmdef +20 -0
  3. package/Editor/AtlasV.Tools.Timeline.Core.Editor.asmdef.meta +7 -0
  4. package/Editor/Common/AutoNameClipEditor.cs +24 -0
  5. package/Editor/Common/AutoNameClipEditor.cs.meta +2 -0
  6. package/Editor/Common/InterpolateParamClipEditor.cs +24 -0
  7. package/Editor/Common/InterpolateParamClipEditor.cs.meta +2 -0
  8. package/Editor/Common.meta +8 -0
  9. package/Editor/InterpolationParam/AInterpolateControlTrackWithSourceEditor.cs +33 -0
  10. package/Editor/InterpolationParam/AInterpolateControlTrackWithSourceEditor.cs.meta +2 -0
  11. package/Editor/InterpolationParam/GlobalShaderParamControlCilpEditors.cs +35 -0
  12. package/Editor/InterpolationParam/GlobalShaderParamControlCilpEditors.cs.meta +2 -0
  13. package/Editor/InterpolationParam/ShaderParamControlClipEditors.cs +35 -0
  14. package/Editor/InterpolationParam/ShaderParamControlClipEditors.cs.meta +2 -0
  15. package/Editor/InterpolationParam/ShaderParamControlTrackEditor.cs +11 -0
  16. package/Editor/InterpolationParam/ShaderParamControlTrackEditor.cs.meta +2 -0
  17. package/Editor/InterpolationParam.meta +8 -0
  18. package/Editor/Tools/SelectAndLockTimeline.cs +151 -0
  19. package/Editor/Tools/SelectAndLockTimeline.cs.meta +2 -0
  20. package/Editor/Tools.meta +8 -0
  21. package/Editor.meta +8 -0
  22. package/Runtime/AtlasV.Tools.Timeline.Core.Runtime.asmdef +17 -0
  23. package/Runtime/AtlasV.Tools.Timeline.Core.Runtime.asmdef.meta +7 -0
  24. package/Runtime/Common/AClipInfoTrack.cs +30 -0
  25. package/Runtime/Common/AClipInfoTrack.cs.meta +2 -0
  26. package/Runtime/Common/AClipWithInfo.cs +9 -0
  27. package/Runtime/Common/AClipWithInfo.cs.meta +2 -0
  28. package/Runtime/Common/AInterpolateControlClip.cs +24 -0
  29. package/Runtime/Common/AInterpolateControlClip.cs.meta +2 -0
  30. package/Runtime/Common/AInterpolatorPlayable.cs +44 -0
  31. package/Runtime/Common/AInterpolatorPlayable.cs.meta +2 -0
  32. package/Runtime/Common/ATrackEnterExitBehaviour.cs +54 -0
  33. package/Runtime/Common/ATrackEnterExitBehaviour.cs.meta +2 -0
  34. package/Runtime/Common/ClipInfo.cs +8 -0
  35. package/Runtime/Common/ClipInfo.cs.meta +2 -0
  36. package/Runtime/Common/IClipAutoName.cs +10 -0
  37. package/Runtime/Common/IClipAutoName.cs.meta +2 -0
  38. package/Runtime/Common/ValueCurveInterpolator.cs +114 -0
  39. package/Runtime/Common/ValueCurveInterpolator.cs.meta +2 -0
  40. package/Runtime/Common.meta +8 -0
  41. package/Runtime/GlobalShader/AGlobalShaderParamClip.cs +75 -0
  42. package/Runtime/GlobalShader/AGlobalShaderParamClip.cs.meta +2 -0
  43. package/Runtime/GlobalShader/GlobalShaderParamControlClipColor.cs +16 -0
  44. package/Runtime/GlobalShader/GlobalShaderParamControlClipColor.cs.meta +2 -0
  45. package/Runtime/GlobalShader/GlobalShaderParamControlClipFloat.cs +18 -0
  46. package/Runtime/GlobalShader/GlobalShaderParamControlClipFloat.cs.meta +2 -0
  47. package/Runtime/GlobalShader/GlobalShaderParamControlClipHDRColor.cs +17 -0
  48. package/Runtime/GlobalShader/GlobalShaderParamControlClipHDRColor.cs.meta +2 -0
  49. package/Runtime/GlobalShader/GlobalShaderParamControlClipVector2.cs +17 -0
  50. package/Runtime/GlobalShader/GlobalShaderParamControlClipVector2.cs.meta +2 -0
  51. package/Runtime/GlobalShader/GlobalShaderParamControlClipVector3.cs +17 -0
  52. package/Runtime/GlobalShader/GlobalShaderParamControlClipVector3.cs.meta +2 -0
  53. package/Runtime/GlobalShader/GlobalShaderParamControlClipVector4.cs +18 -0
  54. package/Runtime/GlobalShader/GlobalShaderParamControlClipVector4.cs.meta +2 -0
  55. package/Runtime/GlobalShader/GlobalShaderParamPlayable.cs +24 -0
  56. package/Runtime/GlobalShader/GlobalShaderParamPlayable.cs.meta +2 -0
  57. package/Runtime/GlobalShader/GlobalShaderParamTrack.cs +35 -0
  58. package/Runtime/GlobalShader/GlobalShaderParamTrack.cs.meta +2 -0
  59. package/Runtime/GlobalShader.meta +8 -0
  60. package/Runtime/InterpolationParam/AInterpolateControlClipDataProvider.cs +34 -0
  61. package/Runtime/InterpolationParam/AInterpolateControlClipDataProvider.cs.meta +2 -0
  62. package/Runtime/InterpolationParam/AInterpolateControlTrackDataProvider.cs +40 -0
  63. package/Runtime/InterpolationParam/AInterpolateControlTrackDataProvider.cs.meta +2 -0
  64. package/Runtime/InterpolationParam/AInterpolateControlTrackWithSource.cs +42 -0
  65. package/Runtime/InterpolationParam/AInterpolateControlTrackWithSource.cs.meta +2 -0
  66. package/Runtime/InterpolationParam/AInterpolatePlayableDataProvider.cs +39 -0
  67. package/Runtime/InterpolationParam/AInterpolatePlayableDataProvider.cs.meta +2 -0
  68. package/Runtime/InterpolationParam.meta +8 -0
  69. package/Runtime/Material/MaterialParamControlTrack.cs +28 -0
  70. package/Runtime/Material/MaterialParamControlTrack.cs.meta +2 -0
  71. package/Runtime/Material/ShaderParamControlClip.cs +57 -0
  72. package/Runtime/Material/ShaderParamControlClip.cs.meta +2 -0
  73. package/Runtime/Material/ShaderParamControlClipColor.cs +15 -0
  74. package/Runtime/Material/ShaderParamControlClipColor.cs.meta +2 -0
  75. package/Runtime/Material/ShaderParamControlClipFloat.cs +19 -0
  76. package/Runtime/Material/ShaderParamControlClipFloat.cs.meta +2 -0
  77. package/Runtime/Material/ShaderParamControlClipHDRColor.cs +15 -0
  78. package/Runtime/Material/ShaderParamControlClipHDRColor.cs.meta +2 -0
  79. package/Runtime/Material/ShaderParamControlClipVector2.cs +16 -0
  80. package/Runtime/Material/ShaderParamControlClipVector2.cs.meta +2 -0
  81. package/Runtime/Material/ShaderParamControlClipVector3.cs +16 -0
  82. package/Runtime/Material/ShaderParamControlClipVector3.cs.meta +2 -0
  83. package/Runtime/Material/ShaderParamControlClipVector4.cs +17 -0
  84. package/Runtime/Material/ShaderParamControlClipVector4.cs.meta +2 -0
  85. package/Runtime/Material/ShaderParamControlTrack.cs +33 -0
  86. package/Runtime/Material/ShaderParamControlTrack.cs.meta +2 -0
  87. package/Runtime/Material/ShaderParamPlayable.cs +10 -0
  88. package/Runtime/Material/ShaderParamPlayable.cs.meta +2 -0
  89. package/Runtime/Material/SkyboxParamControlTrack.cs +30 -0
  90. package/Runtime/Material/SkyboxParamControlTrack.cs.meta +2 -0
  91. package/Runtime/Material.meta +8 -0
  92. package/Runtime.meta +8 -0
  93. package/package.json +28 -0
  94. package/package.json.meta +7 -0
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,7 @@
1
+ fileFormatVersion: 2
2
+ guid: acc49ff4a3700f14aa3de4ee55a4f9b4
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -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,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 78dd83d81b25ead4986b1d1de63692d1
@@ -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,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 980d417020fc0bc41b1d22f60050b3e3
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 3cb798a2af12e734192d5ea1319202de
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -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,2 @@
1
+ fileFormatVersion: 2
2
+ guid: b253de484f768844b957ba69d853f980
@@ -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,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 99f7eb22e355f9c41ae1941bd5117359
@@ -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,2 @@
1
+ fileFormatVersion: 2
2
+ guid: af2538902b8332346bae1b7a882c639d
@@ -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,2 @@
1
+ fileFormatVersion: 2
2
+ guid: c5c657b2b466c3540aba1bee48f3261b
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: ab25e1f5cfe7fb04e8e35d7492a654c1
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: d9263a1f54077cc47bcb2c4496fd1f35
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 991cb5fb0655e5f4dbcfe61c74614df6
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
package/Editor.meta ADDED
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: e433e20a950788143bee40e47b59fd66
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -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,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 370df0095b71ed0438fa74206900dee0
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -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,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 8512d6c9a2ee58d45a3618f91ecdd2aa
@@ -0,0 +1,9 @@
1
+ using UnityEngine.Playables;
2
+
3
+ namespace AtlasV.Tools.Timeline
4
+ {
5
+ public abstract class AClipWithInfo : PlayableAsset
6
+ {
7
+ public ClipInfo clipInfo;
8
+ }
9
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 04c7570f97d0a7041a41bbf64b42ec40
@@ -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,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 64a1bbe1d1c24ac4489b31a544cf04bf
@@ -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,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 9417185561a55eb4dba92f9e553c475b
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 5b8382bb49d23c147a380dc75b72a885
@@ -0,0 +1,8 @@
1
+ namespace AtlasV.Tools.Timeline
2
+ {
3
+ public class ClipInfo
4
+ {
5
+ public double start, end;
6
+ public double duration => end - start;
7
+ }
8
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 79928ade5eec1724eaa6cf8fb83b8bbf
@@ -0,0 +1,10 @@
1
+ namespace AtlasV.Tools.Timeline
2
+ {
3
+ public interface IClipAutoName
4
+ {
5
+ public string autoName
6
+ {
7
+ get;
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 23cff43584ee93c41932556b02f6cb4d