Ejemplo n.º 1
0
        public static void ExtractAnCompressClipsFromFBX()
        {
            AnimationClip[] extractClips = ExtractClipsFromFBX();
            if (extractClips != null && extractClips.Length > 0)
            {
                var clipInfos = (from clip in extractClips
                                 let clipAssetPath = AssetDatabase.GetAssetPath(clip)
                                                     select AnimationClipCompress.CreateCompressedClip(clip, 4)
                                 ).ToArray();

                SelectionUtility.ActiveObjects(clipInfos);
            }
        }
        public static AnimationClip CreateCompressPrecisionClip(AnimationClip clip, int precision = 4)
        {
            var    newClip       = UnityObject.Instantiate <AnimationClip>(clip);
            string clipAssetPath = AssetDatabase.GetAssetPath(clip);

            AssetDatabase.DeleteAsset(clipAssetPath);
            AnimationClipCompress.CompressFloatPrecision(newClip, precision);

            AssetDatabase.CreateAsset(newClip, clipAssetPath);
            AssetDatabase.ImportAsset(clipAssetPath);

            return(newClip);
        }
        public static AnimationClip CreateCompressedScaleCurveClip(AnimationClip clip)
        {
            var    newClip       = UnityObject.Instantiate <AnimationClip>(clip);
            string clipAssetPath = AssetDatabase.GetAssetPath(clip);

            AssetDatabase.DeleteAsset(clipAssetPath);

            AnimationClipCompress.RemoveScaleCurve(newClip);

            AssetDatabase.CreateAsset(newClip, clipAssetPath);
            AssetDatabase.ImportAsset(clipAssetPath);

            return(newClip);
        }
Ejemplo n.º 4
0
        public static void CompressClip()
        {
            AnimationClip[] selectedClips = Selection.GetFiltered <AnimationClip>(SelectionMode.Assets);
            if (selectedClips == null || selectedClips.Length == 0)
            {
                return;
            }

            var clipInfos = (from clip in selectedClips
                             let clipAssetPath = AssetDatabase.GetAssetPath(clip)
                                                 select AnimationClipCompress.CreateCompressedClip(clip, 4)
                             ).ToArray();

            SelectionUtility.ActiveObjects(clipInfos);
        }