Пример #1
0
            public void AddSubMesh(Mesh subMesh, MeshChecker checker)
            {
                foreach (var v in subMeshList)
                {
                    if (v.meshObject == subMesh)
                    {
                        return;
                    }
                }
                SubMeshData data = new SubMeshData();

                data.meshObject  = subMesh;
                data.format      = GetMeshFormat(subMesh);
                data.name        = subMesh.name;
                data.vertexCount = subMesh.vertexCount;
                data.tranCount   = subMesh.triangles.Length / 3;
                subMeshList.Add(data);
                //重算总体顶点以及面数
                checkMap[checker.meshSubMeshCount] = subMeshList.Count;
                checkMap[checker.meshVertexCount]  = subMeshList.Sum(x => x.vertexCount);
                checkMap[checker.meshTrangleCount] = subMeshList.Sum(x => x.tranCount);
            }
Пример #2
0
            public override void InitDetailCheckObject(Object obj)
            {
                MeshChecker   checker  = currentChecker as MeshChecker;
                Mesh          mesh     = obj as Mesh;
                ModelImporter importer = AssetImporter.GetAtPath(assetPath) as ModelImporter;

                //Mesh的object直接指向FBX根物体
                checkObject = AssetDatabase.LoadAssetAtPath <Object>(assetPath);
                checkMap[checker.previewItem] = AssetPreview.GetMiniThumbnail(checkObject);
                string readable            = buildInType;
                string compression         = buildInType;
                string tangent             = buildInType;
                string optimize            = buildInType;
                string normal              = buildInType;
                string blendshape          = buildInType;
                string animation           = buildInType;
                string genCollider         = buildInType;
                string keepQuads           = buildInType;
                string swapUVs             = buildInType;
                string generateLightMapUVs = buildInType;
                float  scale = 1.0f;

                if (importer != null)
                {
                    readable            = importer.isReadable.ToString();
                    optimize            = importer.optimizeMesh.ToString();
                    blendshape          = importer.importBlendShapes.ToString();
                    animation           = importer.animationType.ToString();
                    normal              = importer.importNormals.ToString();
                    tangent             = importer.importTangents.ToString();
                    compression         = importer.meshCompression.ToString();
                    genCollider         = importer.addCollider.ToString();
                    swapUVs             = importer.swapUVChannels.ToString();
                    generateLightMapUVs = importer.generateSecondaryUV.ToString();
                    scale = importer.globalScale;
                }
                checkMap.Add(checker.meshSubMeshCount, 0);
                checkMap.Add(checker.meshVertexCount, 0);
                checkMap.Add(checker.meshTrangleCount, 0);
                if (mesh == null && checker.isReloadCheckItem)
                {
                    List <string> oriSubMeshList = subMeshList.Select(x => x.name).ToList();
                    subMeshList.Clear();
                    foreach (var v in EditorUtility.CollectDependencies(new Object[] { obj }))
                    {
                        if (v is Mesh)
                        {
                            mesh = v as Mesh;
                            if (oriSubMeshList.Contains(mesh.name))
                            {
                                AddSubMesh(mesh, checker);
                            }
                        }
                    }
                }
                checkMap.Add(checker.meshFormat, GetMeshFormat(mesh));
                checkMap.Add(checker.meshReadable, readable);
                checkMap.Add(checker.meshImortBlendShaps, blendshape);
                checkMap.Add(checker.meshGenCollider, genCollider);
                checkMap.Add(checker.meshSwapUVs, swapUVs);
                checkMap.Add(checker.meshGenLightMapUVs, generateLightMapUVs);
                checkMap.Add(checker.meshKeepQuads, keepQuads);
                checkMap.Add(checker.meshOptimized, optimize);
                checkMap.Add(checker.meshAnimSetting, animation);
                checkMap.Add(checker.meshCompression, compression);
                checkMap.Add(checker.meshTanSetting, tangent);
                checkMap.Add(checker.meshNormalSetting, normal);
                checkMap.Add(checker.meshScaleFactor, scale);
            }
Пример #3
0
 public MeshDetail(Object obj, MeshChecker checker) : base(obj, checker)
 {
 }