Ejemplo n.º 1
0
        public void CheckValid()
        {
            ResetProposeTip();
            //检测模型
            SettingCfg setting = SettingCfg.instance;

            if (setting.modelCheckScale)
            {
                if (this.scale != 1)
                {
                    AddProposeTip("建议模型的scale为1");
                }
            }
            if (setting.modelCheckMeshCompression)
            {
                if (this.meshCompression == ModelImporterMeshCompression.Off)
                {
                    AddProposeTip("建议模型采用压缩格式");
                }
            }

            if (setting.modelCheckAnimCompression)
            {
                if (this.animCompression == ModelImporterAnimationCompression.Off ||
                    this.animCompression == ModelImporterAnimationCompression.KeyframeReduction)
                {
                    if (this.animationClipCount > 0)
                    {
                        AddProposeTip("建议动画采用压缩KeyframeReductionAndCompression格式");
                    }
                }
            }


            if (setting.modelCheckMeshIsRW)
            {
                if (this.isRW)
                {
                    AddProposeTip("建议将非可读写的模型读写操作关掉");
                }
            }
            if (setting.modelCheckCollider)
            {
                if (this.isAddCollider)
                {
                    AddProposeTip("建议检查下当前模型确实需要导入Collider");
                }
            }
            //if (this.animationClipCount > 0)
            //{
            //    AddProposeTip("建议检查当前模型是否需要导入animation");
            //}
        }
Ejemplo n.º 2
0
        //检验纹理贴图的数据合法性
        public void CheckValid()
        {
            ResetProposeTip();
            SettingCfg setting = SettingCfg.instance;

            if (setting.textureCheckMemSize)
            {
                if (this.size >= setting.textureCheckMemSizeValue * 1024)
                {
                    AddProposeTip("文件不小啊,大于" + setting.textureCheckMemSizeValue + "KB,还能减小不??");
                }
            }

            if (setting.textureCheckPix)
            {
                if (this.width > setting.textureCheckPixW || this.height > setting.textureCheckPixH)
                {
                    AddProposeTip("建议纹理像素最大是" + setting.textureCheckPixW + "x" + setting.textureCheckPixH);
                }
            }
            if (setting.textureCheckPix2Pow)
            {
                if (!Powerof2(this.width) || !Powerof2(this.height))
                {
                    AddProposeTip("建议像素大小为2的n次幂(GUI纹理除外) " + this.width + "x" + this.height);
                }
            }

            if (setting.textureCheckPlatSetting)
            {
                if (!androidPlatSetting.isSetting || !iosPlatSetting.isSetting || !standalonePlatSetting.isSetting)
                {
                    AddProposeTip("建议对不同的平台设置不同的参数");
                }
            }
            if (setting.textureCheckIsRW)
            {
                if (this.isRW)
                {
                    AddProposeTip("建议非读写的贴图将这个读写开关关掉");
                }
            }
            if (setting.textureCheckIsLightmap)
            {
                if (this.isLightmap)
                {
                    AddProposeTip("建议检查当前纹理确实是lightmap需要的纹理否?");
                }
            }
        }
 public void Init()
 {
     SettingCfg.Apply(false);
     ProjectResource.Instance.Init();
     Repaint();
 }
        public void DrawModels()
        {
            GUILayout.Space(10);
            actSubTypeModel = (ActiveSubType)GUILayout.Toolbar((int)actSubTypeModel, modelToolStrings, GUILayout.MaxWidth(200));
            GUILayout.Space(10);


            scrollPosModel = EditorGUILayout.BeginScrollView(scrollPosModel);
            if (actSubTypeModel == ActiveSubType.Details)
            {
                GUILayout.BeginHorizontal();
                string info = "Model counts1  {0}";
                GUILayout.Label(string.Format(info, ProjectResource.Instance.models.Count), GUILayout.Width(200));

                if (GUILayout.Button(LanguageCfg.SettingModelDefault, GUILayout.Width(120)))
                {
                    ProjectResource.Instance.SetModelDefault();
                }

                if (GUILayout.Button(LanguageCfg.SettingMeshCompress, GUILayout.Width(120)))
                {
                    ProjectResource.Instance.SetModelsMeshCompress();
                }
                if (GUILayout.Button(LanguageCfg.SettingAnimCompress, GUILayout.Width(120)))
                {
                    ProjectResource.Instance.SetModelsAnimCompress();
                }

                if (GUILayout.Button(LanguageCfg.SettingWriteClose, GUILayout.Width(120)))
                {
                    ProjectResource.Instance.SetModelsWriteReadClose();
                }

                DrawPageCnt(ProjectResource.Instance.models.Count);

                GUILayout.EndHorizontal();
                GUILayout.Space(10);



                //绘制title
                GUILayout.BeginHorizontal();
                if (GUILayout.Button(LanguageCfg.NAME, GUILayout.Width(150)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortModel(ModelInfo.SortType.Name);
                }
                if (GUILayout.Button(LanguageCfg.Scale, GUILayout.Width(50)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortModel(ModelInfo.SortType.Scale);
                }
                if (GUILayout.Button(LanguageCfg.MeshCompress, GUILayout.Width(80)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortModel(ModelInfo.SortType.MeshCompression);
                }
                if (GUILayout.Button(LanguageCfg.AnimCompress, GUILayout.Width(180)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortModel(ModelInfo.SortType.AnimCompression);
                }
                if (GUILayout.Button(LanguageCfg.AnimCnt, GUILayout.Width(80)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortModel(ModelInfo.SortType.AnimationClipCount);
                }
                if (GUILayout.Button(LanguageCfg.IsRW, GUILayout.Width(50)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortModel(ModelInfo.SortType.IsRW);
                }
                if (GUILayout.Button(LanguageCfg.Collider, GUILayout.Width(80)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortModel(ModelInfo.SortType.Collider);
                }
                if (GUILayout.Button(LanguageCfg.NormalMode, GUILayout.Width(80)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortModel(ModelInfo.SortType.NormalImportMode);
                }
                if (GUILayout.Button(LanguageCfg.TangentMode, GUILayout.Width(80)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortModel(ModelInfo.SortType.TangentImportMode);
                }
                if (GUILayout.Button(LanguageCfg.BakeIK, GUILayout.Width(80)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortModel(ModelInfo.SortType.BakeIK);
                }
                if (GUILayout.Button(LanguageCfg.FileSize, GUILayout.Width(80)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortModel(ModelInfo.SortType.FileSize);
                }
                if (GUILayout.Button(LanguageCfg.SkinnedMeshCnt, GUILayout.Width(80)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortModel(ModelInfo.SortType.SkinnedMeshCount);
                }

                if (GUILayout.Button(LanguageCfg.MeshFilterCnt, GUILayout.Width(100)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortModel(ModelInfo.SortType.MeshFilterCount);
                }

                if (GUILayout.Button(LanguageCfg.VertexCnt, GUILayout.Width(80)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortModel(ModelInfo.SortType.VertexCount);
                }
                if (GUILayout.Button(LanguageCfg.TriangleCnt, GUILayout.Width(80)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortModel(ModelInfo.SortType.TriangleCount);
                }
                if (GUILayout.Button(LanguageCfg.BoneCnt, GUILayout.Width(80)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortModel(ModelInfo.SortType.BoneCount);
                }

                if (GUILayout.Button(LanguageCfg.PROPOSE, GUILayout.Width(100)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortModel(ModelInfo.SortType.Propose);
                }

                GUILayout.EndHorizontal();

                int start = mPageCnt * mCurPage;
                int end   = mPageCnt * (mCurPage + 1);
                end = end >= ProjectResource.Instance.models.Count ? ProjectResource.Instance.models.Count : end;
                for (int i = start; i < end; i++)
                {
                    ModelInfo modelInfo = ProjectResource.Instance.models[i];
                    GUILayout.BeginHorizontal();


                    if (GUILayout.Button(modelInfo.name, GUILayout.Width(150)))
                    {
                        EditTools.PingAssetInProject(modelInfo.path);
                    }
                    GUILayout.Space(10);
                    GUILayout.Label(modelInfo.scale.ToString(), GUILayout.MaxWidth(50));
                    GUILayout.Label(modelInfo.meshCompression.ToString(), GUILayout.MaxWidth(80));
                    GUILayout.Label(modelInfo.animCompression.ToString(), GUILayout.MaxWidth(180));
                    GUILayout.Label(modelInfo.animationClipCount.ToString(), GUILayout.MaxWidth(80));
                    GUILayout.Label(modelInfo.isRW.ToString(), GUILayout.MaxWidth(50));
                    GUILayout.Label(modelInfo.isAddCollider.ToString(), GUILayout.MaxWidth(80));
                    GUILayout.Label(modelInfo.normalImportMode.ToString(), GUILayout.MaxWidth(80));
                    GUILayout.Label(modelInfo.tangentImportMode.ToString(), GUILayout.MaxWidth(80));
                    GUILayout.Label(modelInfo.isBakeIK.ToString(), GUILayout.MaxWidth(80));
                    GUILayout.Label(modelInfo.GetFileLenth(), GUILayout.MaxWidth(80));
                    GUILayout.Label(modelInfo.skinnedMeshCount.ToString(), GUILayout.MaxWidth(80));
                    GUILayout.Label(modelInfo.meshFilterCount.ToString(), GUILayout.MaxWidth(100));

                    GUILayout.Label(modelInfo.vertexCount.ToString(), GUILayout.MaxWidth(80));
                    GUILayout.Label(modelInfo.triangleCount.ToString(), GUILayout.MaxWidth(80));
                    GUILayout.Label(modelInfo.boneCount.ToString(), GUILayout.MaxWidth(80));

                    DrawProposeTips(modelInfo);
                    GUILayout.EndHorizontal();
                }
            }
            else if (actSubTypeModel == ActiveSubType.Settings)
            {
                GUILayout.BeginHorizontal();
                SettingCfgUI.modelCheckScale = GUILayout.Toggle(SettingCfgUI.modelCheckScale, "检查Scale属性", GUILayout.MaxWidth(100));
                GUILayout.EndHorizontal();


                GUILayout.BeginHorizontal();
                SettingCfgUI.modelCheckMeshCompression = GUILayout.Toggle(SettingCfgUI.modelCheckMeshCompression, "检查Mesh压缩", GUILayout.MaxWidth(100));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                SettingCfgUI.modelCheckAnimCompression = GUILayout.Toggle(SettingCfgUI.modelCheckAnimCompression, "检查动画压缩", GUILayout.MaxWidth(100));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                SettingCfgUI.modelCheckMeshIsRW = GUILayout.Toggle(SettingCfgUI.modelCheckMeshIsRW, "检查可读写", GUILayout.MaxWidth(100));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                SettingCfgUI.modelCheckCollider = GUILayout.Toggle(SettingCfgUI.modelCheckCollider, "检查是否生成碰撞器", GUILayout.MaxWidth(100));
                GUILayout.EndHorizontal();

                //GUILayout.BeginHorizontal();
                //SettingCfgUI.modelCheckNormals = GUILayout.Toggle(SettingCfgUI.modelCheckNormals, "检查是否存在法线", GUILayout.MaxWidth(100));
                //GUILayout.EndHorizontal();

                //GUILayout.BeginHorizontal();
                //SettingCfgUI.modelCheckTangents = GUILayout.Toggle(SettingCfgUI.modelCheckTangents, "检查是否存在切线", GUILayout.MaxWidth(100));
                //GUILayout.EndHorizontal();

                //GUILayout.BeginHorizontal();
                //SettingCfgUI.modelCheckFileSize = GUILayout.Toggle(SettingCfgUI.modelCheckFileSize, "检查文件大小", GUILayout.MaxWidth(100));
                //SettingCfgUI.modelCheckFileSizeValue = GUILayout.TextField(SettingCfgUI.modelCheckFileSizeValue, GUILayout.MaxWidth(80));
                //GUILayout.Label("kb", GUILayout.MaxWidth(20));
                //GUILayout.EndHorizontal();
                if (GUILayout.Button("应用", GUILayout.MaxWidth(100)))
                {
                    SettingCfg.Apply(true);
                    ProjectResource.Instance.ReCheckModels();
                }
            }
            else
            {
                DrawHelpTips(LanguageCfg.HELP_MODEL);
            }

            EditorGUILayout.EndScrollView();
        }
        public void DrawTextures()
        {
            GUILayout.Space(10);

            actSubTypeTexture = (ActiveSubType)GUILayout.Toolbar((int)actSubTypeTexture, textureToolStrings, GUILayout.MaxWidth(200));

            GUILayout.Space(10);

            scrollPosTexture = EditorGUILayout.BeginScrollView(scrollPosTexture);
            if (actSubTypeTexture == ActiveSubType.Details)
            {
                GUILayout.BeginHorizontal();

                GUILayout.Label(string.Format(LanguageCfg.PROJECT_TEXTURES_LIST, ProjectResource.Instance.textures.Count), GUILayout.Width(150));

                if (GUILayout.Button(LanguageCfg.TEXTURE_SETTING_NO_MINMAP, GUILayout.Width(120)))
                {
                    ProjectResource.Instance.SetTextureNoMinmap();
                }

                DrawPageCnt(ProjectResource.Instance.textures.Count);

                GUILayout.EndHorizontal();
                GUILayout.Space(10);


                //绘制title
                GUILayout.BeginHorizontal();
                if (GUILayout.Button(LanguageCfg.NAME, GUILayout.Width(150)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortTexture(TextureInfo.SortType.Name);
                }
                if (GUILayout.Button(LanguageCfg.MemorySize, GUILayout.Width(100)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortTexture(TextureInfo.SortType.MemorySize);
                }
                if (GUILayout.Button(LanguageCfg.PIX_W, GUILayout.Width(50)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortTexture(TextureInfo.SortType.PixWidth);
                }
                if (GUILayout.Button(LanguageCfg.PIX_H, GUILayout.Width(50)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortTexture(TextureInfo.SortType.PixHeigh);
                }
                if (GUILayout.Button(LanguageCfg.IsRW, GUILayout.Width(50)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortTexture(TextureInfo.SortType.IsRW);
                }
                if (GUILayout.Button(LanguageCfg.OverridePlat, GUILayout.Width(100)))
                {
                    mCurPage = 0;
                }
                if (GUILayout.Button(LanguageCfg.Mipmap, GUILayout.Width(100)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortTexture(TextureInfo.SortType.Mipmap);
                }
                if (GUILayout.Button(LanguageCfg.IsLightmap, GUILayout.Width(80)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortTexture(TextureInfo.SortType.IsLightmap);
                }
                if (GUILayout.Button(LanguageCfg.AnisoLevel, GUILayout.Width(80)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortTexture(TextureInfo.SortType.AnisoLevel);
                }

                if (GUILayout.Button(LanguageCfg.PROPOSE, GUILayout.Width(100)))
                {
                    mCurPage = 0;
                    ProjectResource.Instance.SortTexture(TextureInfo.SortType.Propose);
                }

                GUILayout.EndHorizontal();

                int start = mPageCnt * mCurPage;
                int end   = mPageCnt * (mCurPage + 1);
                end = end >= ProjectResource.Instance.textures.Count ? ProjectResource.Instance.textures.Count : end;
                for (int i = start; i < end; i++)
                {
                    TextureInfo textureInfo = ProjectResource.Instance.textures[i];
                    GUILayout.BeginHorizontal();
                    if (GUILayout.Button(textureInfo.name, GUILayout.Width(150)))
                    {
                        EditTools.PingAssetInProject(textureInfo.path);
                        //Selection.activeObject = textureInfo.texture;
                    }
                    GUILayout.Space(10);
                    GUILayout.Label(textureInfo.GetSize(), GUILayout.MaxWidth(100));

                    GUILayout.Label(textureInfo.width + "x" + textureInfo.height, GUILayout.MaxWidth(100));
                    GUILayout.Label(textureInfo.isRW.ToString(), GUILayout.MaxWidth(50));

                    GUILayout.Label(textureInfo.IsOverridePlatform(), GUILayout.MaxWidth(100));
                    GUILayout.Label(textureInfo.isMipmap.ToString(), GUILayout.MaxWidth(100));
                    GUILayout.Label(textureInfo.isLightmap.ToString(), GUILayout.MaxWidth(80));
                    GUILayout.Label(textureInfo.anisoLevel.ToString(), GUILayout.MaxWidth(80));
                    DrawProposeTips(textureInfo);
                    GUILayout.EndHorizontal();
                }
            }
            else if (actSubTypeTexture == ActiveSubType.Settings)
            {
                GUILayout.BeginHorizontal();
                SettingCfgUI.textureCheckMemSize      = GUILayout.Toggle(SettingCfgUI.textureCheckMemSize, "检查内存大小", GUILayout.MaxWidth(100));
                SettingCfgUI.textureCheckMemSizeValue = GUILayout.TextField(SettingCfgUI.textureCheckMemSizeValue, GUILayout.MaxWidth(80));
                GUILayout.Label("kb", GUILayout.MaxWidth(20));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                SettingCfgUI.textureCheckPix  = GUILayout.Toggle(SettingCfgUI.textureCheckPix, "检查分辨率", GUILayout.MaxWidth(100));
                SettingCfgUI.textureCheckPixW = GUILayout.TextField(SettingCfgUI.textureCheckPixW, GUILayout.MaxWidth(80));
                GUILayout.Label("x", GUILayout.MaxWidth(20));
                SettingCfgUI.textureCheckPixH = GUILayout.TextField(SettingCfgUI.textureCheckPixH, GUILayout.MaxWidth(80));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                SettingCfgUI.textureCheckPix2Pow = GUILayout.Toggle(SettingCfgUI.textureCheckPix2Pow, "检查2N次幂", GUILayout.MaxWidth(100));
                GUILayout.EndHorizontal();


                GUILayout.BeginHorizontal();
                SettingCfgUI.textureCheckIsRW = GUILayout.Toggle(SettingCfgUI.textureCheckIsRW, "检查可读写", GUILayout.MaxWidth(100));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                SettingCfgUI.textureCheckPlatSetting = GUILayout.Toggle(SettingCfgUI.textureCheckPlatSetting, "检查平台设置", GUILayout.MaxWidth(100));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                SettingCfgUI.textureCheckIsLightmap = GUILayout.Toggle(SettingCfgUI.textureCheckIsLightmap, "检查lightmap格式", GUILayout.MaxWidth(150));
                GUILayout.EndHorizontal();

                if (GUILayout.Button("应用", GUILayout.MaxWidth(100)))
                {
                    SettingCfg.Apply(true);
                    ProjectResource.Instance.ReCheckTextures();
                }
            }
            else
            {
                DrawHelpTips(LanguageCfg.HELP_TEXTURE);
            }
            EditorGUILayout.EndScrollView();
        }