Esempio n. 1
0
        private void ReportAudio(StringBuilder sb, AudioImporter importer)
        {
            /// common
            sb.Append("{");
            AssetsReporterUtils.AddJsonObject(sb, "path", importer.assetPath).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "forceToMono", importer.forceToMono).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "loadInBackground", importer.loadInBackground).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "preloadAudioData", importer.preloadAudioData).Append(",");
            // platform setting
            AudioImporterSampleSettings setting = importer.defaultSampleSettings;

            if (!string.IsNullOrEmpty(platform) && importer.ContainsSampleSettingsOverride(platform))
            {
                setting = importer.GetOverrideSampleSettings(platform);
            }
            AssetsReporterUtils.AddJsonObject(sb, "loadType", setting.loadType.ToString()).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "compressionFormat", setting.compressionFormat.ToString()).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "sampleRateSetting", setting.sampleRateSetting.ToString()).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "sampleRateOverride", setting.sampleRateOverride.ToString());
            sb.Append("}");

            AssetsReporterUtils.AddCountDictionary(this.loadTypeSet, setting.loadType);
            AssetsReporterUtils.AddCountDictionary(this.ratingSet, setting.sampleRateOverride);
            AssetsReporterUtils.AddCountDictionary(this.compressSet, setting.compressionFormat);
        }
Esempio n. 2
0
 private static void AddToConpoenentCountDictionary(Dictionary <string, int> cntDict, Component[] components)
 {
     if (components == null)
     {
         return;
     }
     foreach (var component in components)
     {
         if (component != null)
         {
             AssetsReporterUtils.AddCountDictionary(cntDict, component.GetType().ToString());
         }
     }
 }
        private void ReportOneResource(StringBuilder sb, string assetPath)
        {
            var depends = AssetDatabase.GetDependencies(new string[] { assetPath });

            Type type = this.GetFileType(assetPath);

            AssetsReporterUtils.AddCountDictionary(this.typeDict, type);

            sb.Append("{");
            AssetsReporterUtils.AddJsonObject(sb, "path", assetPath).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "type", type.ToString()).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "parentDir", this.GetParentDirectory(assetPath)).Append(",");

            sb.Append("depends:[");
            bool isFirst = true;

            foreach (var d in depends)
            {
                if (d == assetPath)
                {
                    continue;
                }
                if (isFirst)
                {
                    isFirst = false;
                }
                else
                {
                    sb.Append(",");
                }
                sb.Append("{");
                AssetsReporterUtils.AddJsonObject(sb, "path", d).Append(",");
                AssetsReporterUtils.AddJsonObject(sb, "type", this.GetFileType(d).ToString());
                sb.Append("}");
            }
            sb.Append("]");
            foreach (var depend in depends)
            {
                if (!this.dependSet.Contains(depend))
                {
                    this.dependSet.Add(depend);
                }
            }
            sb.Append("}");
        }
        private void SetParentDictionarySet(string path)
        {
            string parent = this.GetParentDirectory(path);

            AssetsReporterUtils.AddCountDictionary(this.parentDirDict, parent);
        }
Esempio n. 5
0
        private void ReportTexture(StringBuilder sb, TextureImporter importer)
        {
            int w, h;
            var type    = importer.textureType;
            int maxSize = importer.maxTextureSize;

#if UNITY_5_5_OR_NEWER
            var defaultTextureSetting = importer.GetDefaultPlatformTextureSettings();
            var format = defaultTextureSetting.format;
            if (!importer.GetPlatformTextureSettings(this.platform, out maxSize, out format))
            {
                maxSize = importer.maxTextureSize;
                format  = defaultTextureSetting.format;
            }
#else
            var format = importer.textureFormat;
            if (!importer.GetPlatformTextureSettings(this.platform, out maxSize, out format))
            {
                maxSize = importer.maxTextureSize;
                format  = importer.textureFormat;
            }
#endif

            var tex = GetTextureSize(importer, out w, out h) as Texture2D;
            sb.Append("{");
            if (tex != null)
            {
                if (!AssetsReporterUtils.IsVisibleInWebBrowserImage(importer.assetPath))
                {
                    string preview = AssetsReporterUtils.GetWebVisibleTexturePreview(importer, tex, true);
                    AssetsReporterUtils.AddJsonObject(sb, "preview", preview).Append(",");
                }
            }

            AssetsReporterUtils.AddJsonObject(sb, "path", importer.assetPath.ToString()).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "textureType", type.ToString()).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "isReadable", importer.isReadable).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "wrapMode", importer.wrapMode.ToString()).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "mipmapEnabled", importer.mipmapEnabled).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "width", w).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "height", h).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "maxSize", maxSize).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "textureFormat", format.ToString()).Append(",");
            if (string.IsNullOrEmpty(importer.spritePackingTag))
            {
                AssetsReporterUtils.AddJsonObject(sb, "isPow2", IsPow2Size(w, h)).Append(",");
            }
            else
            {
                AssetsReporterUtils.AddJsonObject(sb, "isPow2", true).Append(",");
            }
            AssetsReporterUtils.AddJsonObject(sb, "spritePackingTag", importer.spritePackingTag);
            sb.Append("}");
            if (tex != null)
            {
                Resources.UnloadAsset(tex);
                tex = null;
            }

            AssetsReporterUtils.AddCountDictionary(this.spriteTagSet, importer.spritePackingTag);
            AssetsReporterUtils.AddCountDictionary(this.textureFormatSet, format);
            AssetsReporterUtils.AddCountDictionary(this.textureTypeSet, type);
        }
Esempio n. 6
0
        private void ReportModel(StringBuilder sb, ModelImporter importer)
        {
            sb.Append("{");
            AssetsReporterUtils.AddJsonObject(sb, "path", importer.assetPath).Append(",");
            if (this.isPreviewImage)
            {
                var obj = AssetDatabase.LoadAssetAtPath <GameObject>(importer.assetPath);

                string preview = AssetsReporterUtils.GetAssetPreview(importer, obj, true);
                AssetsReporterUtils.AddJsonObject(sb, "preview", preview).Append(",");

                AssetsReporterUtils.AddJsonObject(sb, "vertexNum", AssetsReporterUtils.GetPolygonNum(obj)).Append(",");
            }
            AssetsReporterUtils.AddJsonObject(sb, "isReadable", importer.isReadable).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "scaleFactor", importer.globalScale).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "meshCompression", importer.meshCompression.ToString()).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "generateCollider", importer.addCollider).Append(",");
#if UNITY_2020_2_OR_NEWER
            AssetsReporterUtils.AddJsonObject(sb, "materialImportMode", importer.materialImportMode.ToString()).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "optimizeMeshPolygons", importer.optimizeMeshPolygons).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "optimizeMeshVertices", importer.optimizeMeshVertices).Append(",");
            // 互換性
            AssetsReporterUtils.AddJsonObject(sb, "optimizeMesh", importer.optimizeMeshVertices | importer.optimizeMeshPolygons).Append(",");
#else
            AssetsReporterUtils.AddJsonObject(sb, "importMaterials", importer.importMaterials).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "optimizeMesh", importer.optimizeMesh).Append(",");
#endif
#if UNITY_5_4_OR_NEWER
            AssetsReporterUtils.AddJsonObject(sb, "normalMode", importer.importNormals.ToString()).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "tangentMode", importer.importTangents.ToString()).Append(",");
#else
            AssetsReporterUtils.AddJsonObject(sb, "normalMode", importer.normalImportMode.ToString()).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "tangentMode", importer.tangentImportMode.ToString()).Append(",");
#endif
            AssetsReporterUtils.AddJsonObject(sb, "importBlendShapes", importer.importBlendShapes).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "objectNum", importer.transformPaths.Length).Append(",");
            // rig
            AssetsReporterUtils.AddJsonObject(sb, "animationType", importer.animationType.ToString()).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "generateAnimations", importer.generateAnimations.ToString()).Append(",");
            string srcAvatar = GetAvatarName(importer.animationType, importer.sourceAvatar);
            AssetsReporterUtils.AddJsonObject(sb, "sourceAvatar", srcAvatar).Append(",");
            // animation
            AssetsReporterUtils.AddJsonObject(sb, "importAnimation", importer.importAnimation).Append(",");
            AssetsReporterUtils.AddJsonObject(sb, "animationCompression", importer.animationCompression.ToString()).Append(",");
            if (importer.clipAnimations != null && importer.clipAnimations.Length > 0)
            {
                ReportModelAnimationClips(sb, importer.clipAnimations);
            }
            else
            {
                ReportModelAnimationClips(sb, importer.defaultClipAnimations);
            }
            //
            AssetsReporterUtils.AddCountDictionary(rigSet, importer.animationType);
            AssetsReporterUtils.AddCountDictionary(scaleSet, importer.globalScale);
            if (!string.IsNullOrEmpty(srcAvatar))
            {
                AssetsReporterUtils.AddCountDictionary(sourceAvatarSet, srcAvatar);
            }
            sb.Append("}");
        }