From 366ea016f754b4cc55e11a892b26f4325f98437e Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 21 Apr 2021 16:44:45 +0900 Subject: [PATCH] fix primitive.material --- Assets/VRM10/Runtime/IO/MeshAdapter.cs | 2 +- Assets/VRM10/Runtime/IO/Vrm10Exporter.cs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Assets/VRM10/Runtime/IO/MeshAdapter.cs b/Assets/VRM10/Runtime/IO/MeshAdapter.cs index c19ead466..fcb514a15 100644 --- a/Assets/VRM10/Runtime/IO/MeshAdapter.cs +++ b/Assets/VRM10/Runtime/IO/MeshAdapter.cs @@ -316,7 +316,7 @@ namespace UniVRM10 var prim = new glTFPrimitives { mode = (int)mesh.Topology, - material = materials.IndexOf(y.Material), + material = y.Material, indices = indicesAccessorIndex, attributes = new glTFAttributes(), }; diff --git a/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs b/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs index 78cfd6a61..f596605a4 100644 --- a/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs +++ b/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs @@ -162,12 +162,6 @@ namespace UniVRM10 Reserve(reserveBytes); } - // mesh - ExportMeshes(model.MeshGroups, model.Materials, option); - - // node - ExportNodes(model.Root, model.Nodes, model.MeshGroups, option); - // material var materialExporter = new Vrm10MaterialExporter(); foreach (Material material in model.Materials) @@ -176,6 +170,12 @@ namespace UniVRM10 Storage.Gltf.materials.Add(glTFMaterial); } + // mesh + ExportMeshes(model.MeshGroups, model.Materials, option); + + // node + ExportNodes(model.Root, model.Nodes, model.MeshGroups, option); + var (vrm, vrmSpringBone, thumbnailTextureIndex) = ExportVrm(root, model, converter, metaObject); // Extension で Texture が増える場合があるので最後に呼ぶ