Ejemplo n.º 1
0
        // Info
        /// <summary>
        /// Compiles a formatted string of human-readable information about the model.
        /// </summary>
        /// <param name="info">Information fields to include.</param>
        public string GetInfo(InfoField info)
        {
            StringBuilder sb = new StringBuilder("Showing info for PMX model\n\n");

            if ((info & InfoField.Header) != 0)
            {
                sb.AppendFormat("PMX version {0}\nName: {1} ({2})\n", Version, string.IsNullOrEmpty(NameEnglish) ? "<english name>" : NameEnglish, string.IsNullOrEmpty(NameJapanese) ? "<japanese name>" : NameJapanese)
                .AppendFormat("\nComments:\n{0}\n{1}\n\nGlobals:\n", string.IsNullOrEmpty(InfoEnglish) ? "<english info>" : InfoEnglish, string.IsNullOrEmpty(InfoJapanese) ? "<japanese info>" : InfoJapanese)
                .AppendFormat("  Text encoding:        {0}\n", TextEncoding.GetType().ToString())
                .AppendFormat("  Additional UV count:  {0}\n", AdditionalUVCount)
                .AppendFormat("Index sizes (byte)\n  Vertex index size:    {0}\n", PmxTypes.VertexIndex)
                .AppendFormat("  Texture index size:   {0}\n", PmxTypes.VertexIndex)
                .AppendFormat("  Material index size:  {0}\n", PmxTypes.VertexIndex)
                .AppendFormat("  Bone index size:      {0}\n", PmxTypes.VertexIndex)
                .AppendFormat("  Morph index size:     {0}\n", PmxTypes.VertexIndex)
                .AppendFormat("  Rigidbody index size: {0}\n\n", PmxTypes.VertexIndex);
            }

            if ((info & InfoField.Vertex) != 0)
            {
                sb.AppendFormat("Vertex info\n")
                .AppendFormat("Count: {0}\n\n", Vertices.Count);
            }

            if ((info & InfoField.Triangle) != 0)
            {
                sb.AppendFormat("Triangle info\n")
                .AppendFormat("Count: {0}\n\n", Triangles.Count);
            }

            if ((info & InfoField.Texture) != 0)
            {
                sb.AppendFormat("Texture table\n")
                .AppendFormat("Count: {0}\n", Textures.Count);
                foreach (string str in Textures)
                {
                    sb.AppendFormat("  {0}\n", str);
                }
                sb.Append("\n");
            }

            if ((info & InfoField.Material) != 0)
            {
                sb.AppendFormat("Material data\n")
                .AppendFormat("Count: {0}\n", Materials.Count);
                foreach (PmxMaterial mat in Materials)
                {
                    sb.Append(mat.ToString());
                }
                sb.Append("\n");
            }

            if ((info & InfoField.Bone) != 0)
            {
                sb.AppendFormat("Bone data\n")
                .AppendFormat("Count: {0}\n", Bones.Count);
                foreach (PmxBone bone in Bones)
                {
                    sb.Append(bone.ToString());
                }
                sb.Append("\n");
            }

            if ((info & InfoField.Morph) != 0)
            {
                sb.Append("Morph data\n")
                .AppendFormat("Count: {0}\n", Morphs.Count);
                foreach (PmxMorph morph in Morphs)
                {
                    sb.Append(morph.ToString());
                }
                sb.Append("\n");
            }

            return(sb.ToString());
        }