Skip to content

Commit

Permalink
JIRA: ABC-239 NullReferenceException when adding AlembicStreamPlayer …
Browse files Browse the repository at this point in the history
…component (#460) (#463)
  • Loading branch information
clusty authored Aug 10, 2021
1 parent 4f37b0b commit ff3be13
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions com.unity.formats.alembic/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
### Changed
### Fixed
- Fixed a bug that caused an error when manually adding an AlembicStreamPlayer Component.

## [2.2.0] - 2021-06-10
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,15 +350,18 @@ void LateUpdate()
if (!updateStarted && lastUpdateTime != currentTime)
Update();

if (!updateStarted)
if (!updateStarted && abcStream != null)
{
// If the model did not move this frame, we need to clear the motion vectors to avoid post processing artefacts.
abcStream.ClearMotionVectors();
return;
}

updateStarted = false;
abcStream.AbcUpdateEnd();
if (abcStream != null)
{
abcStream.AbcUpdateEnd();
}
}

void OnEnable()
Expand Down
11 changes: 11 additions & 0 deletions com.unity.formats.alembic/Tests/Editor/EditorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -357,5 +357,16 @@ public void VertexAttributes_AreSplitCorrectly()
Assert.AreEqual(expectedColours.Count, mesh.colors32.Length);
Assert.IsTrue(diff.All(x => x < 1e-5));
}

[UnityTest]
public IEnumerator EmptyStreamPlayer_DoesNotAssert()
{
var go = new GameObject();
go.AddComponent<AlembicStreamPlayer>();

yield return null;

Assert.IsTrue(true); // should not have Thrown exceptions
}
}
}

0 comments on commit ff3be13

Please sign in to comment.