public void FinalizeModel(IEnumerable <VmdMorphFrameData> morphFrames) { var vertices = new List <PmxVertexData>(); var vertexIndices = new List <int>(); var materials = new List <PmxMaterialData>(); var textures = ModelDataEachPropertyDict.Keys.SelectMany(p => p.Type.CreateTextures(World, p)).Distinct().ToArray(); var morphs = new List <PmxMorphData>(); var rigids = new List <PmxRigidData>(); foreach (var prop in ModelDataEachPropertyDict.Keys) { Vertices.CreateVertices(prop.Type, ModelDataEachPropertyDict[prop], vertices.Count, out var propVertices, out var propVertexIndeices); Materials.CreateMaterials(prop, textures, ModelDataEachPropertyDict[prop].Count, out var propMaterials); Morphs.CompressMorph(ModelDataEachPropertyDict[prop], morphFrames, out var propMorphs); Rigids.CreateRigids(ModelDataEachPropertyDict[prop], out var propRigids); vertices.AddRange(propVertices); vertexIndices.AddRange(propVertexIndeices); materials.AddRange(propMaterials); morphs.AddRange(propMorphs); rigids.AddRange(propRigids); } ModelData = new PmxModelData { Header = Header, VertexIndices = vertexIndices.ToArray(), BoneArray = Bones.BoneArray, TextureFiles = textures.ToArray(), VertexArray = vertices.ToArray(), MaterialArray = materials.ToArray(), MorphArray = morphs.ToArray(), RigidArray = rigids.ToArray(), SlotArray = new[] { new PmxSlotData { SlotName = "Root", Type = SlotType.BONE, Indices = new int[] { 0 }, NormalSlot = false, }, new PmxSlotData { SlotName = "表情", Type = SlotType.MORPH, Indices = Enumerable.Range(0, Math.Min(128, morphs.Count)).ToArray(), NormalSlot = false, }, //new PmxSlotData //{ // SlotName = "弾ボーン", // Type = SlotType.BONE, // Indices = Enumerable.Range(1, Bones.BoneList.Count - 1).ToArray() //} }, }; }