Merge pull request #1914 from ousttrue/fix10/export_option

[1.0] morph target の accessor に sparse を使うか否かのオプションを実装
This commit is contained in:
ousttrue
2022-11-09 14:52:41 +09:00
committed by GitHub
2 changed files with 12 additions and 6 deletions

View File

@@ -10,20 +10,23 @@ namespace UniVRM10
/// <summary>
/// エクスポート時にBlendShapeClipから参照されないBlendShapeを削除する
/// </summary>
[Tooltip("Remove blendshape that is not used from BlendShapeClip")]
[Tooltip("not implemented yet. Remove blendshape that is not used from BlendShapeClip")][ReadOnly]
public bool ReduceBlendshape = false;
/// <summary>
/// skip if BlendShapeClip.Preset == Unknown
/// </summary>
[Tooltip("Remove blendShapeClip that preset is Unknown")]
[Tooltip("not implemented yet. Remove blendShapeClip that preset is Unknown")][ReadOnly]
public bool ReduceBlendshapeClip = false;
[Tooltip("Use sparse accessor for morph target")]
public bool MorphTargetUseSparse = true;
public GltfExportSettings MeshExportSettings => new GltfExportSettings
{
UseSparseAccessorForMorphTarget = true,
UseSparseAccessorForMorphTarget = MorphTargetUseSparse,
ExportOnlyBlendShapePosition = true,
DivideVertexBuffer = true,
DivideVertexBuffer = true,
};
public GameObject Root { get; set; }

View File

@@ -277,8 +277,11 @@ namespace UniVRM10
model.ConvertCoordinate(VrmLib.Coordinates.Vrm1, ignoreVrm: false);
// export vrm-1.0
var exporter = new UniVRM10.Vrm10Exporter(new EditorTextureSerializer(), new GltfExportSettings());
var option = new VrmLib.ExportArgs();
var exporter = new UniVRM10.Vrm10Exporter(new EditorTextureSerializer(), m_settings.MeshExportSettings);
var option = new VrmLib.ExportArgs
{
sparse = m_settings.MorphTargetUseSparse,
};
exporter.Export(root, model, converter, option, Vrm ? Vrm.Meta : m_tmpObject.Meta);
var exportedBytes = exporter.Storage.ToGlbBytes();