Skip to content

Commit

Permalink
fix: Compilation error when Animation module is disabled and Newtonso…
Browse files Browse the repository at this point in the history
…ft JSON package installed. (#62)
  • Loading branch information
atteneder authored and GitHub Enterprise committed Oct 10, 2023
1 parent dca4051 commit ed06047
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed
- Compilation error when Animation module is disabled and Newtonsoft JSON package installed.

## [6.0.0] - 2023-10-04

### Added
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Scripts/Newtonsoft/Schema/AnimationChannel.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: 2023 Unity Technologies and the glTFast authors
// SPDX-License-Identifier: Apache-2.0

#if NEWTONSOFT_JSON
#if UNITY_ANIMATION && NEWTONSOFT_JSON

using System.Collections.Generic;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: 2023 Unity Technologies and the glTFast authors
// SPDX-License-Identifier: Apache-2.0

#if NEWTONSOFT_JSON
#if UNITY_ANIMATION && NEWTONSOFT_JSON

using System.Collections.Generic;

Expand Down
2 changes: 1 addition & 1 deletion Runtime/Scripts/Newtonsoft/Schema/AnimationSampler.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: 2023 Unity Technologies and the glTFast authors
// SPDX-License-Identifier: Apache-2.0

#if NEWTONSOFT_JSON
#if UNITY_ANIMATION && NEWTONSOFT_JSON

using System.Collections.Generic;

Expand Down
2 changes: 1 addition & 1 deletion Runtime/Scripts/Newtonsoft/Schema/GltfAnimation.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: 2023 Unity Technologies and the glTFast authors
// SPDX-License-Identifier: Apache-2.0

#if NEWTONSOFT_JSON
#if UNITY_ANIMATION && NEWTONSOFT_JSON

using System.Collections.Generic;

Expand Down
5 changes: 5 additions & 0 deletions Runtime/Scripts/Newtonsoft/glTFast.Newtonsoft.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
"autoReferenced": false,
"defineConstraints": [],
"versionDefines": [
{
"name": "com.unity.modules.animation",
"expression": "1.0.0",
"define": "UNITY_ANIMATION"
},
{
"name": "com.unity.nuget.newtonsoft-json",
"expression": "",
Expand Down
4 changes: 4 additions & 0 deletions Tests/Runtime/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ public void CustomExtensionEverywhere()
CertifyCustomExtensions(gltf.accessors[0].sparse.values.extensions);
CertifyCustomExtras(gltf.accessors[0].sparse.values.extras);

#if UNITY_ANIMATION
CertifyCustomData(gltf.animations[0], 43);
CertifyCustomExtensions(gltf.animations[0].extensions);
CertifyCustomExtras(gltf.animations[0].extras);
Expand All @@ -393,6 +394,7 @@ public void CustomExtensionEverywhere()
CertifyCustomData(gltf.animations[0].samplers[0], 431);
CertifyCustomExtensions(gltf.animations[0].samplers[0].extensions);
CertifyCustomExtras(gltf.animations[0].samplers[0].extras);
#endif

CertifyCustomData(gltf.asset, 44);
CertifyCustomExtensions(gltf.asset.extensions);
Expand Down Expand Up @@ -570,8 +572,10 @@ public void CustomExtensionNowhere()
Assert.IsNull(gltf.accessors[0].extras);
Assert.IsNull(gltf.accessors[0].extensions);

#if UNITY_ANIMATION
Assert.IsNull(gltf.animations[0].extras);
Assert.IsNull(gltf.animations[0].extensions);
#endif

Assert.IsNull(gltf.asset.extras);
Assert.IsNull(gltf.asset.extensions);
Expand Down

0 comments on commit ed06047

Please sign in to comment.