Skip to content

Commit b16f67c

Browse files
authored
Merge pull request #372 from Unity-Technologies/Uni-42430-export-camera-editorclips2
Uni-42430 Export Light and Camera FbxNodeAttribute w/ animation
2 parents aaf1c75 + ea9df15 commit b16f67c

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2325,10 +2325,6 @@ public struct AnimationOnlyExportData {
23252325
// first clip to export
23262326
public AnimationClip defaultClip;
23272327

2328-
// TODO: find a better way to keep track of which components + properties we support
2329-
private static List<string> cameraProps = new List<string>{"field of view"};
2330-
private static List<string> lightProps = new List<string>{"m_Intensity", "m_SpotAngle", "m_Color.r", "m_Color.g", "m_Color.b"};
2331-
23322328
public AnimationOnlyExportData(
23332329
Dictionary<AnimationClip, GameObject> animClips,
23342330
HashSet<GameObject> exportSet,
@@ -2345,6 +2341,9 @@ public void ComputeObjectsInAnimationClips(
23452341
GameObject animationRootObject,
23462342
bool exportSkinnedMeshAnim = true
23472343
){
2344+
// NOTE: the object (animationRootObject) containing the animation is not necessarily animated
2345+
// when driven by an animator or animation component.
2346+
23482347
foreach (var animClip in animClips) {
23492348
if (this.animationClips.ContainsKey(animClip)) {
23502349
// we have already exported gameobjects for this clip
@@ -2368,11 +2367,12 @@ public void ComputeObjectsInAnimationClips(
23682367
continue;
23692368
}
23702369

2371-
if (lightProps.Contains (uniCurveBinding.propertyName)) {
2372-
this.exportComponent.Add (unityGo, typeof(Light));
2373-
} else if (cameraProps.Contains (uniCurveBinding.propertyName)) {
2374-
this.exportComponent.Add (unityGo, typeof(Camera));
2375-
}
2370+
// If we have a clip driving a camera or light then force the export of FbxNodeAttribute
2371+
// so that they point the right way when imported into Maya.
2372+
if (unityGo.GetComponent<Light>())
2373+
this.exportComponent[unityGo] = typeof(Light);
2374+
else if (unityGo.GetComponent<Camera>())
2375+
this.exportComponent[unityGo] = typeof(Camera);
23762376

23772377
this.goExportSet.Add (unityGo);
23782378
}

Assets/Integrations/Autodesk/maya/scripts/unityCommands.mel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ proc importFile(string $filePathStr){
234234
storeAttribute($unityExportSet, $UnityFbxFileNameAttr, "");
235235
storeAttribute($unityExportSet, $UnityFbxNamespaceAttr, "");
236236
}
237-
237+
238238
if(`namespaceInfo -cur -an` != $targetNamespace){
239239
namespace -set $targetNamespace;
240240
}

0 commit comments

Comments
 (0)