diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfExportSettings.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfExportSettings.cs index 1407cebfd..a82686460 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfExportSettings.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfExportSettings.cs @@ -29,7 +29,7 @@ namespace UniGLTF public bool ExportOnlyBlendShapePosition; /// - /// tangent を出力する + /// Export TANGENT /// public bool ExportTangents #if GLTF_EXPORT_TANGENTS @@ -38,9 +38,9 @@ namespace UniGLTF ; /// - /// Keep VertexColor + /// Export COLOR_0 /// - public bool KeepVertexColor; + public bool ExportVertexColor; /// /// https://github.com/vrm-c/UniVRM/issues/1582 @@ -48,5 +48,10 @@ namespace UniGLTF /// Allowed hide flags for MeshFilters to be exported /// public HideFlags MeshFilterAllowedHideFlags = HideFlags.None; + + /// + /// Export TEXCOORD_1 + /// + public bool ExportUvSecondary; } } diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshExporter_DividedVertexBuffer.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshExporter_DividedVertexBuffer.cs index 67327c87b..1af876ce0 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshExporter_DividedVertexBuffer.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshExporter_DividedVertexBuffer.cs @@ -51,7 +51,7 @@ namespace UniGLTF var vColorState = VertexColorUtility.DetectVertexColor(mesh, unityMaterials); var exportVertexColor = ( - (settings.KeepVertexColor && mesh.colors != null && mesh.colors.Length == mesh.vertexCount) // vertex color を残す設定 + (settings.ExportVertexColor && mesh.colors != null && mesh.colors.Length == mesh.vertexCount) // vertex color を残す設定 || vColorState == VertexColorState.ExistsAndIsUsed // VColor使っている || vColorState == VertexColorState.ExistsAndMixed // VColorを使っているところと使っていないところが混在(とりあえずExportする) ); diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshExporter_SharedVertexBuffer.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshExporter_SharedVertexBuffer.cs index aae9f9c9b..dcef406c5 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshExporter_SharedVertexBuffer.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshExporter_SharedVertexBuffer.cs @@ -43,12 +43,16 @@ namespace UniGLTF } var uvAccessorIndex0 = data.ExtendBufferAndGetAccessorIndex(mesh.uv.Select(y => y.ReverseUV()).ToArray(), glBufferTarget.ARRAY_BUFFER); - var uvAccessorIndex1 = data.ExtendBufferAndGetAccessorIndex(mesh.uv2.Select(y => y.ReverseUV()).ToArray(), glBufferTarget.ARRAY_BUFFER); + + var uvAccessorIndex1 = -1; + if (settings.ExportUvSecondary) + { + uvAccessorIndex1 = data.ExtendBufferAndGetAccessorIndex(mesh.uv2.Select(y => y.ReverseUV()).ToArray(), glBufferTarget.ARRAY_BUFFER); + } var colorAccessorIndex = -1; - var vColorState = VertexColorUtility.DetectVertexColor(mesh, materials); - if ((settings.KeepVertexColor && mesh.colors != null && mesh.colors.Length == mesh.vertexCount) // vertex color を残す設定 + if ((settings.ExportVertexColor && mesh.colors != null && mesh.colors.Length == mesh.vertexCount) // vertex color を残す設定 || vColorState == VertexColorState.ExistsAndIsUsed // VColor使っている || vColorState == VertexColorState.ExistsAndMixed // VColorを使っているところと使っていないところが混在(とりあえずExportする) ) diff --git a/Assets/VRM/Editor/Format/VRMExportSettings.cs b/Assets/VRM/Editor/Format/VRMExportSettings.cs index f73bab40a..ff9e5067e 100644 --- a/Assets/VRM/Editor/Format/VRMExportSettings.cs +++ b/Assets/VRM/Editor/Format/VRMExportSettings.cs @@ -66,7 +66,7 @@ namespace VRM UseSparseAccessorForMorphTarget = UseSparseAccessor, ExportOnlyBlendShapePosition = OnlyBlendshapePosition, DivideVertexBuffer = DivideVertexBuffer, - KeepVertexColor = KeepVertexColor, + ExportVertexColor = KeepVertexColor, }; public GameObject Root { get; set; }