From 0e4bf5da06d295caaf560df14fc05a04e39f3d5e Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 24 Oct 2024 16:43:30 +0900 Subject: [PATCH] =?UTF-8?q?#2463=20=E3=81=A7=E3=82=B3=E3=83=B3=E3=82=B9?= =?UTF-8?q?=E3=83=88=E3=83=A9=E3=82=AF=E3=82=BF=E3=83=BC=E3=81=A7=20Single?= =?UTF-8?q?ton=20=E7=A2=BA=E4=BF=9D=E3=81=97=E3=81=9F=E3=81=AE=E3=81=8C?= =?UTF-8?q?=E4=BB=87=E3=81=AB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Vrm10Runtime/Vrm10NopSpringboneRuntime.cs | 44 +++++++++++++++++++ .../Vrm10NopSpringboneRuntime.cs.meta | 11 +++++ Assets/VRM10/Runtime/IO/Vrm10Importer.cs | 19 +++++++- ProjectSettings/QualitySettings.asset | 1 + 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 Assets/VRM10/Runtime/Components/Vrm10Runtime/Vrm10NopSpringboneRuntime.cs create mode 100644 Assets/VRM10/Runtime/Components/Vrm10Runtime/Vrm10NopSpringboneRuntime.cs.meta diff --git a/Assets/VRM10/Runtime/Components/Vrm10Runtime/Vrm10NopSpringboneRuntime.cs b/Assets/VRM10/Runtime/Components/Vrm10Runtime/Vrm10NopSpringboneRuntime.cs new file mode 100644 index 0000000000..30f26068d0 --- /dev/null +++ b/Assets/VRM10/Runtime/Components/Vrm10Runtime/Vrm10NopSpringboneRuntime.cs @@ -0,0 +1,44 @@ +using System.Threading.Tasks; +using UniGLTF; +using UniGLTF.SpringBoneJobs.Blittables; +using UnityEngine; + +namespace UniVRM10 +{ + /// + /// SpcriptedImporter 経由の import 向け。 + /// NativeArray の確保や DontDestroyOnLoad を回避。 + /// + public class Vrm10NopSpringboneRuntime : IVrm10SpringBoneRuntime + { + public void Dispose() + { + } + + public Task InitializeAsync(Vrm10Instance instance, IAwaitCaller awaitCaller) + { + return Task.CompletedTask; + } + + public void Process() + { + } + + public bool ReconstructSpringBone() + { + return false; + } + + public void RestoreInitialTransform() + { + } + + public void SetJointLevel(Transform joint, BlittableJointMutable jointSettings) + { + } + + public void SetModelLevel(Transform modelRoot, BlittableModelLevel modelSettings) + { + } + } +} \ No newline at end of file diff --git a/Assets/VRM10/Runtime/Components/Vrm10Runtime/Vrm10NopSpringboneRuntime.cs.meta b/Assets/VRM10/Runtime/Components/Vrm10Runtime/Vrm10NopSpringboneRuntime.cs.meta new file mode 100644 index 0000000000..cb64688e30 --- /dev/null +++ b/Assets/VRM10/Runtime/Components/Vrm10Runtime/Vrm10NopSpringboneRuntime.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b58249c702cd4054480f69562b43b0b7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10/Runtime/IO/Vrm10Importer.cs b/Assets/VRM10/Runtime/IO/Vrm10Importer.cs index 440143db38..c3c05ff387 100644 --- a/Assets/VRM10/Runtime/IO/Vrm10Importer.cs +++ b/Assets/VRM10/Runtime/IO/Vrm10Importer.cs @@ -54,7 +54,24 @@ public Vrm10Importer( m_externalMap = new Dictionary(); } - m_springboneRuntime = springboneRuntime ?? new Vrm10FastSpringboneRuntime(); + m_springboneRuntime = MakeDefaultRuntime(springboneRuntime, isAssetImport); + } + + static IVrm10SpringBoneRuntime MakeDefaultRuntime(IVrm10SpringBoneRuntime runtime, bool isAssetImport) + { + if (runtime != null) + { + return runtime; + } + + if (isAssetImport) + { + // 何もしない dummy + return new Vrm10NopSpringboneRuntime(); + } + + // Vrm10Instance.MakeRuntime に移譲 + return null; } static void AssignHumanoid(List nodes, UniGLTF.Extensions.VRMC_vrm.HumanBone humanBone, VrmLib.HumanoidBones key) diff --git a/ProjectSettings/QualitySettings.asset b/ProjectSettings/QualitySettings.asset index 785dd573c3..dc07d28e48 100644 --- a/ProjectSettings/QualitySettings.asset +++ b/ProjectSettings/QualitySettings.asset @@ -230,6 +230,7 @@ QualitySettings: PSM: 5 PSP2: 2 Samsung TV: 2 + Server: 0 Standalone: 5 Switch: 5 Tizen: 2