-
Notifications
You must be signed in to change notification settings - Fork 412
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
[Mesh統合] glb/vrm-0/vrm-1 の Mesh統合 Utility を整理 #2187
[Mesh統合] glb/vrm-0/vrm-1 の Mesh統合 Utility を整理 #2187
Conversation
- prefab 時は instance 化する。統合グループをの内容をインスタンス後のもので置き換える - 未使用削除
automatically force when createAvatar
using UnityEditor; | ||
using UnityEditorInternal; | ||
using UnityEngine; | ||
|
||
namespace UniVRM10 | ||
namespace UniGLTF.MeshUtility |
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.
共通機能。UniGLTF に移動
// Meshの焼きこみ | ||
var newMesh = BoneNormalizer.NormalizeHierarchyFreezeMesh(go, true); | ||
// 焼いたMeshで置き換える | ||
BoneNormalizer.Replace(go, newMesh, true, true); |
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.
Mesh を焼くのと、焼いた Mesh を Renderer に挿すを分けた。
挿すときに Transform.rotation / scale のクリアをする。
/// <summary> | ||
/// Meshを統合し、統合後のMeshのBlendShapeの変化をVRMのBlendShapeClipに反映する | ||
/// </summary> | ||
public class VrmBlendShapeUpdater |
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.
Mesh統合でずれるBlendShape参照を追随させる
|
||
namespace UniGLTF.MeshUtility | ||
{ | ||
public class MeshAttachInfo |
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.
Mesh を焼いたときに Renderer を置き換えるのをやめたので、
置き換え情報を蓄える。
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.
LGTM。
書いたところは 🍰
public void WriteAndReload(string assetPath) | ||
{ | ||
AssetDatabase.CreateAsset(IntegratedRenderer.sharedMesh, assetPath); | ||
var unityPath = UnityPath.FromUnityPath(assetPath); | ||
unityPath.ImportAsset(); | ||
var mesh = unityPath.LoadAsset<Mesh>(); | ||
// replace reloaded | ||
IntegratedRenderer.sharedMesh = mesh; | ||
} |
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.
これ、処理は public な状態を読み書きしているので、関数自体は Editor の asmdef に押しやれそうな気はします。
(プリプロセッサなくしたい)
} | ||
else | ||
{ | ||
#if VRM_DEVELOP |
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.
プリプロセッサ外したとしてもコンパイルエラーになるコードではないので
if (Symbols.VRM_DEVELOP)
としてほしいかも
{ | ||
var childAssetPath = $"{assetFolder}/{result.Integrated.IntegratedRenderer.gameObject.name}{ASSET_SUFFIX}"; | ||
Debug.LogFormat("CreateAsset: {0}", childAssetPath); | ||
AssetDatabase.CreateAsset(result.Integrated.IntegratedRenderer.sharedMesh, childAssetPath); |
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.
AssetDatabase.CreateAsset を後続の result.Integrated.Reload から移動
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.
LGTM
共通機能を glb 版の runtime 動作に実装した。
重複していた部分などを整理。
freeze(bake) => 統合 => 分割
統合対象を
ブラックリストで除外するのを、
ホワイトリストで列挙する様に変えた。