Esempio n. 1
0
        public void ReportModel(string reportPath)
        {
            try
            {
                scaleSet        = new Dictionary <float, int>();
                rigSet          = new Dictionary <ModelImporterAnimationType, int>();
                sourceAvatarSet = new Dictionary <string, int>();
                if (isPreviewImage)
                {
                    AssetsReporterUtils.CreatePreviewDir();
                }

                var  guids   = AssetDatabase.FindAssets("t:model", null);
                var  sb      = new StringBuilder(1024 * 1024);
                int  idx     = 0;
                bool isFirst = true;
                AssetsReporterUtils.AddCurrenTimeVar(sb);
                sb.Append("g_model_report = [");
                foreach (var guid in guids)
                {
                    string path          = AssetDatabase.GUIDToAssetPath(guid);
                    var    modelImporter = AssetImporter.GetAtPath(path) as ModelImporter;
                    if (modelImporter == null || AssetsReporterUtils.IsPathMatch(path, excludeList))
                    {
                        continue;
                    }
                    if (isFirst)
                    {
                        isFirst = false;
                    }
                    else
                    {
                        sb.Append(",");
                    }
                    ReportModel(sb, modelImporter);

                    sb.Append("\n");
                    EditorUtility.DisplayProgressBar("Progress", path, (float)idx / (float)guids.Length);
                    ++idx;
                }
                sb.Append("];");
                AssetsReporterUtils.AddCountVarObject(sb, "g_model_rig_list", rigSet);
                AssetsReporterUtils.AddCountVarObject(sb, "g_model_scale_list", scaleSet);
                AssetsReporterUtils.AddCountVarObject(sb, "g_model_avatar_list", sourceAvatarSet);
                AssetsReporterUtils.AddPlatformVar(sb, "");
                File.WriteAllText(reportPath, sb.ToString());
            }
            finally
            {
                EditorUtility.ClearProgressBar();
            }
        }
Esempio n. 2
0
        public void ReportTexture(string reportPath)
        {
            try
            {
                AssetsReporterUtils.CreatePreviewDir();

                this.textureTypeSet   = new Dictionary <TextureImporterType, int>();
                this.textureFormatSet = new Dictionary <TextureImporterFormat, int>();
                this.spriteTagSet     = new Dictionary <string, int>();
                var  guids   = AssetDatabase.FindAssets("t:texture2D", null);
                var  sb      = new StringBuilder(1024 * 1024);
                int  idx     = 0;
                bool isFirst = true;
                AssetsReporterUtils.AddCurrenTimeVar(sb);
                sb.Append("g_texture_report = [");
                foreach (var guid in guids)
                {
                    string path            = AssetDatabase.GUIDToAssetPath(guid);
                    var    textureImporter = AssetImporter.GetAtPath(path) as TextureImporter;
                    if (textureImporter == null || AssetsReporterUtils.IsPathMatch(path, excludeList))
                    {
                        continue;
                    }
                    if (isFirst)
                    {
                        isFirst = false;
                    }
                    else
                    {
                        sb.Append(",");
                    }
                    ReportTexture(sb, textureImporter);

                    sb.Append("\n");
                    EditorUtility.DisplayProgressBar("Progress", path, (float)idx / (float)guids.Length);
                    ++idx;
                }
                sb.Append("];");
                AssetsReporterUtils.AddCountVarObject(sb, "g_texture_format_list", textureFormatSet);
                AssetsReporterUtils.AddCountVarObject(sb, "g_texture_type_list", textureTypeSet);
                AssetsReporterUtils.AddCountVarObject(sb, "g_texture_spriteTag_list", spriteTagSet);
                AssetsReporterUtils.AddPlatformVar(sb, this.platform);
                File.WriteAllText(reportPath, sb.ToString());
            }
            finally
            {
                EditorUtility.ClearProgressBar();
            }
        }