From e0784c245f0b74855b10eb2b2f66c47bb7cbb4cb Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 13 Jan 2021 16:09:06 +0900 Subject: [PATCH 1/9] MeshWithRenderer --- .../Runtime/UniGLTF/IO/MeshExporter.cs | 8 -------- .../Runtime/UniGLTF/IO/MeshWithRenderer.cs | 19 +++++++++++++++++++ .../UniGLTF/IO/MeshWithRenderer.cs.meta | 11 +++++++++++ .../Runtime/UniGLTF/IO/gltfExporter.cs | 6 +----- 4 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs create mode 100644 Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs.meta diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshExporter.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshExporter.cs index f72809474..005d79d47 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshExporter.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshExporter.cs @@ -251,14 +251,6 @@ namespace UniGLTF }; } - public struct MeshWithRenderer - { - public Mesh Mesh; - [Obsolete("Use Renderer")] - public Renderer Rendererer { get { return Renderer; } set { Renderer = value; } } - public Renderer Renderer; - } - public static IEnumerable<(Mesh, glTFMesh, Dictionary)> ExportMeshes(glTF gltf, int bufferIndex, List unityMeshes, List unityMaterials, MeshExportSettings settings) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs new file mode 100644 index 000000000..22e2f4d36 --- /dev/null +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs @@ -0,0 +1,19 @@ +using System; +using UnityEngine; + +namespace UniGLTF +{ + public struct MeshWithRenderer + { + public Mesh Mesh; + [Obsolete("Use Renderer")] + public Renderer Rendererer => Renderer; + public Renderer Renderer; + + public MeshWithRenderer(Transform x) + { + Mesh = x.GetSharedMesh(); + Renderer = x.GetComponent(); + } + } +} diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs.meta b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs.meta new file mode 100644 index 000000000..6ae443e42 --- /dev/null +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6f745ee7743b23243bf6adcb740dab82 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs index 30a535fd0..55e8fee4a 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs @@ -253,11 +253,7 @@ namespace UniGLTF #region Meshes var unityMeshes = Nodes - .Select(x => new MeshExporter.MeshWithRenderer - { - Mesh = x.GetSharedMesh(), - Renderer = x.GetComponent(), - }) + .Select(x => new MeshWithRenderer(x)) .Where(x => { if (x.Mesh == null) From e94276ec65a53d973f680c75d243b99afe63cf03 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 13 Jan 2021 16:15:58 +0900 Subject: [PATCH 2/9] MeshWithRenderer.FromNodes --- .../Runtime/UniGLTF/IO/MeshWithRenderer.cs | 20 +++++++++++++++++++ .../Runtime/UniGLTF/IO/gltfExporter.cs | 18 +---------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs index 22e2f4d36..0f39371de 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using UnityEngine; namespace UniGLTF @@ -15,5 +16,24 @@ namespace UniGLTF Mesh = x.GetSharedMesh(); Renderer = x.GetComponent(); } + + public static IEnumerable FromNodes(IEnumerable nodes) + { + foreach (var node in nodes) + { + var x = new MeshWithRenderer(node); + if (x.Mesh == null) + { + continue; ; + } + if (x.Renderer.sharedMaterials == null + || x.Renderer.sharedMaterials.Length == 0) + { + continue; + } + + yield return x; + } + } } } diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs index 55e8fee4a..807065e6f 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs @@ -252,23 +252,7 @@ namespace UniGLTF #endregion #region Meshes - var unityMeshes = Nodes - .Select(x => new MeshWithRenderer(x)) - .Where(x => - { - if (x.Mesh == null) - { - return false; - } - if (x.Renderer.sharedMaterials == null - || x.Renderer.sharedMaterials.Length == 0) - { - return false; - } - - return true; - }) - .ToList(); + var unityMeshes = MeshWithRenderer.FromNodes(Nodes).ToList(); MeshBlendShapeIndexMap = new Dictionary>(); foreach (var (mesh, gltfMesh, blendShapeIndexMap) in MeshExporter.ExportMeshes( From c43e30f0b23515d460dbf5f5d4cbb51fd9447fb6 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 13 Jan 2021 16:30:40 +0900 Subject: [PATCH 3/9] MeshWithRenderer --- .../Runtime/UniGLTF/IO/MeshExporter.cs | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshExporter.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshExporter.cs index 005d79d47..a4490768f 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshExporter.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshExporter.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using UniJSON; using UnityEngine; namespace UniGLTF @@ -24,10 +23,10 @@ namespace UniGLTF public static class MeshExporter { static glTFMesh ExportPrimitives(glTF gltf, int bufferIndex, - string rendererName, - Mesh mesh, Material[] materials, - List unityMaterials) + MeshWithRenderer unityMesh, List unityMaterials) { + var mesh = unityMesh.Mesh; + var materials = unityMesh.Renderer.sharedMaterials; var positions = mesh.vertices.Select(y => y.ReverseZ()).ToArray(); var positionAccessorIndex = gltf.ExtendBufferAndGetAccessorIndex(bufferIndex, positions, glBufferTarget.ARRAY_BUFFER); gltf.accessors[positionAccessorIndex].min = positions.Aggregate(positions[0], (a, b) => new Vector3(Mathf.Min(a.x, b.x), Math.Min(a.y, b.y), Mathf.Min(a.z, b.z))).ToArray(); @@ -98,7 +97,7 @@ namespace UniGLTF if (j >= materials.Length) { - Debug.LogWarningFormat("{0}.materials is not enough", rendererName); + Debug.LogWarningFormat("{0}.materials is not enough", unityMesh.Renderer.name); break; } @@ -255,24 +254,19 @@ namespace UniGLTF List unityMeshes, List unityMaterials, MeshExportSettings settings) { - for (int i = 0; i < unityMeshes.Count; ++i) + foreach (var unityMesh in unityMeshes) { - var x = unityMeshes[i]; - var mesh = x.Mesh; - var materials = x.Renderer.sharedMaterials; - var gltfMesh = ExportPrimitives(gltf, bufferIndex, - x.Renderer.name, - mesh, materials, unityMaterials); + unityMesh, unityMaterials); var targetNames = new List(); var blendShapeIndexMap = new Dictionary(); int exportBlendShapes = 0; - for (int j = 0; j < mesh.blendShapeCount; ++j) + for (int j = 0; j < unityMesh.Mesh.blendShapeCount; ++j) { var morphTarget = ExportMorphTarget(gltf, bufferIndex, - mesh, j, + unityMesh.Mesh, j, settings.UseSparseAccessorForMorphTarget, settings.ExportOnlyBlendShapePosition); if (morphTarget.POSITION < 0 && morphTarget.NORMAL < 0 && morphTarget.TANGENT < 0) @@ -281,7 +275,7 @@ namespace UniGLTF } // maybe skip - var blendShapeName = mesh.GetBlendShapeName(j); + var blendShapeName = unityMesh.Mesh.GetBlendShapeName(j); blendShapeIndexMap.Add(j, exportBlendShapes++); targetNames.Add(blendShapeName); @@ -296,7 +290,7 @@ namespace UniGLTF gltf_mesh_extras_targetNames.Serialize(gltfMesh, targetNames); - yield return (mesh, gltfMesh, blendShapeIndexMap); + yield return (unityMesh.Mesh, gltfMesh, blendShapeIndexMap); } } } From e3403b12f23062bb266653d5e55d18890084bd31 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 13 Jan 2021 16:44:04 +0900 Subject: [PATCH 4/9] JointIndexMap --- .../Runtime/UniGLTF/IO/MeshExporter.cs | 8 +++- .../Runtime/UniGLTF/IO/MeshWithRenderer.cs | 47 +++++++++++++++++-- .../Runtime/UniGLTF/IO/gltfExporter.cs | 18 ++++--- 3 files changed, 58 insertions(+), 15 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshExporter.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshExporter.cs index a4490768f..1b05dfa3a 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshExporter.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshExporter.cs @@ -52,7 +52,13 @@ namespace UniGLTF var boneweights = mesh.boneWeights; var weightAccessorIndex = gltf.ExtendBufferAndGetAccessorIndex(bufferIndex, boneweights.Select(y => new Vector4(y.weight0, y.weight1, y.weight2, y.weight3)).ToArray(), glBufferTarget.ARRAY_BUFFER); - var jointsAccessorIndex = gltf.ExtendBufferAndGetAccessorIndex(bufferIndex, boneweights.Select(y => new UShort4((ushort)y.boneIndex0, (ushort)y.boneIndex1, (ushort)y.boneIndex2, (ushort)y.boneIndex3)).ToArray(), glBufferTarget.ARRAY_BUFFER); + var jointsAccessorIndex = gltf.ExtendBufferAndGetAccessorIndex(bufferIndex, boneweights.Select(y => + new UShort4( + (ushort)unityMesh.GetJointIndex(y.boneIndex0), + (ushort)unityMesh.GetJointIndex(y.boneIndex1), + (ushort)unityMesh.GetJointIndex(y.boneIndex2), + (ushort)unityMesh.GetJointIndex(y.boneIndex3)) + ).ToArray(), glBufferTarget.ARRAY_BUFFER); var attributes = new glTFAttributes { diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs index 0f39371de..b5c444010 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs @@ -1,20 +1,59 @@ using System; using System.Collections.Generic; +using System.Linq; using UnityEngine; namespace UniGLTF { public struct MeshWithRenderer { - public Mesh Mesh; - [Obsolete("Use Renderer")] - public Renderer Rendererer => Renderer; - public Renderer Renderer; + public readonly Mesh Mesh; + public readonly Renderer Renderer; + public readonly Transform[] UniqueBones; + readonly int[] JointIndexMap; public MeshWithRenderer(Transform x) { Mesh = x.GetSharedMesh(); Renderer = x.GetComponent(); + + if (Renderer is SkinnedMeshRenderer skin && skin.bones != null && skin.bones.Length > 0) + { + // has joints + UniqueBones = skin.bones; + // UniqueBones = skin.bones.Distinct().ToArray(); + + JointIndexMap = new int[skin.bones.Length]; + + var bones = skin.bones; + for (int i = 0; i < bones.Length; ++i) + { + JointIndexMap[i] = Array.IndexOf(bones, bones[i]); + } + } + else + { + UniqueBones = null; + JointIndexMap = null; + } + } + + public int GetJointIndex(int index) + { + if (index < 0) + { + return index; + } + + // 重複した index をひとつ目に変更する + if (JointIndexMap != null) + { + return JointIndexMap[index]; + } + else + { + return index; + } } public static IEnumerable FromNodes(IEnumerable nodes) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs index 807065e6f..5247dc9ab 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs @@ -269,13 +269,10 @@ namespace UniGLTF #endregion #region Nodes and Skins - var unitySkins = Nodes - .Select(x => x.GetComponent()).Where(x => - x != null - && x.bones != null - && x.bones.Length > 0) + var unitySkins = unityMeshes + .Where(x => x.UniqueBones != null) .ToList(); - glTF.nodes = Nodes.Select(x => ExportNode(x, Nodes, unityMeshes.Select(y => y.Renderer).ToList(), unitySkins)).ToList(); + glTF.nodes = Nodes.Select(x => ExportNode(x, Nodes, unityMeshes.Select(y => y.Renderer).ToList(), unitySkins.Select(y => y.Renderer as SkinnedMeshRenderer).ToList())).ToList(); glTF.scenes = new List { new gltfScene @@ -286,19 +283,20 @@ namespace UniGLTF foreach (var x in unitySkins) { - var matrices = x.sharedMesh.bindposes.Select(y => y.ReverseZ()).ToArray(); + var matrices = x.Mesh.bindposes.Select(y => y.ReverseZ()).ToArray(); var accessor = glTF.ExtendBufferAndGetAccessorIndex(bufferIndex, matrices, glBufferTarget.NONE); + var renderer = x.Renderer as SkinnedMeshRenderer; var skin = new glTFSkin { inverseBindMatrices = accessor, - joints = x.bones.Select(y => Nodes.IndexOf(y)).ToArray(), - skeleton = Nodes.IndexOf(x.rootBone), + joints = x.UniqueBones.Select(y => Nodes.IndexOf(y)).ToArray(), + skeleton = Nodes.IndexOf(renderer.rootBone), }; var skinIndex = glTF.skins.Count; glTF.skins.Add(skin); - foreach (var z in Nodes.Where(y => y.Has(x))) + foreach (var z in Nodes.Where(y => y.Has(x.Renderer))) { var nodeIndex = Nodes.IndexOf(z); var node = glTF.nodes[nodeIndex]; From 0c0e8d90c13b3f6eb66036820ad5970de0a46802 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 13 Jan 2021 17:27:36 +0900 Subject: [PATCH 5/9] joints is unique --- .../Runtime/UniGLTF/IO/MeshWithRenderer.cs | 21 +++++++++++++++---- .../Runtime/UniGLTF/IO/gltfExporter.cs | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs index b5c444010..a6aee551d 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs @@ -20,15 +20,14 @@ namespace UniGLTF if (Renderer is SkinnedMeshRenderer skin && skin.bones != null && skin.bones.Length > 0) { // has joints - UniqueBones = skin.bones; - // UniqueBones = skin.bones.Distinct().ToArray(); - + var uniqueBones = skin.bones.Distinct().ToArray(); + UniqueBones = uniqueBones; JointIndexMap = new int[skin.bones.Length]; var bones = skin.bones; for (int i = 0; i < bones.Length; ++i) { - JointIndexMap[i] = Array.IndexOf(bones, bones[i]); + JointIndexMap[i] = Array.IndexOf(uniqueBones, bones[i]); } } else @@ -56,6 +55,20 @@ namespace UniGLTF } } + public IEnumerable GetBindPoses() + { + var used = new HashSet(); + for (int i = 0; i < JointIndexMap.Length; ++i) + { + var index = JointIndexMap[i]; + if (!used.Contains(index)) + { + used.Add(index); + yield return Mesh.bindposes[i]; + } + } + } + public static IEnumerable FromNodes(IEnumerable nodes) { foreach (var node in nodes) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs index 5247dc9ab..8ae3762d8 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs @@ -283,7 +283,7 @@ namespace UniGLTF foreach (var x in unitySkins) { - var matrices = x.Mesh.bindposes.Select(y => y.ReverseZ()).ToArray(); + var matrices = x.GetBindPoses().Select(y => y.ReverseZ()).ToArray(); var accessor = glTF.ExtendBufferAndGetAccessorIndex(bufferIndex, matrices, glBufferTarget.NONE); var renderer = x.Renderer as SkinnedMeshRenderer; From a3fbd81c662c2ef9967affb435fd178407199d41 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 13 Jan 2021 17:27:44 +0900 Subject: [PATCH 6/9] fix --- Assets/VRM/Runtime/SkinnedMeshUtility/VRMBoneNormalizer.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Assets/VRM/Runtime/SkinnedMeshUtility/VRMBoneNormalizer.cs b/Assets/VRM/Runtime/SkinnedMeshUtility/VRMBoneNormalizer.cs index 7c5bacee3..6ff4265bd 100644 --- a/Assets/VRM/Runtime/SkinnedMeshUtility/VRMBoneNormalizer.cs +++ b/Assets/VRM/Runtime/SkinnedMeshUtility/VRMBoneNormalizer.cs @@ -83,7 +83,10 @@ namespace VRM .ToDictionary(x => x.Key, x => boneMap[x.Value]) ; - var animator = dst.AddComponent(); + if (dst.GetComponent() == null) + { + var animator = dst.AddComponent(); + } var vrmHuman = go.GetComponent(); var avatarDescription = AvatarDescription.Create(); if (vrmHuman != null && vrmHuman.Description != null) From 2ba2da20fd3ee1343d140c495c588819c3fd00cf Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 14 Jan 2021 19:19:50 +0900 Subject: [PATCH 7/9] to `if (used.Add(index))` --- Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs index a6aee551d..927669979 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs @@ -61,9 +61,8 @@ namespace UniGLTF for (int i = 0; i < JointIndexMap.Length; ++i) { var index = JointIndexMap[i]; - if (!used.Contains(index)) + if (used.Add(index)) { - used.Add(index); yield return Mesh.bindposes[i]; } } From b1c3b861ecf71c175ca25e07b42b7d84cc113157 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 14 Jan 2021 19:40:16 +0900 Subject: [PATCH 8/9] add NO_UNIQUE_JOINTS message --- .../Valildators/HierarchyValidator.cs | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Assets/UniGLTF/MeshUtility/Editor/ExportDialog/Valildators/HierarchyValidator.cs b/Assets/UniGLTF/MeshUtility/Editor/ExportDialog/Valildators/HierarchyValidator.cs index 93ea547b3..d899d14c8 100644 --- a/Assets/UniGLTF/MeshUtility/Editor/ExportDialog/Valildators/HierarchyValidator.cs +++ b/Assets/UniGLTF/MeshUtility/Editor/ExportDialog/Valildators/HierarchyValidator.cs @@ -17,13 +17,17 @@ namespace MeshUtility.Validators [LangMsg(Languages.en, "ExportRoot must be topmost parent")] NO_PARENT, - [LangMsg(Languages.ja, "ヒエラルキーに active なメッシュが含まれていない")] + [LangMsg(Languages.ja, "ヒエラルキーに active なメッシュが含まれていません")] [LangMsg(Languages.en, "No active mesh")] NO_ACTIVE_MESH, - [LangMsg(Languages.ja, "ヒエラルキーの中に同じ名前のGameObjectが含まれている。 エクスポートした場合に自動でリネームする")] + [LangMsg(Languages.ja, "ヒエラルキーの中に同じ名前のGameObjectが含まれている。 エクスポートした場合に自動でリネームします")] [LangMsg(Languages.en, "There are bones with the same name in the hierarchy. They will be automatically renamed after export")] DUPLICATE_BONE_NAME_EXISTS, + + [LangMsg(Languages.ja, "SkinnedMeshRenderer.bones に重複する内容がある。エクスポートした場合に、bones の重複を取り除き、boneweights, bindposes を調整します")] + [LangMsg(Languages.en, "There are same bone in bones the SkinnedMeshRenderer. They will be automatically uniqued")] + NO_UNIQUE_JOINTS, } /// @@ -45,6 +49,19 @@ namespace MeshUtility.Validators return (duplicates.Any()); } + static bool HasNoUniqueJoints(Renderer r) + { + if (r is SkinnedMeshRenderer skin) + { + if (skin.bones != null && skin.bones.Length != skin.bones.Distinct().Count()) + { + return true; + } + } + + return false; + } + public static IEnumerable Validate(GameObject ExportRoot) { if (ExportRoot == null) @@ -66,6 +83,11 @@ namespace MeshUtility.Validators yield break; } + if (renderers.Any(x => HasNoUniqueJoints(x))) + { + yield return Validation.Warning(ExportValidatorMessages.NO_UNIQUE_JOINTS.Msg()); + } + if (DuplicateNodeNameExists(ExportRoot)) { yield return Validation.Warning(ExportValidatorMessages.DUPLICATE_BONE_NAME_EXISTS.Msg()); From 3c717c4952095ad2f9cc14e19af35fc70adda7dd Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 14 Jan 2021 19:45:07 +0900 Subject: [PATCH 9/9] =?UTF-8?q?=E4=B8=8D=E8=A6=81=E3=81=AA=E3=82=B3?= =?UTF-8?q?=E3=83=A1=E3=83=B3=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs index 927669979..9c67c42cb 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshWithRenderer.cs @@ -44,7 +44,6 @@ namespace UniGLTF return index; } - // 重複した index をひとつ目に変更する if (JointIndexMap != null) { return JointIndexMap[index];