Skip to content

Commit

Permalink
vrm-c#2463 でコンストラクターで Singleton 確保したのが仇に。
Browse files Browse the repository at this point in the history
  • Loading branch information
ousttrue committed Oct 24, 2024
1 parent 53028c8 commit 0e4bf5d
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System.Threading.Tasks;
using UniGLTF;
using UniGLTF.SpringBoneJobs.Blittables;
using UnityEngine;

namespace UniVRM10
{
/// <summary>
/// SpcriptedImporter 経由の import 向け。
/// NativeArray の確保や DontDestroyOnLoad を回避。
/// </summary>
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)
{
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion Assets/VRM10/Runtime/IO/Vrm10Importer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,24 @@ public Vrm10Importer(
m_externalMap = new Dictionary<SubAssetKey, UnityEngine.Object>();
}

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<VrmLib.Node> nodes, UniGLTF.Extensions.VRMC_vrm.HumanBone humanBone, VrmLib.HumanoidBones key)
Expand Down
1 change: 1 addition & 0 deletions ProjectSettings/QualitySettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ QualitySettings:
PSM: 5
PSP2: 2
Samsung TV: 2
Server: 0
Standalone: 5
Switch: 5
Tizen: 2
Expand Down

0 comments on commit 0e4bf5d

Please sign in to comment.