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

runtime に BlendShapeProxy.m_merger を再初期化する #1720

Merged
merged 3 commits into from Jun 29, 2022

Conversation

ousttrue
Copy link
Contributor

@ousttrue ousttrue commented Jun 28, 2022

fixed #1710

@ousttrue ousttrue requested a review from Santarh June 28, 2022 05:30
@ousttrue ousttrue added this to the v0.101 milestone Jun 28, 2022
Copy link
Contributor

@Santarh Santarh left a comment

Choose a reason for hiding this comment

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

Breaking change が多そうなので意図しているのかどうかで気になりポイントです

@@ -44,9 +53,10 @@ private void Start()
/// <param name="value"></param>
public void ImmediatelySetValue(BlendShapeKey key, float value)
{
if (m_merger != null)
var merger = Merger;
if (merger != null)
Copy link
Contributor

Choose a reason for hiding this comment

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

挙動が変わってしまっている点が気になります。

Start() するより前の段階で ImmediatelySetValue() を呼び出すとその状態で初期化され SetValue が走ってしまう、ということになってしまっていると思います。

{
m_merger = new BlendShapeMerger(BlendShapeAvatar.Clips, transform);
}
m_merger.RestoreMaterialInitialValues(BlendShapeAvatar.Clips);
Copy link
Contributor

Choose a reason for hiding this comment

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

これが Destroy されたあとにアクセスされることを考えると

正確にはここで bool isDisposed という変数に対して true を代入しておいて
Mergergetter では if (isDisposed) return null; というのを書いた方がよさそうです。

@ousttrue
Copy link
Contributor Author

Clear をやめて Reinitialize に変えます

@ousttrue ousttrue requested a review from Santarh June 28, 2022 08:02
}
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

変化が少なくなるように、 Clear をやめて Restart に変更しました。

Copy link
Contributor

Choose a reason for hiding this comment

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

Reinitialize() などの方が命名としてはしっくりくるが、どうだろう。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://github.com/vrm-c/UniVRM/pull/1720/files#diff-21b8031f1a91629b829104f5142d6dd823982723e6e52be3f2bdc85dea128373R30-R39

と内容がほぼ同じ。ということは Start を呼ぶ関数にしよう 🤔

Santarh
Santarh previously approved these changes Jun 29, 2022
Copy link
Contributor

@Santarh Santarh left a comment

Choose a reason for hiding this comment

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

よさそう。ただ Restart という名前だとなんだか気軽に呼んでいいような感じにも読める(別に気軽に呼んでもなんも起きないけど)

}
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Reinitialize() などの方が命名としてはしっくりくるが、どうだろう。

Copy link
Contributor

@Santarh Santarh 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 efdbef5 into vrm-c:master Jun 29, 2022
@ousttrue ousttrue deleted the feature/VRMBlendShapeProxy.Clear branch January 24, 2024 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RuntimeでBlendShapeAvatarを編集できるように対応していただきたい
2 participants