Skip to content

Commit

Permalink
improve compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
i-saint committed Jan 31, 2018
1 parent 37cefd0 commit 4de1ad0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public class AlembicStreamDescriptor : ScriptableObject
[SerializeField] public AlembicStreamSettings settings = new AlembicStreamSettings();
[SerializeField] public bool hasVaryingTopology = false;
[SerializeField] public bool hasAcyclicFramerate = false;
[SerializeField] public double abcStartTime = 0.0f;
[SerializeField] public double abcEndTime = 0.0f;
[SerializeField] public double abcStartTime = double.MinValue;
[SerializeField] public double abcEndTime = double.MaxValue;

public double duration { get { return abcEndTime - abcStartTime; } }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,19 @@ public class AlembicStreamPlayer : MonoBehaviour

public double duration { get { return m_endTime - m_startTime; } }

void Start()
{
OnValidate();
}

void OnValidate()
{
if (streamDescriptor == null) return;
if (streamDescriptor == null || m_stream == null)
return;
if (streamDescriptor.abcStartTime == double.MinValue)
streamDescriptor.abcStartTime = m_stream.abcTimeRange.startTime;
if (streamDescriptor.abcEndTime == double.MaxValue)
streamDescriptor.abcEndTime = m_stream.abcTimeRange.endTime;
m_startTime = Mathf.Clamp((float)m_startTime, (float)streamDescriptor.abcStartTime, (float)streamDescriptor.abcEndTime);
m_endTime = Mathf.Clamp((float)m_endTime, (float)m_startTime, (float)streamDescriptor.abcEndTime);
ClampTime();
Expand Down

0 comments on commit 4de1ad0

Please sign in to comment.