private void drawRow(ModelBean model)
        {
            int lv = 0;

            if (model.FilePath == GUISetting.SelectFilePath)
            {
                GUI.color = GUISetting.SelectColor;
            }

            if (GUILayout.Button(model.Name, "OL TextField", GUILayout.MaxWidth(200f)))
            {
                Selection.activeObject    = AssetDatabase.LoadAssetAtPath <Object>(model.FilePath);
                GUISetting.SelectFilePath = model.FilePath;
            }

            GUILayout.Space(50);
            GUILayout.Label(model.AssetDesc, GUILayout.MinWidth(100f));

            GUILayout.Label(model.VertexCount.ToString(), GUILayout.MinWidth(80f));

            setGUIColor(model.TriangleScore);
            GUILayout.Label(model.TriangleCount.ToString(), GUILayout.MinWidth(80f));

            setGUIColor(model.BondScore);
            GUILayout.Label(model.BondCount.ToString(), GUILayout.MinWidth(50f));
            GUI.color = Color.white;
            //            GUILayout.Label(model.TextureName , GUILayout.Width(150F));
            GUILayout.Label(string.Format("{0}x{1}", model.TextureSize.x, model.TextureSize.y), GUILayout.Width(100F));

            lv        = GUISetting.CalScoreLevel(model.Score);
            GUI.color = GUISetting.ScoreColors[lv];
            GUILayout.Label(GUISetting.ScoreNames[lv], GUILayout.MinWidth(100F));
            GUI.color = Color.white;
        }
        private void readSkinMeshRender(SkinnedMeshRenderer modelSkin, ModelBean modelBean)
        {
            Mesh modelMesh = modelSkin.sharedMesh;

            if (modelMesh != null)
            {
                modelBean.VertexCount   = modelMesh.vertexCount;
                modelBean.TriangleCount = modelMesh.triangles.Length / 3;
            }

            Transform[] boneTrans = modelSkin.bones;
            if (boneTrans != null)
            {
                modelBean.BondCount = boneTrans.Length;
            }

            Material mat = modelSkin.sharedMaterial;

            if (mat && mat.mainTexture)
            {
                Texture mainTex = mat.mainTexture;
                modelBean.TextureName = mainTex.name;
                modelBean.TextureSize = new Vector2(mainTex.width, mainTex.height);
            }
        }
        /// <summary>
        /// 解析模型数量
        /// </summary>
        /// <param name="filePath"></param>
        private ModelBean parseModel(string filePath)
        {
            ModelBean modelBean = new ModelBean();

            modelBean.Name     = "  " + Path.GetFileNameWithoutExtension(filePath);
            modelBean.FilePath = filePath;

            UnityEngine.Object  resObj    = AssetDatabase.LoadAssetAtPath <Object>(filePath);
            GameObject          gObj      = GameObject.Instantiate(resObj) as GameObject;
            SkinnedMeshRenderer modelSkin = gObj.GetComponentInChildren <SkinnedMeshRenderer>();

            if (modelSkin != null)
            {
                readSkinMeshRender(modelSkin, modelBean);
            }
            else
            {
                MeshRenderer meshRenderer = gObj.GetComponentInChildren <MeshRenderer>();
                if (meshRenderer != null)
                {
                    readMeshRender(meshRenderer, modelBean);
                }
            }

            GameObject.DestroyImmediate(gObj);
            return(modelBean);
        }
        /// <summary>
        /// 查找模型文件
        /// </summary>
        private void findModels()
        {
            scrollPos = Vector2.zero;
            List <ModelSettingBean> settings = OverviewSetting.Instance.ModelSettings;

            List <string> files = new List <string>();
            Dictionary <ModelSettingBean, string[]> fileMaps = new Dictionary <ModelSettingBean, string[]>();

            List <string> assetTypeList = new List <string>();

            assetTypeList.Add("ALL");

            float fileCount = 0;

            if (settings != null)
            {
                for (int i = 0; i < settings.Count; i++)
                {
                    files.Clear();
                    for (int j = 0; j < settings[i].Folder.Count; j++)
                    {
                        string rootFolder = settings[i].Folder[j];
                        if (string.IsNullOrEmpty(rootFolder))
                        {
                            continue;
                        }
                        string[] fileArr = Directory.GetFiles(rootFolder, "*.FBX", SearchOption.AllDirectories);
                        files.AddRange(fileArr);
                        fileCount += fileArr.Length;
                    }
                    fileMaps[settings[i]] = files.ToArray();
                    assetTypeList.Add(settings[i].AssetDesc);
                }
            }

            AssetAllTypes = assetTypeList.ToArray();
            modelList     = new List <ModelBean>();
            int curFileIndex = 0;

            foreach (ModelSettingBean msb in fileMaps.Keys)
            {
                string[] childFiles = fileMaps[msb];
                for (int i = 0; i < childFiles.Length; i++)
                {
                    curFileIndex++;
                    EditorUtility.DisplayProgressBar("分析中", "正在分析模型数据...", curFileIndex / fileCount);
                    ModelBean mb = parseModel(childFiles[i]);
                    mb.AssetDesc = msb.AssetDesc;

                    mb.TriangleScore = mb.TriangleCount / (float)msb.MaxTriangs;
                    mb.BondScore     = mb.BondCount / (float)msb.MaxBones;
                    mb.Score         = (mb.TriangleScore + mb.BondScore) * 0.5f;

                    modelList.Add(mb);
                }
            }

            EditorUtility.ClearProgressBar();
        }
        private void readMeshRender(MeshRenderer modelMeshRenderer, ModelBean modelBean)
        {
            MeshFilter mesh      = modelMeshRenderer.GetComponent <MeshFilter>();
            Mesh       modelMesh = mesh.sharedMesh;

            if (modelMesh != null)
            {
                modelBean.VertexCount   = modelMesh.vertexCount;
                modelBean.TriangleCount = modelMesh.triangles.Length / 3;
            }

            Material mat = modelMeshRenderer.sharedMaterial;

            if (mat && mat.mainTexture)
            {
                Texture mainTex = mat.mainTexture;
                modelBean.TextureName = mainTex.name;
                modelBean.TextureSize = new Vector2(mainTex.width, mainTex.height);
            }
        }