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

add getter for presetNameMap #498

Merged
merged 1 commit into from
Sep 29, 2020
Merged

Conversation

Keshigom
Copy link
Contributor

VRMBlendShapeProxy へ _blendShapePresetMap の Getter の追加を提案します。

現状のVRMBlendShapeProxy.expressionsにはVRMの仕様で定義されているPresetNameではなく、ユーザーが設定するNameが格納されているためリップシンクなどの表情(A,Joy等)とその他(Unknown)の表情を区別することができません。

VRMBlendShapeProxy._blendShapePresetMapを参照することでユーザー定義の表情を区別することができるようになります。

// unknownの表情の取得
 const expressions = currentVrm.blendShapeProxy.expressions;
 const presetMap = currentVrm.blendShapeProxy.blendShapePresetMap;
 const presetExpressions = Object.values(presetMap);
 const unknownExpressions = expressions.filter(name =>
 	!presetExpressions.includes(name)
 );

@0b5vr 0b5vr self-requested a review September 29, 2020 08:48
@0b5vr 0b5vr added the enhancement New feature or request label Sep 29, 2020
@0b5vr 0b5vr added this to the next milestone Sep 29, 2020
@0b5vr
Copy link
Contributor

0b5vr commented Sep 29, 2020

ありがとうございます。この変更は良いと思います。
が、Unknownを取得するために、別にもう一つAPIを用意しちゃっても良いかなと思っています(get unknownBlendShapeNames(): string[] みたいなやつ)。
その差異、Unknownのブレンドシェイプ名は内部的に配列を持っちゃっても良いかなと思います。

@0b5vr
Copy link
Contributor

0b5vr commented Sep 29, 2020

一旦このPRはマージしてしまいます。

@0b5vr 0b5vr merged commit 35aeb45 into pixiv:dev Sep 29, 2020
@0b5vr
Copy link
Contributor

0b5vr commented Sep 30, 2020

VRM1.0ではUnknownではなくcustomというenum名になるそう。メソッド名の決定は慎重に行ったほうが良いかも

@Keshigom
Copy link
Contributor Author

変更が予定されているのでメソッド名につけるのは混乱しそうですね。
プリセット名を指定してnameを取得するのはどうでしょうか?

getExpressionNames(presetName : BlendShapePresetName) : string []

ただ、Angryなどでも複数要素が返ってくる可能性があるという誤解を招きそうな気もします。

@0b5vr
Copy link
Contributor

0b5vr commented Oct 12, 2020

enumがcustomの場合だけ例外的に複数帰ってくるパターンになるんですよね。うーん……

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants