From 8b8f21f536bd9681b8a7464a52d9477170cf5550 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 3 Jun 2021 20:04:30 +0900 Subject: [PATCH] fix text. MeshExportInfo.Create --- .../Runtime/UniGLTF/IO/MeshIO/MeshExportInfo.cs | 14 ++++++++------ Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs | 5 ++--- Assets/UniGLTF/Tests/UniGLTF/MeshTests.cs | 4 ++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshExportInfo.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshExportInfo.cs index 25d15131b..e115d0a33 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshExportInfo.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshExportInfo.cs @@ -183,11 +183,6 @@ namespace UniGLTF public string Summary; #endregion - public MeshExportInfo(Transform t) - { - - } - MeshExportInfo(GameObject root, Renderer renderer, MeshExportSettings settings, IBlendShapeExportFilter blendShapeFilter) { if (root == null) @@ -232,7 +227,7 @@ namespace UniGLTF PushRenderer(renderer); } - public void PushRenderer(Renderer renderer) + void PushRenderer(Renderer renderer) { if (renderer is SkinnedMeshRenderer smr) { @@ -273,6 +268,13 @@ namespace UniGLTF } } + public static MeshExportInfo Create(GameObject go) + { + var list = new List(); + GetInfo(go, list, MeshExportSettings.Default, new DefualtBlendShapeExportFilter()); + return list[0]; + } + /// /// ヒエラルキーからエクスポートする Mesh の情報を収集する /// diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs index ac836c051..fbfdd7371 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs @@ -274,13 +274,12 @@ namespace UniGLTF foreach (var x in uniqueUnityMeshes) { - var matrices = x.GetBindPoses().Select(m_axisInverter.InvertMat4).ToArray(); - var accessor = glTF.ExtendBufferAndGetAccessorIndex(bufferIndex, matrices, glBufferTarget.NONE); - foreach (var (renderer, uniqueBones) in x.Renderers) { if (uniqueBones != null && renderer is SkinnedMeshRenderer smr) { + var matrices = x.GetBindPoses().Select(m_axisInverter.InvertMat4).ToArray(); + var accessor = glTF.ExtendBufferAndGetAccessorIndex(bufferIndex, matrices, glBufferTarget.NONE); var skin = new glTFSkin { inverseBindMatrices = accessor, diff --git a/Assets/UniGLTF/Tests/UniGLTF/MeshTests.cs b/Assets/UniGLTF/Tests/UniGLTF/MeshTests.cs index 8f69afa19..1ef275bd5 100644 --- a/Assets/UniGLTF/Tests/UniGLTF/MeshTests.cs +++ b/Assets/UniGLTF/Tests/UniGLTF/MeshTests.cs @@ -134,7 +134,7 @@ namespace UniGLTF }; var axisInverter = Axes.X.Create(); - var unityMesh = new MeshExportInfo(go.transform); + var unityMesh = MeshExportInfo.Create(go); var (gltfMesh, blendShapeIndexMap) = meshExportSettings.DivideVertexBuffer ? MeshExporter_DividedVertexBuffer.Export(glTF, bufferIndex, unityMesh, Materials, axisInverter, meshExportSettings) : MeshExporter_SharedVertexBuffer.Export(glTF, bufferIndex, unityMesh, Materials,axisInverter, meshExportSettings) @@ -182,7 +182,7 @@ namespace UniGLTF }; var axisInverter = Axes.X.Create(); - var unityMesh = new MeshExportInfo(go.transform); + var unityMesh = MeshExportInfo.Create(go); var (gltfMesh, blendShapeIndexMap) = meshExportSettings.DivideVertexBuffer ? MeshExporter_DividedVertexBuffer.Export(glTF, bufferIndex, unityMesh, Materials, axisInverter, meshExportSettings) : MeshExporter_SharedVertexBuffer.Export(glTF, bufferIndex, unityMesh, Materials,axisInverter, meshExportSettings)