Exemple #1
0
        public static void ApplyFormatToObject(AnimationImportData data)
        {
            if (data == null)
            {
                return;
            }

            List <object> unFortmatObject = data.GetObjects(true);

            for (int i = 0; i < unFortmatObject.Count; ++i)
            {
                AnimationInfo texInfo = unFortmatObject[i] as AnimationInfo;
                string        name    = System.IO.Path.GetFileName(texInfo.Path);
                if (EditorUtility.DisplayCancelableProgressBar("设置动作格式", name, (i * 1.0f) / unFortmatObject.Count))
                {
                    Debug.LogWarning("[AnimationFormater]ApplyFormatToObject Stop.");
                    break;
                }
                if (texInfo == null)
                {
                    continue;
                }
                ModelImporter tImporter = AssetImporter.GetAtPath(texInfo.Path) as ModelImporter;
                if (tImporter == null)
                {
                    continue;
                }

                bool needImport = false;

                if (data.AnimationType != tImporter.animationType)
                {
                    tImporter.animationType = data.AnimationType;
                    needImport = true;
                }

                if (data.AnimationCompression != tImporter.animationCompression)
                {
                    tImporter.animationCompression = data.AnimationCompression;
                    needImport = true;
                }

                if (needImport)
                {
                    tImporter.SaveAndReimport();
                }
            }
            EditorUtility.ClearProgressBar();

            for (int i = 0; i < unFortmatObject.Count; ++i)
            {
                AnimationInfo texInfo = unFortmatObject[i] as AnimationInfo;
                string        name    = System.IO.Path.GetFileName(texInfo.Path);
                EditorUtility.DisplayProgressBar("更新动作数据", name, (i * 1.0f) / unFortmatObject.Count);
                AnimationInfo.CreateAnimationInfo(texInfo.Path);
            }
            EditorUtility.ClearProgressBar();
        }
Exemple #2
0
 protected override void _RefreshList(List <string> list)
 {
     m_aniInfo = new List <AnimationInfo>();
     for (int i = 0; i < list.Count; ++i)
     {
         string path = EditorPath.FormatAssetPath(list[i]);
         string name = System.IO.Path.GetFileName(path);
         EditorUtility.DisplayProgressBar("获取动作数据", name, (i * 1.0f) / list.Count);
         if (!EditorPath.IsAnimation(path))
         {
             continue;
         }
         AnimationInfo aniInfo = AnimationInfo.CreateAnimationInfo(path);
         if (aniInfo != null)
         {
             m_aniInfo.Add(aniInfo);
         }
     }
     EditorUtility.ClearProgressBar();
     RefreshDataWithSelect();
 }