From 06d77d6d6e39d909ae479a6a3634ae075eb8124b Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 12 Dec 2023 15:37:19 +0900 Subject: [PATCH 1/2] fix warnings --- Assets/VRM/Editor/Format/VRMEditorExporter.cs | 2 +- Assets/VRM/Runtime/SpringBone/VRMSpringUtility.cs | 2 +- Assets/VRM/Tests/VRMLookAtTests.cs | 14 ++++++-------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Assets/VRM/Editor/Format/VRMEditorExporter.cs b/Assets/VRM/Editor/Format/VRMEditorExporter.cs index ce0187b24..8a047864c 100644 --- a/Assets/VRM/Editor/Format/VRMEditorExporter.cs +++ b/Assets/VRM/Editor/Format/VRMEditorExporter.cs @@ -54,7 +54,7 @@ namespace VRM { continue; } - + if (removeUnknown && clip.Preset == BlendShapePreset.Unknown) { continue; diff --git a/Assets/VRM/Runtime/SpringBone/VRMSpringUtility.cs b/Assets/VRM/Runtime/SpringBone/VRMSpringUtility.cs index 31bba0a94..634d43ebe 100644 --- a/Assets/VRM/Runtime/SpringBone/VRMSpringUtility.cs +++ b/Assets/VRM/Runtime/SpringBone/VRMSpringUtility.cs @@ -145,7 +145,7 @@ namespace VRM foreach (var boneGroup in secondaryAnimation.boneGroups) { var vrmBoneGroup = secondary.gameObject.AddComponent(); - if (tryGetNode(boneGroup.center, out var node)) + if (boneGroup.center != -1 && tryGetNode(boneGroup.center, out var node)) { vrmBoneGroup.m_center = node; } diff --git a/Assets/VRM/Tests/VRMLookAtTests.cs b/Assets/VRM/Tests/VRMLookAtTests.cs index 95c197326..4318da2c3 100644 --- a/Assets/VRM/Tests/VRMLookAtTests.cs +++ b/Assets/VRM/Tests/VRMLookAtTests.cs @@ -32,10 +32,9 @@ namespace VRM var fp = go.GetComponent(); GameObject.DestroyImmediate(go.GetComponent()); var lookAt = go.AddComponent(); - bytes = VRMEditorExporter.Export(go, null, new VRMExportSettings - { - PoseFreeze = true, - }); + var settings = (VRMExportSettings)ScriptableObject.CreateInstance(); + settings.PoseFreeze = true; + bytes = VRMEditorExporter.Export(go, null, settings); } using (var data2 = new GlbLowLevelParser(AliciaPath, bytes).Parse()) @@ -95,10 +94,9 @@ namespace VRM var fp = go.GetComponent(); var lookAt = go.GetComponent(); horizontalInner = lookAt.HorizontalInner; - bytes = VRMEditorExporter.Export(go, null, new VRMExportSettings - { - PoseFreeze = false, - }); + var settings = (VRMExportSettings)ScriptableObject.CreateInstance(); + settings.PoseFreeze = false; + bytes = VRMEditorExporter.Export(go, null, settings); } using (var data2 = new GlbLowLevelParser(AliciaPath, bytes).Parse()) From 197efa5fb2524e2f4d8a8c020c1a27cca5fc3fab Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 12 Dec 2023 15:48:23 +0900 Subject: [PATCH 2/2] fix test --- Assets/VRM/Editor/Format/VRMEditorExporter.cs | 3 ++- Assets/VRM/Tests/VRMLookAtTests.cs | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Assets/VRM/Editor/Format/VRMEditorExporter.cs b/Assets/VRM/Editor/Format/VRMEditorExporter.cs index 8a047864c..74bc3a710 100644 --- a/Assets/VRM/Editor/Format/VRMEditorExporter.cs +++ b/Assets/VRM/Editor/Format/VRMEditorExporter.cs @@ -28,7 +28,8 @@ namespace VRM { foreach (var x in destroy) { - Debug.LogFormat("destroy: {0}", x.name); + // x.name がエラーを引き起こす場合がある + // Debug.LogFormat("destroy: {0}", x.name); GameObject.DestroyImmediate(x); } } diff --git a/Assets/VRM/Tests/VRMLookAtTests.cs b/Assets/VRM/Tests/VRMLookAtTests.cs index 4318da2c3..a9a07b4a3 100644 --- a/Assets/VRM/Tests/VRMLookAtTests.cs +++ b/Assets/VRM/Tests/VRMLookAtTests.cs @@ -1,4 +1,5 @@ +using System; using System.IO; using NUnit.Framework; using UniGLTF; @@ -34,8 +35,8 @@ namespace VRM var lookAt = go.AddComponent(); var settings = (VRMExportSettings)ScriptableObject.CreateInstance(); settings.PoseFreeze = true; - bytes = VRMEditorExporter.Export(go, null, settings); - } + bytes = VRMEditorExporter.Export(go, null, settings); + } using (var data2 = new GlbLowLevelParser(AliciaPath, bytes).Parse()) using (var loader2 = new VRMImporterContext(new VRMData(data2))) @@ -60,10 +61,9 @@ namespace VRM var fp = go.GetComponent(); var lookAt = go.GetComponent(); horizontalInner = lookAt.HorizontalInner; - bytes = VRMEditorExporter.Export(go, null, new VRMExportSettings - { - PoseFreeze = true, - }); + var settings = ScriptableObject.CreateInstance(); + settings.PoseFreeze = true; + bytes = VRMEditorExporter.Export(go, null, settings); } using (var data2 = new GlbLowLevelParser(AliciaPath, bytes).Parse())