VRMExportSettings.KeepAnimation

This commit is contained in:
ousttrue
2022-06-27 19:20:40 +09:00
parent 4ba59c5fd6
commit 933466169f
7 changed files with 19 additions and 5 deletions

View File

@@ -19,7 +19,7 @@ namespace UniGLTF
{
clips = AnimationExporter.GetAnimationClips(animator);
}
else if (animation != null)
if (animation != null)
{
clips = AnimationExporter.GetAnimationClips(animation);
}

View File

@@ -223,7 +223,9 @@ namespace VRM
// 出力
var sw = System.Diagnostics.Stopwatch.StartNew();
var data = new UniGLTF.ExportingGltfData();
using (var exporter = new VRMExporter(data, settings.MeshExportSettings))
var gltfExportSettings = settings.GltfExportSettings;
using (var exporter = new VRMExporter(data, gltfExportSettings,
settings.KeepAnimation ? new EditorAnimationExporter() : null))
{
exporter.Prepare(target);
exporter.Export(new EditorTextureSerializer());

View File

@@ -47,5 +47,9 @@ namespace VRM
[LangMsg(Languages.ja, "頂点カラーの自動削除をしない。")]
[LangMsg(Languages.en, "Do not automatically delete vertex colors.")]
KEEP_VERTEX_COLOR,
[LangMsg(Languages.ja, "glTF Animationをエクスポートする。")]
[LangMsg(Languages.en, "export glTF animation.")]
EXPORT_GLTF_ANIMATION,
}
}

View File

@@ -55,7 +55,13 @@ namespace VRM
[Tooltip("Keep vertex color attribute")]
public bool KeepVertexColor = false;
public GltfExportSettings MeshExportSettings => new GltfExportSettings
/// <summary>
/// Export時にAnimationを落とさない。特別な用途で使えるように敢えて残す設定
/// </summary>
[Tooltip("Keep animation")]
public bool KeepAnimation = false;
public GltfExportSettings GltfExportSettings => new GltfExportSettings
{
UseSparseAccessorForMorphTarget = UseSparseAccessor,
ExportOnlyBlendShapePosition = OnlyBlendshapePosition,

View File

@@ -54,6 +54,7 @@ namespace VRM
m_checkbox_list.Add(new CheckBoxProp(serializedObject.FindProperty(nameof(VRMExportSettings.ReduceBlendshapeClip)), VRMExportOptions.BLENDSHAPE_EXCLUDE_UNKNOWN));
m_checkbox_list.Add(new CheckBoxProp(serializedObject.FindProperty(nameof(VRMExportSettings.DivideVertexBuffer)), VRMExportOptions.DIVIDE_VERTEX_BUFFER));
m_checkbox_list.Add(new CheckBoxProp(serializedObject.FindProperty(nameof(VRMExportSettings.KeepVertexColor)), VRMExportOptions.KEEP_VERTEX_COLOR));
m_checkbox_list.Add(new CheckBoxProp(serializedObject.FindProperty(nameof(VRMExportSettings.KeepAnimation)), VRMExportOptions.EXPORT_GLTF_ANIMATION));
}

View File

@@ -167,7 +167,7 @@ namespace VRM
protected override void OnLayout()
{
m_meshes.SetRoot(State.ExportRoot, m_settings.MeshExportSettings, new VRMBlendShapeExportFilter(State.ExportRoot, m_settings));
m_meshes.SetRoot(State.ExportRoot, m_settings.GltfExportSettings, new VRMBlendShapeExportFilter(State.ExportRoot, m_settings));
}
static bool s_foldT = true;

View File

@@ -25,7 +25,8 @@ namespace VRM
public readonly VRM.glTF_VRM_extensions VRM = new glTF_VRM_extensions();
public VRMExporter(ExportingGltfData data, GltfExportSettings exportSettings) : base(data, exportSettings)
public VRMExporter(ExportingGltfData data, GltfExportSettings exportSettings, IAnimationExporter animationExporter = null) : base(
data, exportSettings, animationExporter: animationExporter)
{
if (exportSettings == null || exportSettings.InverseAxis != Vrm0xSpecificationInverseAxis)
{