Skip to content

Commit 4de1ad0

Browse files
author
i-saint
committed
improve compatibility
1 parent 37cefd0 commit 4de1ad0

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

AlembicImporter/Assets/UTJ/Alembic/Scripts/Importer/AlembicStreamDescriptor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ public class AlembicStreamDescriptor : ScriptableObject
99
[SerializeField] public AlembicStreamSettings settings = new AlembicStreamSettings();
1010
[SerializeField] public bool hasVaryingTopology = false;
1111
[SerializeField] public bool hasAcyclicFramerate = false;
12-
[SerializeField] public double abcStartTime = 0.0f;
13-
[SerializeField] public double abcEndTime = 0.0f;
12+
[SerializeField] public double abcStartTime = double.MinValue;
13+
[SerializeField] public double abcEndTime = double.MaxValue;
1414

1515
public double duration { get { return abcEndTime - abcStartTime; } }
1616
}

AlembicImporter/Assets/UTJ/Alembic/Scripts/Importer/AlembicStreamPlayer.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,19 @@ public class AlembicStreamPlayer : MonoBehaviour
1818

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

21+
void Start()
22+
{
23+
OnValidate();
24+
}
25+
2126
void OnValidate()
2227
{
23-
if (streamDescriptor == null) return;
28+
if (streamDescriptor == null || m_stream == null)
29+
return;
30+
if (streamDescriptor.abcStartTime == double.MinValue)
31+
streamDescriptor.abcStartTime = m_stream.abcTimeRange.startTime;
32+
if (streamDescriptor.abcEndTime == double.MaxValue)
33+
streamDescriptor.abcEndTime = m_stream.abcTimeRange.endTime;
2434
m_startTime = Mathf.Clamp((float)m_startTime, (float)streamDescriptor.abcStartTime, (float)streamDescriptor.abcEndTime);
2535
m_endTime = Mathf.Clamp((float)m_endTime, (float)m_startTime, (float)streamDescriptor.abcEndTime);
2636
ClampTime();

0 commit comments

Comments
 (0)