public static void Optimize(OptimizeType optimizeType)
        {
            AnimOptList = FindAnims();
            for (int i = 0; i < AnimOptList.Count; ++i)
            {
                AnimationOpt anim = AnimOptList[i];
                if (EditorUtility.DisplayCancelableProgressBar("优化AnimationClip", anim.Path, (float)i / (float)AnimOptList.Count))
                {
                    break;
                }
                switch (optimizeType)
                {
                case OptimizeType.SACLE:
                    anim.OptmizeAnimationScaleCurve();
                    break;

                case OptimizeType.FLOAT:
                    anim.Optimize_Scale_Float3(false);
                    break;

                default:
                    anim.Optimize_Scale_Float3(true);
                    break;
                }
            }
            EditorUtility.ClearProgressBar();
            AssetDatabase.SaveAssets();
            AnimOptList.Clear();
            cachedOpts.Clear();
        }
Example #2
0
        private static void ScanAnimationClip()
        {
            AnimationOpt _AnimOpt = _AnimOptList[_Index];
            bool         isCancel = EditorUtility.DisplayCancelableProgressBar("优化AnimationClip", _AnimOpt.path, (float)_Index / (float)_AnimOptList.Count);

            _AnimOpt.Optimize_Scale_Float3();
            _Index++;
            if (isCancel || _Index >= _AnimOptList.Count)
            {
                EditorUtility.ClearProgressBar();
                DebugEx.Log(string.Format("--优化完成--    错误数量: {0}    总数量: {1}/{2}    错误信息↓:\n{3}\n----------输出完毕----------", _Errors.Count, _Index, _AnimOptList.Count, string.Join(string.Empty, _Errors.ToArray())));
                Resources.UnloadUnusedAssets();
                GC.Collect();
                AssetDatabase.SaveAssets();
                EditorApplication.update = null;
                _AnimOptList.Clear();
                _cachedOpts.Clear();
                _Index = 0;
            }
        }