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();
            }
        }
Example #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();
            }
        }
Example #3
0
        public void ReportAudio(string reportPath)
        {
            try
            {
                this.ratingSet   = new Dictionary <uint, int>();
                this.compressSet = new Dictionary <AudioCompressionFormat, int>();
                this.loadTypeSet = new Dictionary <AudioClipLoadType, int>();

                StringBuilder sb = new StringBuilder(1024 * 1024);
                AssetsReporterUtils.AddCurrenTimeVar(sb);
                int  idx     = 0;
                bool isFirst = true;
                var  guids   = AssetDatabase.FindAssets("t:audioclip");
                sb.Append("g_audio_report=[");
                foreach (var guid in guids)
                {
                    string path          = AssetDatabase.GUIDToAssetPath(guid);
                    var    audioImporter = AssetImporter.GetAtPath(path) as AudioImporter;
                    if (audioImporter == null || AssetsReporterUtils.IsPathMatch(path, excludeList))
                    {
                        continue;
                    }
                    if (isFirst)
                    {
                        isFirst = false;
                    }
                    else
                    {
                        sb.Append(',');
                    }
                    ReportAudio(sb, audioImporter);
                    ++idx;
                    EditorUtility.DisplayProgressBar("Progress", path, (float)idx / (float)guids.Length);
                }
                sb.Append("];");
                AssetsReporterUtils.AddCountVarObject(sb, "g_audio_rating_list", this.ratingSet);
                AssetsReporterUtils.AddCountVarObject(sb, "g_audio_loadtype_list", this.loadTypeSet);
                AssetsReporterUtils.AddCountVarObject(sb, "g_audio_compress_list", this.compressSet);
                AssetsReporterUtils.AddPlatformVar(sb, this.platform);
                File.WriteAllText(reportPath, sb.ToString());
            }
            finally
            {
                EditorUtility.ClearProgressBar();
            }
        }
        public void ReportResources(string reportPath)
        {
            try
            {
                var  sb      = new StringBuilder(1024 * 1024);
                bool isFirst = true;
                AssetsReporterUtils.AddCurrenTimeVar(sb);
                sb.Append("g_resources_report = [");
                var allAssetPath = AssetDatabase.GetAllAssetPaths();
                foreach (var assetPath in allAssetPath)
                {
                    if (!assetPath.Contains("/Resources/"))
                    {
                        continue;
                    }
                    if (isFirst)
                    {
                        isFirst = false;
                    }
                    else
                    {
                        sb.Append(',');
                    }
                    sb.Append("\n");
                    this.resourceAssetList.Add(assetPath);
                    this.ReportOneResource(sb, assetPath);
                    this.SetParentDictionarySet(assetPath);
                }
                sb.Append("];\n");
                this.ReportDependsAssets(sb);

                AssetsReporterUtils.AddCountVarObject(sb, "g_resources_type_list", this.typeDict);
                AssetsReporterUtils.AddCountVarObject(sb, "g_resources_parent_dir_list", this.parentDirDict);
                AssetsReporterUtils.AddPlatformVar(sb, "");
                File.WriteAllText(reportPath, sb.ToString());
            }
            finally
            {
                EditorUtility.ClearProgressBar();
            }
        }