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
@@ -0,0 +1,114 @@
1
+ using System;
2
+ using UnityEngine;
3
+ using UnityEngine.Serialization;
4
+
5
+ namespace AtlasV.Tools.Timeline
6
+ {
7
+ public abstract class ValueCurveInterpolator<T>
8
+ {
9
+
10
+ public AnimationCurve curve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
11
+
12
+ public abstract T Lerp (float time);
13
+
14
+ public T ApplyRatio (float ratio)
15
+ {
16
+ float curveRatio = curve.Evaluate(ratio);
17
+ return Lerp (curveRatio);
18
+ }
19
+ }
20
+
21
+ [Serializable]
22
+ public class ColorCurveInterpolator : ValueCurveInterpolator<Color>
23
+ {
24
+
25
+ public Color from;
26
+ public Color to;
27
+
28
+ public override Color Lerp (float time)
29
+ {
30
+ return Color.Lerp (from, to, time);
31
+ }
32
+ }
33
+
34
+ [Serializable]
35
+ public class HDRColorCurveInterpolator : ValueCurveInterpolator<Color>
36
+ {
37
+ [ColorUsage (true, true)]
38
+ public Color from;
39
+ [ColorUsage (true, true)]
40
+ public Color to;
41
+
42
+ public override Color Lerp (float time)
43
+ {
44
+ return Color.Lerp (from, to, time);
45
+ }
46
+ }
47
+
48
+ [Serializable]
49
+ public class FloatCurveInterpolator : ValueCurveInterpolator<float>
50
+ {
51
+
52
+ public float from;
53
+ public float to;
54
+
55
+
56
+ public override float Lerp (float time)
57
+ {
58
+ return Mathf.Lerp (from, to, time);
59
+ }
60
+ }
61
+
62
+ [Serializable]
63
+ public class Vector2CurveInterpolator : ValueCurveInterpolator<Vector2>
64
+ {
65
+ public Vector2 from;
66
+ public Vector2 to;
67
+
68
+
69
+ public override Vector2 Lerp (float time)
70
+ {
71
+ return Vector2.Lerp (from, to, time);
72
+ }
73
+ }
74
+
75
+ [Serializable]
76
+ public class Vector3CurveInterpolator : ValueCurveInterpolator<Vector3>
77
+ {
78
+
79
+ public Vector3 from;
80
+ public Vector3 to;
81
+
82
+
83
+ public override Vector3 Lerp (float time)
84
+ {
85
+ return Vector3.Lerp (from, to, time);
86
+ }
87
+ }
88
+
89
+ [Serializable]
90
+ public class QuaternionCurveInterpolator : ValueCurveInterpolator<Quaternion>
91
+ {
92
+
93
+ public Quaternion from;
94
+ public Quaternion to;
95
+
96
+
97
+ public override Quaternion Lerp (float time)
98
+ {
99
+ return Quaternion.Slerp (from, to, time);
100
+ }
101
+ }
102
+
103
+ [Serializable]
104
+ public class Vector4CurveInterpolator : ValueCurveInterpolator<Vector4>
105
+ {
106
+ public Vector4 from;
107
+ public Vector4 to;
108
+
109
+ public override Vector4 Lerp (float time)
110
+ {
111
+ return Vector4.Lerp (from, to, time);
112
+ }
113
+ }
114
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: a2fa02ed3ae8db74380f07ee29fb3c0a
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 684d724f064ddbf4da85acded0247e1f
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,75 @@
1
+ using UnityEngine;
2
+ using UnityEngine.Playables;
3
+ using UnityEngine.Timeline;
4
+
5
+ namespace AtlasV.Tools.Timeline
6
+ {
7
+
8
+
9
+ public abstract class AGlobalShaderParamClip: PlayableAsset, IClipAutoName, ITimelineClipAsset
10
+ {
11
+
12
+ public string paramName;
13
+
14
+ protected int _parameterId = -1;
15
+
16
+ protected bool parameterValid => _parameterId != -1;
17
+
18
+
19
+
20
+ protected void OnParameterChanged ()
21
+ {
22
+ if ( string.IsNullOrEmpty (paramName) == false )
23
+ {
24
+ _parameterId = Shader.PropertyToID (paramName);
25
+ }
26
+ }
27
+
28
+
29
+ public void CheckParamName ()
30
+ {
31
+
32
+ if ( string.IsNullOrEmpty (paramName) )
33
+ {
34
+ _parameterId = -1;
35
+ }
36
+ else if ( parameterValid == false )
37
+ {
38
+ _parameterId = Shader.PropertyToID (paramName);
39
+ }
40
+
41
+ }
42
+
43
+ public string autoName => paramName;
44
+
45
+ public ClipInfo clipInfo;
46
+
47
+ public ClipCaps clipCaps
48
+ {
49
+ get
50
+ {
51
+ return ClipCaps.ClipIn | ClipCaps.Extrapolation | ClipCaps.Looping | ClipCaps.SpeedMultiplier;
52
+ }
53
+ }
54
+
55
+ public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
56
+ {
57
+ GlobalShaderParamPlayable behaviour = new GlobalShaderParamPlayable ()
58
+ {
59
+ interpolator = this,
60
+ clipInfo = clipInfo,
61
+ };
62
+
63
+ Playable playable = ScriptPlayable <GlobalShaderParamPlayable>.Create ( graph, behaviour );
64
+ return playable;
65
+ }
66
+
67
+ public abstract void Apply (float ratio);
68
+ }
69
+
70
+ public abstract class AGlobalShaderParamClip<TInterpolator> : AGlobalShaderParamClip
71
+ {
72
+ public TInterpolator values;
73
+ }
74
+
75
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: a3b07b443e7652a4dba9fcb78a39e578
@@ -0,0 +1,16 @@
1
+ using UnityEngine;
2
+
3
+ namespace AtlasV.Tools.Timeline
4
+ {
5
+ public class GlobalShaderParamControlClipColor : AGlobalShaderParamClip<ColorCurveInterpolator>
6
+ {
7
+ public override void Apply (float ratio)
8
+ {
9
+ CheckParamName ();
10
+
11
+ Color color = values.ApplyRatio (ratio);
12
+ Shader.SetGlobalColor (_parameterId, color);
13
+ }
14
+ }
15
+
16
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 7e00ef9144e87ff488eba8697d2be0a8
@@ -0,0 +1,18 @@
1
+ using UnityEngine;
2
+
3
+ namespace AtlasV.Tools.Timeline
4
+ {
5
+ public class GlobalShaderParamControlClipFloat : AGlobalShaderParamClip<FloatCurveInterpolator>
6
+ {
7
+ public override void Apply (float ratio)
8
+ {
9
+
10
+ CheckParamName ();
11
+
12
+ float value = values.ApplyRatio (ratio);
13
+ Shader.SetGlobalFloat (_parameterId, value);
14
+ }
15
+
16
+ }
17
+
18
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: bde43a3aabf586547979f70fffa87373
@@ -0,0 +1,17 @@
1
+ using UnityEngine;
2
+
3
+ namespace AtlasV.Tools.Timeline
4
+ {
5
+
6
+ public class GlobalShaderParamControlClipHDRColor : AGlobalShaderParamClip<HDRColorCurveInterpolator>
7
+ {
8
+ public override void Apply (float ratio)
9
+ {
10
+ CheckParamName ();
11
+
12
+ Color color = values.ApplyRatio (ratio);
13
+ Shader.SetGlobalColor (_parameterId, color);
14
+ }
15
+ }
16
+
17
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 56c11e01a7801944385a5cacdc4108e3
@@ -0,0 +1,17 @@
1
+ using UnityEngine;
2
+
3
+ namespace AtlasV.Tools.Timeline
4
+ {
5
+ public class GlobalShaderParamControlClipVector2 : AGlobalShaderParamClip<Vector2CurveInterpolator>
6
+ {
7
+ public override void Apply (float ratio)
8
+ {
9
+ CheckParamName ();
10
+
11
+ var value = values.ApplyRatio (ratio);
12
+ Shader.SetGlobalVector (_parameterId, value);
13
+ }
14
+
15
+ }
16
+
17
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 19152b82336a4fb48bb11d37e553ecd2
@@ -0,0 +1,17 @@
1
+ using UnityEngine;
2
+
3
+ namespace AtlasV.Tools.Timeline
4
+ {
5
+ public class GlobalShaderParamControlClipVector3 : AGlobalShaderParamClip<Vector3CurveInterpolator>
6
+ {
7
+ public override void Apply (float ratio)
8
+ {
9
+ CheckParamName ();
10
+
11
+ var value = values.ApplyRatio (ratio);
12
+ Shader.SetGlobalVector (_parameterId, value);
13
+ }
14
+
15
+ }
16
+
17
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: a7ba8380702a1b740917a2a0ca8c1d03
@@ -0,0 +1,18 @@
1
+ using UnityEngine;
2
+
3
+ namespace AtlasV.Tools.Timeline
4
+ {
5
+
6
+ public class GlobalShaderParamControlClipVector4 : AGlobalShaderParamClip<Vector4CurveInterpolator>
7
+ {
8
+ public override void Apply (float ratio)
9
+ {
10
+ CheckParamName ();
11
+
12
+ var value = values.ApplyRatio (ratio);
13
+ Shader.SetGlobalVector (_parameterId, value);
14
+ }
15
+
16
+ }
17
+
18
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: b66e3a37a9470c2408a88b6b3a9c69c8
@@ -0,0 +1,24 @@
1
+ using UnityEngine.Playables;
2
+
3
+ namespace AtlasV.Tools.Timeline
4
+ {
5
+
6
+ public class GlobalShaderParamPlayable : PlayableBehaviour
7
+ {
8
+ public AGlobalShaderParamClip interpolator;
9
+ public ClipInfo clipInfo;
10
+
11
+ public override void ProcessFrame (Playable playable, FrameData info, object playerData)
12
+ {
13
+
14
+ if ( interpolator == null || clipInfo == null )
15
+ return;
16
+
17
+ double time = playable.GetTime ( );
18
+ double ratio = time / clipInfo.duration;
19
+ float ratioF = (float) ratio;
20
+
21
+ interpolator.Apply (ratioF);
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: ccfdbb2a4d312f84fb96cf065bae81bd
@@ -0,0 +1,35 @@
1
+ using UnityEngine;
2
+ using UnityEngine.Playables;
3
+ using UnityEngine.Timeline;
4
+
5
+ namespace AtlasV.Tools.Timeline
6
+ {
7
+ [TrackColor (0f, 0.9811321f, 0.8742357f)]
8
+ [TrackClipType (typeof (GlobalShaderParamControlClipFloat))]
9
+ [TrackClipType (typeof (GlobalShaderParamControlClipColor))]
10
+ [TrackClipType (typeof (GlobalShaderParamControlClipHDRColor))]
11
+ [TrackClipType (typeof (GlobalShaderParamControlClipVector2))]
12
+ [TrackClipType (typeof (GlobalShaderParamControlClipVector3))]
13
+ [TrackClipType (typeof (GlobalShaderParamControlClipVector4))]
14
+ public class GlobalShaderParamTrack : TrackAsset
15
+ {
16
+ public override Playable CreateTrackMixer (PlayableGraph graph, GameObject go, int inputCount)
17
+ {
18
+
19
+ foreach ( var clip in GetClips () )
20
+ {
21
+ if ( clip.asset is AGlobalShaderParamClip controlClip )
22
+ {
23
+ controlClip.clipInfo = new ClipInfo ()
24
+ {
25
+ start = clip.start,
26
+ end = clip.end
27
+ };
28
+ }
29
+
30
+ }
31
+
32
+ return base.CreateTrackMixer (graph, go, inputCount);
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 95f9a8dfcbc41b24f98db09bbaad3ab0
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 5fa6e03f62279e44aacc3f1f3a8d474f
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,34 @@
1
+ using UnityEngine;
2
+ using UnityEngine.Playables;
3
+
4
+ namespace AtlasV.Tools.Timeline
5
+ {
6
+
7
+
8
+ public interface IRuntimeInterpolator<TData> where TData : UnityEngine.Object
9
+ {
10
+ public void Apply (TData data, float ratio);
11
+ }
12
+
13
+ public abstract class AInterpolateControlClipDataProvider<TData, TPlayable> : AClipWithInfo, IRuntimeInterpolator<TData>
14
+ where TData : UnityEngine.Object
15
+ where TPlayable: AInterpolatePlayableDataProvider<TData>, new()
16
+ {
17
+ public ITimelineDataProvider<TData> dataHolder;
18
+
19
+ public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
20
+ {
21
+ TPlayable behaviour = new TPlayable ()
22
+ {
23
+ interpolator = this,
24
+ clipInfo = clipInfo,
25
+ dataHolder = dataHolder
26
+ };
27
+
28
+ Playable playable = ScriptPlayable <TPlayable>.Create ( graph, behaviour );
29
+ return playable;
30
+ }
31
+
32
+ public abstract void Apply (TData data, float ratio);
33
+ }
34
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: f2ec4ea421eaf53499516f67af11ae7f
@@ -0,0 +1,40 @@
1
+ using System.Collections.Generic;
2
+ using UnityEngine;
3
+ using UnityEngine.Playables;
4
+ using UnityEngine.Timeline;
5
+
6
+ namespace AtlasV.Tools.Timeline
7
+ {
8
+
9
+ public interface ITimelineDataProvider<T> where T : Object
10
+ {
11
+ public List<T> GetTrackedObject (Object userData);
12
+ }
13
+
14
+ public abstract class AInterpolateControlTrackDataProvider<TData, TPlayable> : TrackAsset, ITimelineDataProvider<TData>
15
+ where TData : UnityEngine.Object
16
+ where TPlayable : AInterpolatePlayableDataProvider<TData>, new()
17
+ {
18
+ public abstract List<TData> GetTrackedObject (Object userData);
19
+
20
+ public override Playable CreateTrackMixer (PlayableGraph graph, GameObject go, int inputCount)
21
+ {
22
+
23
+ foreach ( var clip in GetClips () )
24
+ {
25
+ if ( clip.asset is AInterpolateControlClipDataProvider<TData, TPlayable> controlClip )
26
+ {
27
+ controlClip.clipInfo = new ClipInfo ()
28
+ {
29
+ start = clip.start,
30
+ end = clip.end
31
+ };
32
+ controlClip.dataHolder = this;
33
+ }
34
+
35
+ }
36
+
37
+ return base.CreateTrackMixer (graph, go, inputCount);
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 55e19101ba302c24bbb510995690dacc
@@ -0,0 +1,42 @@
1
+ using System.Collections.Generic;
2
+ using UnityEngine;
3
+
4
+ namespace AtlasV.Tools.Timeline
5
+ {
6
+ public abstract class AInterpolateControlTrackWithSource<TData, TPlayable> : AInterpolateControlTrackDataProvider<TData, TPlayable>
7
+ where TData : UnityEngine.Object
8
+ where TPlayable : AInterpolatePlayableDataProvider<TData>, new()
9
+ {
10
+
11
+ protected List<TData> _toApply;
12
+ protected GameObject _source;
13
+ protected bool _appRunning = false;
14
+
15
+ public int count => _toApply != null ? _toApply.Count : 0;
16
+
17
+
18
+ public override List<TData> GetTrackedObject (Object userData)
19
+ {
20
+ var go = userData as GameObject;
21
+
22
+ if ( _toApply != null && _toApply.Count > 0 && _source == go && _appRunning == Application.isPlaying )
23
+ {
24
+ _toApply.RemoveAll (m => m == null);
25
+
26
+ if ( _toApply.Count > 0 )
27
+ return _toApply;
28
+ }
29
+ if ( go == null )
30
+ {
31
+ return null;
32
+ }
33
+ _appRunning = Application.isPlaying;
34
+ _source = go;
35
+
36
+ _toApply = GatherData (_source);
37
+ return _toApply;
38
+ }
39
+
40
+ protected abstract List<TData> GatherData (GameObject source);
41
+ }
42
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 910ab8c6f6c66e046ab8740cb78a6e56
@@ -0,0 +1,39 @@
1
+ using System.Collections.Generic;
2
+ using UnityEngine;
3
+ using UnityEngine.Playables;
4
+
5
+ namespace AtlasV.Tools.Timeline
6
+ {
7
+
8
+ public abstract class AInterpolatePlayableDataProvider<TData> : PlayableBehaviour
9
+ where TData: Object
10
+ {
11
+ public IRuntimeInterpolator<TData> interpolator;
12
+ public ITimelineDataProvider<TData> dataHolder;
13
+ public ClipInfo clipInfo;
14
+
15
+
16
+ public override void ProcessFrame (Playable playable, FrameData info, object playerData)
17
+ {
18
+
19
+ if ( dataHolder == null || interpolator == null || clipInfo == null)
20
+ return;
21
+
22
+ List<TData> toApply = dataHolder.GetTrackedObject (info.output.GetUserData ());
23
+
24
+ if ( toApply == null )
25
+ return;
26
+
27
+ double time = playable.GetTime ( );
28
+ double ratio = time / clipInfo.duration;
29
+ float ratioF = (float) ratio;
30
+
31
+ foreach ( var data in toApply )
32
+ {
33
+ interpolator.Apply (data, ratioF);
34
+ }
35
+
36
+
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 527a60d8391b3fd44b7040de8f0d04ee
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 21e076a13d92bc944883db550b334682
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,28 @@
1
+ using System.Collections.Generic;
2
+ using UnityEngine;
3
+ using UnityEngine.Timeline;
4
+
5
+ namespace AtlasV.Tools.Timeline
6
+ {
7
+ [TrackBindingType (typeof (Material))]
8
+ [TrackClipType (typeof (ShaderParamControlClipFloat))]
9
+ [TrackClipType (typeof (ShaderParamControlClipColor))]
10
+ [TrackClipType (typeof (ShaderParamControlClipVector2))]
11
+ [TrackClipType (typeof (ShaderParamControlClipVector3))]
12
+ [TrackClipType (typeof (ShaderParamControlClipVector4))]
13
+ [TrackColor (0.3639196f, 0.8867924f, 0.4580367f)]
14
+ public class MaterialParamControlTrack : AInterpolateControlTrackDataProvider<Material, ShaderParamPlayable>, ITimelineDataProvider<Material>
15
+ {
16
+ public override List<Material> GetTrackedObject (Object userData)
17
+ {
18
+ if (userData is Material)
19
+ {
20
+ return new List<Material> ()
21
+ {
22
+ userData as Material
23
+ };
24
+ }
25
+ return null;
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 64c272b71bc6d9a40988e9263318d84b