From fa81fb5e362a666c1fcfbd8c81c2d9b4d44bebbc Mon Sep 17 00:00:00 2001 From: Tiger Tang Date: Tue, 29 Apr 2025 04:38:13 -0700 Subject: [PATCH 1/9] Fix NativeArrayManager compatibility with Unity 2022.1 and older versions --- Assets/UniGLTF/Runtime/UniGLTF/IO/NativeArrayManager.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/NativeArrayManager.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/NativeArrayManager.cs index 3fdce7985..58e0b833b 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/NativeArrayManager.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/NativeArrayManager.cs @@ -69,9 +69,14 @@ namespace UniGLTF public NativeArray CreateNativeArray(ArraySegment data) where T : struct { var array = CreateNativeArray(data.Count); +#if UNITY_2022_2_OR_NEWER var toSpan = array.AsSpan(); var fromSpan = data.AsSpan(); fromSpan.CopyTo(toSpan); +#else + for (int i = 0; i < data.Count; i++) + array[i] = data.Array[data.Offset + i]; +#endif return array; } From 0ade61d0c38817fb230900d1dbb4a9c21e95c6c4 Mon Sep 17 00:00:00 2001 From: Masataka SUMI Date: Sat, 3 May 2025 02:00:08 +0900 Subject: [PATCH 2/9] Revert Handle Gizmo in VRM0X SpringBone Collider Group --- .../VRMSpringBoneColliderGroupEditor.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Assets/VRM/Editor/SpringBone/VRMSpringBoneColliderGroupEditor.cs b/Assets/VRM/Editor/SpringBone/VRMSpringBoneColliderGroupEditor.cs index fee110aa3..9c2576196 100644 --- a/Assets/VRM/Editor/SpringBone/VRMSpringBoneColliderGroupEditor.cs +++ b/Assets/VRM/Editor/SpringBone/VRMSpringBoneColliderGroupEditor.cs @@ -16,6 +16,30 @@ namespace VRM m_target = (VRMSpringBoneColliderGroup)target; } + private void OnSceneGUI() + { + Undo.RecordObject(m_target, "VRMSpringBoneColliderGroupEditor"); + + Handles.matrix = m_target.transform.localToWorldMatrix; + Gizmos.color = Color.green; + + bool changed = false; + + foreach (var x in m_target.Colliders) + { + var offset = Handles.PositionHandle(x.Offset, Quaternion.identity); + if (offset != x.Offset) + { + changed = true; + x.Offset = offset; + } + } + + if (changed) + { + EditorUtility.SetDirty(m_target); + } + } override public void OnInspectorGUI() { From 202246628f678632669a3927dff92f1a7c318d34 Mon Sep 17 00:00:00 2001 From: Masataka SUMI Date: Sat, 3 May 2025 02:07:34 +0900 Subject: [PATCH 3/9] add menu in VRM0.X SpringBone ColliderGroup --- .../VRMSpringBoneColliderGroupEditor.cs | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/Assets/VRM/Editor/SpringBone/VRMSpringBoneColliderGroupEditor.cs b/Assets/VRM/Editor/SpringBone/VRMSpringBoneColliderGroupEditor.cs index 9c2576196..096cbfa45 100644 --- a/Assets/VRM/Editor/SpringBone/VRMSpringBoneColliderGroupEditor.cs +++ b/Assets/VRM/Editor/SpringBone/VRMSpringBoneColliderGroupEditor.cs @@ -79,6 +79,28 @@ namespace VRM target.Colliders = target.Colliders.OrderBy(x => -x.Radius).ToArray(); } + [MenuItem("CONTEXT/VRMSpringBoneColliderGroup/Sort Colliders Reversed")] + private static void SortReverse(MenuCommand command) + { + var target = command.context as VRMSpringBoneColliderGroup; + if (target == null) return; + + Undo.RecordObject(target, "Sort Colliders Reversed"); + + target.Colliders = target.Colliders.Reverse().ToArray(); + } + + [MenuItem("CONTEXT/VRMSpringBoneColliderGroup/Sort Colliders by Offset X")] + private static void SortByOffsetX(MenuCommand command) + { + var target = command.context as VRMSpringBoneColliderGroup; + if (target == null) return; + + Undo.RecordObject(target, "Sort Colliders by Offset X"); + + target.Colliders = target.Colliders.OrderBy(x => x.Offset.x).ToArray(); + } + [MenuItem("CONTEXT/VRMSpringBoneColliderGroup/Sort Colliders by Offset Y")] private static void SortByOffsetY(MenuCommand command) { @@ -87,7 +109,18 @@ namespace VRM Undo.RecordObject(target, "Sort Colliders by Offset Y"); - target.Colliders = target.Colliders.OrderBy(x => -x.Offset.y).ToArray(); + target.Colliders = target.Colliders.OrderBy(x => x.Offset.y).ToArray(); + } + + [MenuItem("CONTEXT/VRMSpringBoneColliderGroup/Sort Colliders by Offset Z")] + private static void SortByOffsetZ(MenuCommand command) + { + var target = command.context as VRMSpringBoneColliderGroup; + if (target == null) return; + + Undo.RecordObject(target, "Sort Colliders by Offset Z"); + + target.Colliders = target.Colliders.OrderBy(x => x.Offset.z).ToArray(); } } } From 42dbc61b91e7b2739125a6da43fe50a6c0a6f45c Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 12 May 2025 16:08:56 +0900 Subject: [PATCH 4/9] dependencies for empty Packages\manifest.json --- Assets/UniGLTF/package.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Assets/UniGLTF/package.json b/Assets/UniGLTF/package.json index c04ee73c8..5dd5c10b4 100644 --- a/Assets/UniGLTF/package.json +++ b/Assets/UniGLTF/package.json @@ -11,7 +11,10 @@ "name": "VRM Consortium" }, "dependencies": { - "com.unity.modules.animation": "1.0.0" + "com.unity.modules.animation": "1.0.0", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.imageconversion": "1.0.0", + "com.unity.feature.development": "1.0.1" }, "samples": [ { @@ -20,4 +23,4 @@ "path": "Samples~/GltfViewer" } ] -} \ No newline at end of file +} From 7e819b8019e89cbe28be351908bc047057e04472 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 12 May 2025 19:54:56 +0900 Subject: [PATCH 5/9] =?UTF-8?q?RuntimeGltfInstance=20=E3=81=8C=E7=84=A1?= =?UTF-8?q?=E3=81=84=E5=A0=B4=E5=90=88=E3=81=AB=20NullReferenceException?= =?UTF-8?q?=20=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Vrm10Instance/Vrm10Instance.cs | 13 ++++++++++++- .../Components/Vrm10Runtime/Vrm10Runtime.cs | 18 +++++++----------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Assets/VRM10/Runtime/Components/Vrm10Instance/Vrm10Instance.cs b/Assets/VRM10/Runtime/Components/Vrm10Instance/Vrm10Instance.cs index 5ee3fc67e..c8cacae73 100644 --- a/Assets/VRM10/Runtime/Components/Vrm10Instance/Vrm10Instance.cs +++ b/Assets/VRM10/Runtime/Components/Vrm10Instance/Vrm10Instance.cs @@ -139,7 +139,18 @@ namespace UniVRM10 { // importer 内で InitializeAsync が呼び出し済み } - return new Vrm10Runtime(this, useControlRig, m_springBoneRuntime); + + var runtime = GetComponent(); + + // Vrm10Runtimeが使う初期姿勢を固定する。SpringBone や Constraint の初期姿勢になる。 + var initPose = runtime != null + // RuntimeGltfInstance があるとき => RuntimeLoad => 初期姿勢は glTF の node に由来する + ? runtime.InitialTransformStates.ToDictionary((kv) => kv.Key, (kv) => kv.Value) + // RuntimeGltfInstance が無いとき => Scene 配置の prefab など。シーンの現状を代用する。既に T-Pose でないかもしれない。 + : GetComponentsInChildren().ToDictionary(x => x, x => new TransformState(x)) + ; + + return new Vrm10Runtime(this, useControlRig, m_springBoneRuntime, initPose); } public Vrm10Runtime Runtime diff --git a/Assets/VRM10/Runtime/Components/Vrm10Runtime/Vrm10Runtime.cs b/Assets/VRM10/Runtime/Components/Vrm10Runtime/Vrm10Runtime.cs index 3d628b13d..c6e8661e2 100644 --- a/Assets/VRM10/Runtime/Components/Vrm10Runtime/Vrm10Runtime.cs +++ b/Assets/VRM10/Runtime/Components/Vrm10Runtime/Vrm10Runtime.cs @@ -49,25 +49,21 @@ namespace UniVRM10 } } - Dictionary _initPose; + IReadOnlyDictionary _initPose; - public Vrm10Runtime(Vrm10Instance instance, bool useControlRig, IVrm10SpringBoneRuntime springBoneRuntime) + public Vrm10Runtime(Vrm10Instance instance, bool useControlRig, IVrm10SpringBoneRuntime springBoneRuntime, + IReadOnlyDictionary initPose) { if (!Application.isPlaying) { UniGLTFLogger.Warning($"{nameof(Vrm10Runtime)} expects runtime behaviour."); } - if (instance == null) - { - m_instance = null; - return; - } - if (m_instance != instance) + _initPose = initPose; + m_instance = instance; + if (m_instance == null) { - m_instance = instance; - var runtime = m_instance.GetComponent(); - _initPose = runtime.InitialTransformStates.ToDictionary((kv) => kv.Key, (kv) => kv.Value); + return; } if (!instance.TryGetBoneTransform(HumanBodyBones.Head, out m_head)) From 271d2ae6b6dbede8a84d4f995d8037c9d2b3433e Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 14 May 2025 13:27:55 +0900 Subject: [PATCH 6/9] =?UTF-8?q?=E7=94=9F=E6=88=90=E5=85=83=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/UniGLTF/package.json | 2 +- Assets/VRM/Editor/Format/VRMVersionMenu.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Assets/UniGLTF/package.json b/Assets/UniGLTF/package.json index 5dd5c10b4..30c60ea66 100644 --- a/Assets/UniGLTF/package.json +++ b/Assets/UniGLTF/package.json @@ -23,4 +23,4 @@ "path": "Samples~/GltfViewer" } ] -} +} \ No newline at end of file diff --git a/Assets/VRM/Editor/Format/VRMVersionMenu.cs b/Assets/VRM/Editor/Format/VRMVersionMenu.cs index 86266ed4b..e0a0a94e9 100644 --- a/Assets/VRM/Editor/Format/VRMVersionMenu.cs +++ b/Assets/VRM/Editor/Format/VRMVersionMenu.cs @@ -169,7 +169,10 @@ namespace UniGLTF ""name"": ""VRM Consortium"" }}, ""dependencies"": {{ - ""com.unity.modules.animation"": ""1.0.0"" + ""com.unity.modules.animation"": ""1.0.0"", + ""com.unity.modules.imgui"": ""1.0.0"", + ""com.unity.modules.imageconversion"": ""1.0.0"", + ""com.unity.feature.development"": ""1.0.1"" }}, ""samples"": [ {{ From 95023ed299b9911217560654c82bd61f1b362f7d Mon Sep 17 00:00:00 2001 From: matsutaka Date: Thu, 15 May 2025 10:43:42 +0900 Subject: [PATCH 7/9] chore: Reuse positions to eliminate redundant ToArray() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since local variable positions[] always contains valid result of blendShape.Positions.ToArray(), we can reuse it to eliminate redundant ToArray() which also causes extra GC Alloc. ローカル変数 positions[] は常に正しい blendShape.Positions.ToArray() の 結果を保持しているので、これを再利用することで余分な ToArray() および GC Alloc を抑制することができます。 --- Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshUploader.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshUploader.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshUploader.cs index 63f5dbebb..99adf2c88 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshUploader.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshUploader.cs @@ -56,12 +56,12 @@ namespace UniGLTF }); Profiler.BeginSample("MeshUploader.BuildBlendShapeAsync"); - if (blendShape.Positions.Count > 0) + if (positions.Length > 0) { - if (blendShape.Positions.Count == mesh.vertexCount) + if (positions.Length == mesh.vertexCount) { mesh.AddBlendShapeFrame(blendShape.Name, FrameWeight, - blendShape.Positions.ToArray(), + positions, normals.Length == mesh.vertexCount && normals.Length == positions.Length ? normals : null, null ); From 766d2f2caed3d87e017ba5ff82753bd76b9692e2 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 15 May 2025 14:52:17 +0900 Subject: [PATCH 8/9] "com.unity.test-framework": "1.4.6" from "com.unity.feature.development": "1.0.1" --- Assets/UniGLTF/package.json | 2 +- Assets/VRM/Editor/Format/VRMVersionMenu.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/UniGLTF/package.json b/Assets/UniGLTF/package.json index 30c60ea66..8fa3066af 100644 --- a/Assets/UniGLTF/package.json +++ b/Assets/UniGLTF/package.json @@ -14,7 +14,7 @@ "com.unity.modules.animation": "1.0.0", "com.unity.modules.imgui": "1.0.0", "com.unity.modules.imageconversion": "1.0.0", - "com.unity.feature.development": "1.0.1" + "com.unity.test-framework": "1.4.6" }, "samples": [ { diff --git a/Assets/VRM/Editor/Format/VRMVersionMenu.cs b/Assets/VRM/Editor/Format/VRMVersionMenu.cs index e0a0a94e9..65514ae25 100644 --- a/Assets/VRM/Editor/Format/VRMVersionMenu.cs +++ b/Assets/VRM/Editor/Format/VRMVersionMenu.cs @@ -172,7 +172,7 @@ namespace UniGLTF ""com.unity.modules.animation"": ""1.0.0"", ""com.unity.modules.imgui"": ""1.0.0"", ""com.unity.modules.imageconversion"": ""1.0.0"", - ""com.unity.feature.development"": ""1.0.1"" + ""com.unity.test-framework"": ""1.4.6"" }}, ""samples"": [ {{ From d113c030a26755642129d46ab45b92d0d3614f17 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 15 May 2025 15:04:49 +0900 Subject: [PATCH 9/9] UniVRM-0.129.1 --- Assets/UniGLTF/Runtime/UniGLTF/PackageVersion.cs | 4 ++-- Assets/UniGLTF/Runtime/UniGLTF/UniGLTFVersion.cs | 4 ++-- Assets/UniGLTF/package.json | 2 +- Assets/VRM/package.json | 4 ++-- Assets/VRM10/package.json | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/PackageVersion.cs b/Assets/UniGLTF/Runtime/UniGLTF/PackageVersion.cs index 95405defb..8261452a4 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/PackageVersion.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/PackageVersion.cs @@ -5,7 +5,7 @@ namespace UniGLTF { public const int MAJOR = 0; public const int MINOR = 129; - public const int PATCH = 0; - public const string VERSION = "0.129.0"; + public const int PATCH = 1; + public const string VERSION = "0.129.1"; } } diff --git a/Assets/UniGLTF/Runtime/UniGLTF/UniGLTFVersion.cs b/Assets/UniGLTF/Runtime/UniGLTF/UniGLTFVersion.cs index 46eda9198..b81fd8008 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/UniGLTFVersion.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/UniGLTFVersion.cs @@ -5,7 +5,7 @@ namespace UniGLTF { public const int MAJOR = 2; public const int MINOR = 65; - public const int PATCH = 0; - public const string VERSION = "2.65.0"; + public const int PATCH = 1; + public const string VERSION = "2.65.1"; } } diff --git a/Assets/UniGLTF/package.json b/Assets/UniGLTF/package.json index 8fa3066af..378ea1c48 100644 --- a/Assets/UniGLTF/package.json +++ b/Assets/UniGLTF/package.json @@ -1,6 +1,6 @@ { "name": "com.vrmc.gltf", - "version": "0.129.0", + "version": "0.129.1", "displayName": "UniGLTF", "description": "GLTF importer and exporter", "unity": "2021.3", diff --git a/Assets/VRM/package.json b/Assets/VRM/package.json index 6eaa69bc8..07572e3f1 100644 --- a/Assets/VRM/package.json +++ b/Assets/VRM/package.json @@ -1,6 +1,6 @@ { "name": "com.vrmc.univrm", - "version": "0.129.0", + "version": "0.129.1", "displayName": "VRM", "description": "VRM importer", "unity": "2021.3", @@ -14,7 +14,7 @@ "name": "VRM Consortium" }, "dependencies": { - "com.vrmc.gltf": "0.129.0", + "com.vrmc.gltf": "0.129.1", "com.unity.ugui": "1.0.0" }, "samples": [ diff --git a/Assets/VRM10/package.json b/Assets/VRM10/package.json index 4d1b6bf6d..c9dd836eb 100644 --- a/Assets/VRM10/package.json +++ b/Assets/VRM10/package.json @@ -1,6 +1,6 @@ { "name": "com.vrmc.vrm", - "version": "0.129.0", + "version": "0.129.1", "displayName": "VRM-1.0", "description": "VRM-1.0 importer", "unity": "2021.3", @@ -15,7 +15,7 @@ }, "dependencies": { "com.unity.timeline": "1.7.6", - "com.vrmc.gltf": "0.129.0" + "com.vrmc.gltf": "0.129.1" }, "samples": [ {