-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afe2674
commit 1587c56
Showing
9 changed files
with
138 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
AlembicImporter/Assets/UTJ/AlembicImporter/Scripts/Timeline.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
66 changes: 66 additions & 0 deletions
66
AlembicImporter/Assets/UTJ/AlembicImporter/Scripts/Timeline/AlembicShotAsset.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#if ENABLE_TIMELINE | ||
|
||
using System; | ||
using UnityEngine; | ||
using UnityEngine.Playables; | ||
using UnityEngine.Timeline; | ||
|
||
namespace UTJ.Alembic | ||
{ | ||
public class AlembicShotAsset : PlayableAsset, ITimelineClipAsset | ||
{ | ||
AlembicStreamPlayer m_Stream; | ||
|
||
[Tooltip("Alambic asset to play")] | ||
public ExposedReference<AlembicStreamPlayer> m_StreamPlayer; | ||
|
||
[Tooltip("Amount of time to clip off the start of the alembic asset from playback.")] | ||
[SerializeField] public float m_StartOffset; | ||
|
||
[Tooltip("Amount of time to clip off the end of the alembic asset from playback.")] | ||
[SerializeField] public float m_EndOffset; | ||
|
||
[Tooltip("Use to compress/dilute time play back.")] | ||
[SerializeField] public float m_TimeScale = 1f; | ||
|
||
[Tooltip("Controls how playback cycles throught the stream.")] | ||
[SerializeField] public AlembicPlaybackSettings.CycleType m_Cycle = AlembicPlaybackSettings.CycleType.Hold; | ||
|
||
[Tooltip("Portion, in seconds, of the alembic stream used by the shot.")] | ||
[ReadOnly] public float m_AlembicLength = 0; | ||
|
||
public ClipCaps clipCaps { get { return ClipCaps.None; } } | ||
|
||
public override PlayableHandle CreatePlayable(PlayableGraph graph, GameObject owner) | ||
{ | ||
var handle = graph.CreateScriptPlayable<AlembicShotPlayable>(); | ||
|
||
var playable = handle.GetObject<AlembicShotPlayable>(); | ||
m_Stream = m_StreamPlayer.Resolve(graph.resolver); | ||
playable.streamPlayer = m_Stream; | ||
playable.m_StartTimeOffset = m_StartOffset; | ||
playable.m_EndTimeClipOff = m_EndOffset; | ||
playable.m_TimeScale = m_TimeScale; | ||
playable.m_Cycle = m_Cycle; | ||
return handle; | ||
} | ||
|
||
public override double duration | ||
{ | ||
get | ||
{ | ||
var t = m_Stream == null ? 0 : m_Stream.m_PlaybackSettings.m_duration; | ||
m_AlembicLength = t; | ||
if (m_Cycle == AlembicPlaybackSettings.CycleType.Hold || m_Cycle == AlembicPlaybackSettings.CycleType.Reverse) | ||
return (t - m_StartOffset - m_EndOffset) * m_TimeScale; | ||
else | ||
{ | ||
return base.duration; | ||
} | ||
} | ||
} | ||
|
||
} | ||
} | ||
|
||
#endif |
12 changes: 12 additions & 0 deletions
12
AlembicImporter/Assets/UTJ/AlembicImporter/Scripts/Timeline/AlembicShotAsset.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
AlembicImporter/Assets/UTJ/AlembicImporter/Scripts/Timeline/AlembicShotPlayable.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
AlembicImporter/Assets/UTJ/AlembicImporter/Scripts/Timeline/AlembicTrack.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#if ENABLE_TIMELINE | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UnityEngine.Playables; | ||
using UnityEngine.Timeline; | ||
|
||
namespace UTJ.Alembic | ||
{ | ||
[System.Serializable] | ||
[TrackClipType(typeof(AlembicShotAsset))] | ||
[TrackMediaType(TimelineAsset.MediaType.Script)] | ||
[TrackColor(0.53f, 0.0f, 0.08f)] | ||
public class AlembicTrack : TrackAsset | ||
{ | ||
} | ||
} | ||
|
||
#endif |
12 changes: 12 additions & 0 deletions
12
AlembicImporter/Assets/UTJ/AlembicImporter/Scripts/Timeline/AlembicTrack.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.