예제 #1
0
 protected override void _RefreshList(List <string> list)
 {
     m_modelInfo = new List <ModelInfo>();
     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.IsModel(path))
         {
             continue;
         }
         ModelInfo modelInfo = ModelInfo.CreateModelInfo(path);
         if (modelInfo != null)
         {
             m_modelInfo.Add(modelInfo);
         }
     }
     EditorUtility.ClearProgressBar();
     RefreshDataWithSelect();
 }
예제 #2
0
 public bool IsFormatModel(ModelInfo tInfo)
 {
     if (tInfo.OptimizeMesh != OptimizeMesh)
     {
         return(false);
     }
     if (tInfo.ReadWriteEnable != ReadWriteEnable)
     {
         return(false);
     }
     if (tInfo.ImportAnimation != ImportAnimation)
     {
         return(false);
     }
     if (tInfo.ImportMaterials != ImportMaterials)
     {
         return(false);
     }
     if (tInfo.MeshCompression != MeshCompression)
     {
         return(false);
     }
     return(true);
 }
예제 #3
0
        public static void ApplyFormatToObject(ModelImportData data)
        {
            if (data == null)
            {
                return;
            }

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

            for (int i = 0; i < unFortmatObject.Count; ++i)
            {
                ModelInfo texInfo = unFortmatObject[i] as ModelInfo;
                string    name    = System.IO.Path.GetFileName(texInfo.Path);
                if (EditorUtility.DisplayCancelableProgressBar("设置模型格式", name, (i * 1.0f) / unFortmatObject.Count))
                {
                    Debug.LogWarning("[ModelFormater]ApplyFormatObject Stop.");
                    break;
                }
                if (texInfo == null)
                {
                    continue;
                }
                ModelImporter tImporter = AssetImporter.GetAtPath(texInfo.Path) as ModelImporter;
                if (tImporter == null)
                {
                    continue;
                }
                bool needImport = false;
                if (tImporter.isReadable != data.ReadWriteEnable)
                {
                    tImporter.isReadable = data.ReadWriteEnable;
                    needImport           = true;
                }
                if (tImporter.optimizeMesh != data.OptimizeMesh)
                {
                    tImporter.optimizeMesh = data.OptimizeMesh;
                    needImport             = true;
                }
                if (tImporter.importMaterials != data.ImportMaterials)
                {
                    tImporter.importMaterials = data.ImportMaterials;
                    needImport = true;
                }
                if (tImporter.importAnimation != data.ImportAnimation)
                {
                    tImporter.importAnimation = data.ImportAnimation;
                    needImport = true;
                }
                if (tImporter.meshCompression != data.MeshCompression)
                {
                    tImporter.meshCompression = data.MeshCompression;
                    needImport = true;
                }

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

            for (int i = 0; i < unFortmatObject.Count; ++i)
            {
                ModelInfo texInfo = unFortmatObject[i] as ModelInfo;
                string    name    = System.IO.Path.GetFileName(texInfo.Path);
                if (EditorUtility.DisplayCancelableProgressBar("更新模型数据", name, (i * 1.0f) / unFortmatObject.Count))
                {
                    Debug.LogWarning("[ModelFormater]Refresh Model Info Stop.");
                    break;
                }
                ModelInfo.CreateModelInfo(texInfo.Path);
            }
            EditorUtility.ClearProgressBar();
        }
예제 #4
0
        public static void GenerateRportByConfig()
        {
            List <ModelInfo> modelInfoList = ModelInfo.GetModelInfoByDirectory(OverviewConfig.RootPath);

            GenerateReport(OverviewConfig.ModelReportPath, modelInfoList);
        }
예제 #5
0
 public void AddObject(ModelInfo modelInfo)
 {
     Count   = Count + 1;
     Memory += modelInfo.MemSize;
     m_objects.Add(modelInfo);
 }