Ejemplo n.º 1
0
        public static void ScanAnimationClip()
        {
            bool isCancel = false;

            try {
                AnimationOpt _AnimOpt = _AnimOptList[_Index];
                isCancel = EditorUtility.DisplayCancelableProgressBar("优化AnimationClip", _AnimOpt.path, (float)_Index / (float)_AnimOptList.Count);
                _AnimOpt.OptimizeSize();
                _Index++;
            }
            catch (Exception e) {
                isCancel = true;
            }
            if (isCancel || _Index >= _AnimOptList.Count)
            {
                EditorUtility.ClearProgressBar();
                Debug.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;
            }
        }
Ejemplo n.º 2
0
    private static bool ProcessAnima(string path)
    {
        if (Path.GetExtension(path).ToLower() == ".anim")
        {
            EditorTool.AnimationOpt animaOpt = EditorTool.OptimizeAnimationClipTool.GetNewAOpt(path);
            animaOpt.OptimizeSize();
            return(true);
        }

        return(false);
    }