Browse Source

fixed runtime animation null exception.
csprojs cleanup

Vicente Penades 6 years ago
parent
commit
65f7385e0e

+ 5 - 1
Analyzers.targets

@@ -2,9 +2,13 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 
   <PropertyGroup>
-    <CodeAnalysisRuleSet>$(MSBUILDTHISFILEDIRECTORY)SharpGLTF.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet>$(MsBuildThisFileDirectory)SharpGLTF.ruleset</CodeAnalysisRuleSet>
   </PropertyGroup>
 
+  <ItemGroup>
+    <AdditionalFiles Include="$(MsBuildThisFileDirectory)stylecop.json" />
+  </ItemGroup>
+
   <ItemGroup>    
     <PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.4" PrivateAssets="all" />
     <PackageReference Include="Microsoft.CodeQuality.Analyzers" Version="2.9.4" PrivateAssets="all" />

+ 4 - 0
src/PackageInfo.props

@@ -13,6 +13,10 @@
     <PackageIconUrl>https://raw.githubusercontent.com/vpenades/SharpGLTF/master/build/Icons/glTF2Sharp.png</PackageIconUrl>
   </PropertyGroup>
 
+  <PropertyGroup>
+    <DocumentationFile>bin\$(Configuration)\$(AssemblyName).xml</DocumentationFile>
+  </PropertyGroup>
+
   <ItemGroup>
     <None Include="$(MsBuildThisFileDirectory)..\LICENSE" Pack="true" PackagePath="" />
   </ItemGroup>

+ 1 - 1
src/SharpGLTF.Core/Runtime/AnimatableProperty.cs

@@ -65,7 +65,7 @@ namespace SharpGLTF.Runtime
 
             if (trackLogicalIndex < 0 || trackLogicalIndex >= _Animations.Count) return this.Value;
 
-            return _Animations[trackLogicalIndex].GetPoint(offset);
+            return _Animations[trackLogicalIndex]?.GetPoint(offset) ?? this.Value;
         }
 
         public void AddCurve(int logicalIndex, string name, ICurveSampler<T> sampler)

+ 7 - 0
src/SharpGLTF.Core/Runtime/SceneTemplate.cs

@@ -53,6 +53,13 @@ namespace SharpGLTF.Runtime
             }
 
             _UsePrecomputed = !(_Scale.IsAnimated | _Rotation.IsAnimated | _Translation.IsAnimated);
+
+            if (_UsePrecomputed)
+            {
+                _Scale = null;
+                _Rotation = null;
+                _Translation = null;
+            }
         }
 
         #endregion

+ 1 - 9
src/SharpGLTF.Core/SharpGLTF.Core.csproj

@@ -11,11 +11,7 @@
   <Import Project="..\Version.props" />
   
   <Import Project="..\PackageInfo.props" />
-
-  <PropertyGroup>
-    <DocumentationFile>bin\Docs\SharpGLTF.xml</DocumentationFile>
-  </PropertyGroup>  
-
+  
   <ItemGroup>
     <Compile Include="..\Shared\Guard.cs" Link="Debug\Guard.cs" />
     <Compile Include="..\Shared\_Extensions.cs" Link="_Extensions.cs" />
@@ -38,10 +34,6 @@
     </None>
   </ItemGroup>
   
-  <ItemGroup>
-    <AdditionalFiles Include="..\..\stylecop.json" />
-  </ItemGroup>
-
   <Import Project="..\..\Analyzers.targets" />
 
 </Project>

+ 1 - 9
src/SharpGLTF.Toolkit/SharpGLTF.Toolkit.csproj

@@ -12,20 +12,12 @@
   <Import Project="..\Version.props" />
 
   <Import Project="..\PackageInfo.props" />
-
-  <PropertyGroup>
-    <DocumentationFile>bin\Docs\SharpGLTF.Toolkit.xml</DocumentationFile>
-  </PropertyGroup>  
   
   <ItemGroup>
     <AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
       <_Parameter1>SharpGLTF.Tests</_Parameter1>
     </AssemblyAttribute>
   </ItemGroup>  
-  
-  <ItemGroup>
-    <AdditionalFiles Include="..\..\stylecop.json" />
-  </ItemGroup>
 
   <ItemGroup>
     <Compile Include="..\Shared\Guard.cs" Link="Debug\Guard.cs" />
@@ -35,7 +27,7 @@
   <ItemGroup>
     <ProjectReference Include="..\SharpGLTF.Core\SharpGLTF.Core.csproj" />
   </ItemGroup>
-
+  
   <Import Project="..\..\Analyzers.targets" />
   
 </Project>