-
Notifications
You must be signed in to change notification settings - Fork 426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[springbone] SpringBone が無いモデルの NullReferenceException を修正 #2463
Changes from all commits
fcd4a93
6402d55
d917735
e8f221a
b7b44a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,10 +22,14 @@ public class Vrm0XFastSpringboneRuntime : IVrm0XSpringBoneRuntime | |
SpringBoneJobs.FastSpringBoneService m_service; | ||
FastSpringBoneBuffer m_buffer; | ||
|
||
public Vrm0XFastSpringboneRuntime() | ||
{ | ||
m_service = SpringBoneJobs.FastSpringBoneService.Instance; | ||
} | ||
|
||
public async Task InitializeAsync(GameObject vrm, IAwaitCaller awaitCaller) | ||
{ | ||
m_vrm = vrm; | ||
m_service = SpringBoneJobs.FastSpringBoneService.Instance; | ||
|
||
// default update の停止 | ||
foreach (VRMSpringBone sb in vrm.GetComponentsInChildren<VRMSpringBone>()) | ||
|
@@ -69,9 +73,8 @@ async Task RegisterAsync(IAwaitCaller awaitCaller) | |
|
||
public void ReconstructSpringBone() | ||
{ | ||
var disposer = m_vrm.gameObject.GetComponent<FastSpringBoneDisposer>(); | ||
Unregister(); | ||
var task = RegisterAsync(new ImmediateCaller()); | ||
var _ = RegisterAsync(new ImmediateCaller()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不要コードの削除など |
||
} | ||
|
||
public void RestoreInitialTransform() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,11 @@ public class Vrm10FastSpringboneRuntime : IVrm10SpringBoneRuntime | |
private FastSpringBones.FastSpringBoneService m_fastSpringBoneService; | ||
private FastSpringBoneBuffer m_fastSpringBoneBuffer; | ||
|
||
public Vrm10FastSpringboneRuntime() | ||
{ | ||
m_fastSpringBoneService = FastSpringBones.FastSpringBoneService.Instance; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. VRMC_springBone が無い時にも InitializeAsync するようにしたので、 |
||
|
||
public void SetJointLevel(Transform joint, BlittableJointMutable jointSettings) | ||
{ | ||
if (m_fastSpringBoneService.BufferCombiner.Combined is FastSpringBoneCombinedBuffer combined) | ||
|
@@ -37,7 +42,6 @@ public void SetModelLevel(Transform modelRoot, BlittableModelLevel modelSettings | |
|
||
public async Task InitializeAsync(Vrm10Instance instance, IAwaitCaller awaitCaller) | ||
{ | ||
m_fastSpringBoneService = FastSpringBones.FastSpringBoneService.Instance; | ||
m_instance = instance; | ||
|
||
// NOTE: FastSpringBoneService は UnitTest などでは動作しない | ||
|
@@ -49,8 +53,11 @@ public async Task InitializeAsync(Vrm10Instance instance, IAwaitCaller awaitCall | |
|
||
public void Dispose() | ||
{ | ||
m_fastSpringBoneService.BufferCombiner.Unregister(m_fastSpringBoneBuffer); | ||
m_fastSpringBoneBuffer.Dispose(); | ||
if (m_fastSpringBoneBuffer != null) | ||
{ | ||
m_fastSpringBoneService.BufferCombiner.Unregister(m_fastSpringBoneBuffer); | ||
m_fastSpringBoneBuffer.Dispose(); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. VRMC_springBone が無い時にも InitializeAsync するようにしたので、 |
||
} | ||
|
||
/// <summary> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -286,14 +286,15 @@ protected override async Task FinalizeAsync(IAwaitCaller awaitCaller) | |
if (UniGLTF.Extensions.VRMC_springBone.GltfDeserializer.TryGet(Data.GLTF.extensions, out UniGLTF.Extensions.VRMC_springBone.VRMC_springBone springBone)) | ||
{ | ||
await LoadSpringBoneAsync(awaitCaller, controller, springBone); | ||
} | ||
|
||
if (Application.isPlaying) | ||
{ | ||
// EditorImport では呼ばない | ||
// Vrm10Runtime で初期化していたが、 async にするためこちらに移動 v0.127 | ||
// RuntimeGltfInstance にアクセスしたいのだが OnLoadHierarchy ではまだ attach されてなかった v0.128 | ||
await m_springboneRuntime.InitializeAsync(controller, awaitCaller); | ||
} | ||
if (Application.isPlaying) | ||
{ | ||
// EditorImport では呼ばない | ||
// Vrm10Runtime で初期化していたが、 async にするためこちらに移動 v0.127 | ||
// RuntimeGltfInstance にアクセスしたいのだが OnLoadHierarchy ではまだ attach されてなかった v0.128 | ||
// VRMC_springBone が無くても初期化する v0.127.2 | ||
await m_springboneRuntime.InitializeAsync(controller, awaitCaller); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. VRMC_springBone の有無と無関係に初期化する |
||
} | ||
|
||
// constraint | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VRMC_springBone が無い時にも InitializeAsync するようにしたので、
無くても大丈夫になったが、初期化を遅延させる意味も無いので constructor。