直接看效果,修改前为:
修改后为:
工具代码如下:
1 [MenuItem("Saber/Asset/Fix Dance Anim")] 2 static void FixDanceAnim() 3 { 4 UnityEngine.Object[] objs = Selection.objects; 5 foreach (var obj in objs) 6 { 7 string assetPath = AssetDatabase.GetAssetPath(obj); 8 ModelImporter importer = (ModelImporter)ModelImporter.GetAtPath(assetPath); 9 var oldClip = importer.clipAnimations[0]; 10 ModelImporterClipAnimation newClip = new ModelImporterClipAnimation(); 11 newClip.name = oldClip.name; 12 newClip.loopTime = false; 13 newClip.firstFrame = oldClip.firstFrame; 14 newClip.lastFrame = oldClip.lastFrame; 15 newClip.keepOriginalPositionXZ = true; 16 newClip.keepOriginalOrientation = true; 17 newClip.keepOriginalPositionY = true; 18 newClip.lockRootRotation = false; 19 newClip.lockRootHeightY = false; 20 newClip.lockRootPositionXZ = false; 21 newClip.heightOffset = 0; 22 newClip.rotationOffset = 0; 23 ModelImporterClipAnimation[] clips = new ModelImporterClipAnimation[1] { newClip }; 24 importer.clipAnimations = clips; 25 importer.SaveAndReimport(); 26 } 27 28 Debug.Log("All finished"); 29 }
转载请注明出处:https://www.cnblogs.com/jietian331/p/15166591.html