Skip to content

Commit aa26101

Browse files
committed
code review fixes
1 parent 46f0a84 commit aa26101

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

com.unity.formats.fbx/Editor/FbxExporter.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3490,6 +3490,11 @@ internal int ExportAll (
34903490
continue;
34913491
}
34923492
var data = iData as AnimationOnlyExportData;
3493+
if(data == null)
3494+
{
3495+
Debug.LogWarningFormat("FBX Exporter: no animation export data found for {0}", unityGo.name);
3496+
continue;
3497+
}
34933498
// export animation
34943499
// export default clip first
34953500
if (data.defaultClip != null)

com.unity.formats.fbx/Editor/Sources/Recorders/FbxRecorder/FbxRecorderSettings.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,37 @@ public Transform TransferAnimationDest
7373
}
7474
}
7575

76+
/// <summary>
77+
/// Get the Unity object (in this case transform), associated with the given binding ID.
78+
/// </summary>
79+
/// <param name="id">Binding ID</param>
80+
/// <returns>Transform associated with binding ID</returns>
7681
static Transform GetBinding(string id)
7782
{
7883
// return BindingManager.Get(m_BindingId) as GameObject;
7984
var method = Type.GetType("UnityEditor.Recorder.BindingManager,Unity.Recorder.Editor").GetMethod("Get", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
8085
return method.Invoke(null, new object[] { id }) as Transform;
8186
}
8287

88+
/// <summary>
89+
/// Set the binding ID to be associated with the given Unity object.
90+
/// This information will be saved on domain reload, so that the object can still be found
91+
/// with the binding ID.
92+
/// </summary>
93+
/// <param name="id">Binding ID</param>
94+
/// <param name="obj">Unity Object</param>
8395
static void SetBinding(string id, UnityEngine.Object obj)
8496
{
8597
// BindingManager.Set(m_BindingId, value);
8698
var method = Type.GetType("UnityEditor.Recorder.BindingManager,Unity.Recorder.Editor").GetMethod("Set", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
8799
method.Invoke(null, new object[] { id, obj });
88100
}
89101

102+
/// <summary>
103+
/// Get a binding ID for the transform, so that the reference survives domain reload. Maintaining a direct reference would not work
104+
/// as all scene objects are destroyed and recreated on reload (e.g. when entering/exiting playmode).
105+
/// </summary>
106+
/// <returns>Binding ID</returns>
90107
static string GenerateBindingId()
91108
{
92109
return GUID.Generate().ToString();

0 commit comments

Comments
 (0)