Skip to content

Commit

Permalink
fix nullrefexception when exporting object(s) without anim
Browse files Browse the repository at this point in the history
  • Loading branch information
vkovec committed Jan 22, 2020
1 parent 7c1d5c6 commit ba7982f
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions com.unity.formats.fbx/Editor/FbxExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3482,31 +3482,35 @@ internal int ExportAll (
}
}

foreach (var unityGo in revisedExportSet)
// Export animation if any
if (exportData != null)
{
IExportData iData;
if(!exportData.TryGetValue(unityGo, out iData))
foreach (var unityGo in revisedExportSet)
{
continue;
}
var data = iData as AnimationOnlyExportData;
if(data == null)
{
Debug.LogWarningFormat("FBX Exporter: no animation export data found for {0}", unityGo.name);
continue;
}
// export animation
// export default clip first
if (data.defaultClip != null)
{
var defaultClip = data.defaultClip;
ExportAnimationClip(defaultClip, data.animationClips[defaultClip], fbxScene);
data.animationClips.Remove(defaultClip);
}
IExportData iData;
if (!exportData.TryGetValue(unityGo, out iData))
{
continue;
}
var data = iData as AnimationOnlyExportData;
if (data == null)
{
Debug.LogWarningFormat("FBX Exporter: no animation export data found for {0}", unityGo.name);
continue;
}
// export animation
// export default clip first
if (data.defaultClip != null)
{
var defaultClip = data.defaultClip;
ExportAnimationClip(defaultClip, data.animationClips[defaultClip], fbxScene);
data.animationClips.Remove(defaultClip);
}

foreach (var animClip in data.animationClips)
{
ExportAnimationClip(animClip.Key, animClip.Value, fbxScene);
foreach (var animClip in data.animationClips)
{
ExportAnimationClip(animClip.Key, animClip.Value, fbxScene);
}
}
}
// Set the scene's default camera.
Expand Down

0 comments on commit ba7982f

Please sign in to comment.