diff --git a/Assets/VRM/UniVRM/Editor/Format/VRMEditorExporter.cs b/Assets/VRM/UniVRM/Editor/Format/VRMEditorExporter.cs
index 5c2474ebd..31fa03581 100644
--- a/Assets/VRM/UniVRM/Editor/Format/VRMEditorExporter.cs
+++ b/Assets/VRM/UniVRM/Editor/Format/VRMEditorExporter.cs
@@ -42,12 +42,16 @@ namespace VRM
///
///
///
- static BlendShapeAvatar CopyBlendShapeAvatar(BlendShapeAvatar src)
+ static BlendShapeAvatar CopyBlendShapeAvatar(BlendShapeAvatar src, bool removeUnknown)
{
var avatar = GameObject.Instantiate(src);
avatar.Clips = new List();
foreach (var clip in src.Clips)
{
+ if (removeUnknown && clip.Preset == BlendShapePreset.Unknown)
+ {
+ continue;
+ }
avatar.Clips.Add(GameObject.Instantiate(clip));
}
return avatar;
@@ -128,16 +132,14 @@ namespace VRM
}
}
+ // 元のBlendShapeClipに変更を加えないように複製
+ var proxy = target.GetComponent();
+ var copyBlendShapeAvatar = CopyBlendShapeAvatar(proxy.BlendShapeAvatar, settings.ReduceBlendshapeClip);
+ proxy.BlendShapeAvatar = copyBlendShapeAvatar;
+
// BlendShape削減
- if (settings.ReduceBlendshapeSize)
+ if (settings.ReduceBlendshape)
{
- // remove unused blendShape
- var proxy = target.GetComponent();
-
- // 元のBlendShapeClipに変更を加えないように複製
- var copyBlendShapeAvatar = CopyBlendShapeAvatar(proxy.BlendShapeAvatar);
- proxy.BlendShapeAvatar = copyBlendShapeAvatar;
-
foreach (SkinnedMeshRenderer smr in target.GetComponentsInChildren())
{
// 未使用のBlendShapeを間引く
@@ -148,7 +150,7 @@ namespace VRM
// 出力
{
var sw = System.Diagnostics.Stopwatch.StartNew();
- var vrm = VRMExporter.Export(target, settings.ReduceBlendshapeSize);
+ var vrm = VRMExporter.Export(target, settings.ReduceBlendshape);
vrm.extensions.VRM.meta.title = settings.Title;
vrm.extensions.VRM.meta.version = settings.Version;
vrm.extensions.VRM.meta.author = settings.Author;
diff --git a/Assets/VRM/UniVRM/Editor/Format/VRMExportSettings.cs b/Assets/VRM/UniVRM/Editor/Format/VRMExportSettings.cs
index 588061205..207f11866 100644
--- a/Assets/VRM/UniVRM/Editor/Format/VRMExportSettings.cs
+++ b/Assets/VRM/UniVRM/Editor/Format/VRMExportSettings.cs
@@ -56,12 +56,20 @@ namespace VRM
///
/// エクスポート時に新しいJsonSerializerを使う
///
+ [Tooltip("Use new JSON serializer")]
public bool UseExperimentalExporter = false;
///
/// エクスポート時にBlendShapeClipから参照されないBlendShapeを削除する
///
- public bool ReduceBlendshapeSize = false;
+ [Tooltip("Remove blendshape that is not used from BlendShapeClip")]
+ public bool ReduceBlendshape = false;
+
+ ///
+ /// skip if BlendShapeClip.Preset == Unknown
+ ///
+ [Tooltip("Remove blendShapeClip that preset is Unknown")]
+ public bool ReduceBlendshapeClip = false;
#endregion
public struct Validation
@@ -160,7 +168,7 @@ namespace VRM
yield return Validation.Error("Require Author. ");
}
- if (ReduceBlendshapeSize && Source.GetComponent() == null)
+ if (ReduceBlendshape && Source.GetComponent() == null)
{
yield return Validation.Error("ReduceBlendshapeSize is need VRMBlendShapeProxy, you need to convert to VRM once.");
}