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

Fix nullcheck #432

Merged
merged 2 commits into from
Jun 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Assets/VRM/UniHumanoid/Editor/BoneMappingEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,12 @@ private void OnSceneGUI()
{
DrawBone((HumanBodyBones)i, bones[i]);
}
foreach(var x in m_bones)
if (m_bones != null)
{
x.Draw();
foreach (var x in m_bones)
{
x.Draw();
}
}
}
}
Expand Down
21 changes: 12 additions & 9 deletions Assets/VRM/UniVRM/Editor/Format/VRMEditorExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,22 +127,25 @@ static void Export(string path, VRMExportSettings settings, List<GameObject> des
if (settings.PoseFreeze)
{
// BoneNormalizer.Execute は Copy を作って正規化する。UNDO無用
target = BoneNormalizer.Execute(target, settings.ForceTPose, false);
target = BoneNormalizer.Execute(target, settings.ForceTPose, false);
destroy.Add(target);
}

// 元のBlendShapeClipに変更を加えないように複製
var proxy = target.GetComponent<VRMBlendShapeProxy>();
var copyBlendShapeAvatar = CopyBlendShapeAvatar(proxy.BlendShapeAvatar, settings.ReduceBlendshapeClip);
proxy.BlendShapeAvatar = copyBlendShapeAvatar;

// BlendShape削減
if (settings.ReduceBlendshape)
if (proxy != null)
{
foreach (SkinnedMeshRenderer smr in target.GetComponentsInChildren<SkinnedMeshRenderer>())
var copyBlendShapeAvatar = CopyBlendShapeAvatar(proxy.BlendShapeAvatar, settings.ReduceBlendshapeClip);
proxy.BlendShapeAvatar = copyBlendShapeAvatar;

// BlendShape削減
if (settings.ReduceBlendshape)
{
// 未使用のBlendShapeを間引く
ReplaceMesh(target, smr, copyBlendShapeAvatar);
foreach (SkinnedMeshRenderer smr in target.GetComponentsInChildren<SkinnedMeshRenderer>())
{
// 未使用のBlendShapeを間引く
ReplaceMesh(target, smr, copyBlendShapeAvatar);
}
}
}

Expand Down