@@ -2472,115 +2472,6 @@ protected void GetObjectsInAnimationClips(
2472
2472
}
2473
2473
}
2474
2474
2475
- /*protected bool ExportAnimationOnly(GameObject unityGo, FbxScene fbxScene){
2476
- // gather all animation clips
2477
- var legacyAnim = unityGo.GetComponentsInChildren<Animation>();
2478
- var genericAnim = unityGo.GetComponentsInChildren<Animator> ();
2479
-
2480
- // from clips determine what needs to be exported
2481
-
2482
- // export nodes and their parent hierarchies
2483
-
2484
- // export objects as we go, create parent hierarchies after
2485
- // store objects in a set, along with parents that need to be exported..
2486
-
2487
- // also need to know if a gameobject is a bone and export accordingly
2488
-
2489
- // export components
2490
- // only light and camera components, and only if that component is animated
2491
-
2492
- // export animation
2493
-
2494
- var animationClips = new HashSet<AnimationClip> ();
2495
-
2496
- foreach (var anim in legacyAnim) {
2497
- var animClips = AnimationUtility.GetAnimationClips (anim.gameObject);
2498
- ExportAnimatedGameObjects(animClips, anim.gameObject, unityGo, fbxScene, ref animationClips);
2499
- }
2500
-
2501
- foreach (var anim in genericAnim) {
2502
- // Try the animator controller (mecanim)
2503
- var controller = anim.runtimeAnimatorController;
2504
- if (controller)
2505
- {
2506
- ExportAnimatedGameObjects(controller.animationClips, anim.gameObject, unityGo, fbxScene, ref animationClips);
2507
- }
2508
- }
2509
-
2510
- return false;
2511
- }
2512
-
2513
- private bool ExportAnimatedGameObjects(AnimationClip[] animClips, GameObject animationRootObject, GameObject exportRoot, FbxScene fbxScene, ref HashSet<AnimationClip> clipSet){
2514
- foreach (var animClip in animClips) {
2515
- if (!clipSet.Add (animClip)) {
2516
- // we have already exported gameobjects for this clip
2517
- continue;
2518
- }
2519
-
2520
- foreach (EditorCurveBinding uniCurveBinding in AnimationUtility.GetCurveBindings (animClip)) {
2521
- Object uniObj = AnimationUtility.GetAnimatedObject (animationRootObject, uniCurveBinding);
2522
- if (!uniObj) {
2523
- continue;
2524
- }
2525
- //Debug.LogWarning (uniObj.name + ": " + uniCurveBinding.propertyName);
2526
-
2527
- GameObject unityGo = GetGameObject (uniObj);
2528
- if (!unityGo) {
2529
- continue;
2530
- }
2531
- FbxNode fbxNode;
2532
- ExportGameObjectAndParents (unityGo, exportRoot, fbxScene, out fbxNode);
2533
-
2534
- // TODO: export animated components
2535
- // check if animated property is part of a light or a camera and export accordingly
2536
- }
2537
-
2538
- ExportAnimationClip (animClip, animationRootObject, fbxScene);
2539
- }
2540
- return true;
2541
- }
2542
-
2543
- private bool ExportGameObjectAndParents(GameObject unityGo, GameObject rootObject, FbxScene fbxScene, out FbxNode fbxNode){
2544
- // node already exists
2545
- if (MapUnityObjectToFbxNode.TryGetValue (unityGo, out fbxNode)) {
2546
- return true;
2547
- }
2548
-
2549
- if (ExportSettings.mayaCompatibleNames) {
2550
- unityGo.name = ConvertToMayaCompatibleName (unityGo.name);
2551
- }
2552
-
2553
- // create an FbxNode and add it as a child of parent
2554
- fbxNode = FbxNode.Create (fbxScene, GetUniqueName (unityGo.name));
2555
- MapUnityObjectToFbxNode [unityGo] = fbxNode;
2556
-
2557
- // Default inheritance type in FBX is RrSs, which causes scaling issues in Maya as
2558
- // both Maya and Unity use RSrs inheritance by default.
2559
- // Note: MotionBuilder uses RrSs inheritance by default as well, though it is possible
2560
- // to select a different inheritance type in the UI.
2561
- // Use RSrs as the scaling inhertiance instead.
2562
- fbxNode.SetTransformationInheritType (FbxTransform.EInheritType.eInheritRSrs);
2563
-
2564
- // TODO: check if GO is a bone and export accordingly
2565
-
2566
- ExportTransform (unityGo.transform, fbxNode, Vector3.zero, TransformExportType.Local);//newCenter, exportType);
2567
-
2568
- if (unityGo.transform.parent != null || unityGo.transform.parent != rootObject.transform.parent) {
2569
- FbxNode fbxNodeParent;
2570
- if (!ExportGameObjectAndParents (unityGo.transform.parent.gameObject, rootObject, fbxScene, out fbxNodeParent)) {
2571
- Debug.LogWarningFormat ("Failed to export GameObject {0}", unityGo.transform.parent.name);
2572
- return false;
2573
- }
2574
- fbxNodeParent.AddChild (fbxNode);
2575
- }
2576
-
2577
- if (unityGo == rootObject) {
2578
- fbxScene.GetRootNode ().AddChild (fbxNode);
2579
- }
2580
-
2581
- return true;
2582
- }*/
2583
-
2584
2475
/// <summary>
2585
2476
/// Export components on this game object.
2586
2477
/// Transform components have already been exported.
0 commit comments