Skip to content
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

Merged
merged 5 commits into from
Oct 22, 2024

Conversation

ousttrue
Copy link
Contributor

@ousttrue ousttrue commented Oct 16, 2024

多段に NullReferenceException の可能性があるのでちょっと整理する。

runtime service combiner combined
Vrm0XFastSpringboneRuntime ok OnEnable/OnDisable ReconstructBuffers/Dispose
Vrm10FastSpringboneRuntime ok OnEnable/OnDisable ReconstructBuffers/Dispose
Vrm10FastSpringboneRuntimeStandalone -- new/Dispose ReconstructBuffers/Dispose
  • service と combiner は null でないことを期待してよい
  • combined は null かもしれない(null check している)

という API でよさそう。

@ousttrue ousttrue requested a review from Santarh October 16, 2024 08:45
@ousttrue ousttrue changed the title [springbone] SpringBone が無いモデルの NullReferenceException を修正 [WIP] [springbone] SpringBone が無いモデルの NullReferenceException を修正 Oct 16, 2024
// Vrm10Runtime で初期化していたが、 async にするためこちらに移動 v0.127
// RuntimeGltfInstance にアクセスしたいのだが OnLoadHierarchy ではまだ attach されてなかった v0.128
// VRMC_springBone が無くても初期化する v0.127.2
await m_springboneRuntime.InitializeAsync(controller, awaitCaller);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VRMC_springBone の有無と無関係に初期化する

{
m_service = SpringBoneJobs.FastSpringBoneService.Instance;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VRMC_springBone が無い時にも InitializeAsync するようにしたので、
無くても大丈夫になったが、初期化を遅延させる意味も無いので constructor。

Unregister();
var task = RegisterAsync(new ImmediateCaller());
var _ = RegisterAsync(new ImmediateCaller());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要コードの削除など

public Vrm10FastSpringboneRuntime()
{
m_fastSpringBoneService = FastSpringBones.FastSpringBoneService.Instance;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VRMC_springBone が無い時にも InitializeAsync するようにしたので、
無くても大丈夫になったが、初期化を遅延させる意味も無いので constructor。

{
m_fastSpringBoneService.BufferCombiner.Unregister(m_fastSpringBoneBuffer);
m_fastSpringBoneBuffer.Dispose();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VRMC_springBone が無い時にも InitializeAsync するようにしたので、
無くても大丈夫になった。

@ousttrue ousttrue changed the title [WIP] [springbone] SpringBone が無いモデルの NullReferenceException を修正 [springbone] SpringBone が無いモデルの NullReferenceException を修正 Oct 16, 2024
@s-iwaki-d s-iwaki-d requested review from mojopon and removed request for Santarh October 21, 2024 09:17
Copy link

@mojopon mojopon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ousttrue ousttrue merged commit b587037 into vrm-c:master Oct 22, 2024
1 check passed
@ousttrue ousttrue deleted the fix/springbone_runtime_init_null branch October 22, 2024 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants