mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-08-27 21:34:38 -05:00
gltfExporter の GltfExportSettings が、コンストラクタと Export 関数の引数で二重に与えられていたのを修正
This commit is contained in:
@@ -104,7 +104,7 @@ namespace UniGLTF
|
||||
using (var exporter = new gltfExporter(gltf, Settings))
|
||||
{
|
||||
exporter.Prepare(State.ExportRoot);
|
||||
exporter.Export(Settings, new EditorTextureSerializer());
|
||||
exporter.Export(new EditorTextureSerializer());
|
||||
}
|
||||
|
||||
if (isGlb)
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace UniGLTF
|
||||
// do nothing
|
||||
}
|
||||
|
||||
public virtual void Export(GltfExportSettings meshExportSettings, ITextureSerializer textureSerializer)
|
||||
public virtual void Export(ITextureSerializer textureSerializer)
|
||||
{
|
||||
var bytesBuffer = new ArrayByteBuffer(new byte[50 * 1024 * 1024]);
|
||||
var bufferIndex = glTF.AddBuffer(bytesBuffer);
|
||||
@@ -232,7 +232,7 @@ namespace UniGLTF
|
||||
.ToList();
|
||||
|
||||
var uniqueUnityMeshes = new MeshExportList();
|
||||
uniqueUnityMeshes.GetInfo(Nodes, meshExportSettings);
|
||||
uniqueUnityMeshes.GetInfo(Nodes, m_settings);
|
||||
|
||||
#region Materials and Textures
|
||||
Materials = uniqueUnityMeshes.GetUniqueMaterials().ToList();
|
||||
@@ -252,9 +252,9 @@ namespace UniGLTF
|
||||
continue;
|
||||
}
|
||||
|
||||
var (gltfMesh, blendShapeIndexMap) = meshExportSettings.DivideVertexBuffer
|
||||
? MeshExporter_DividedVertexBuffer.Export(glTF, bufferIndex, unityMesh, Materials, m_settings.InverseAxis.Create(), meshExportSettings)
|
||||
: MeshExporter_SharedVertexBuffer.Export(glTF, bufferIndex, unityMesh, Materials, m_settings.InverseAxis.Create(), meshExportSettings)
|
||||
var (gltfMesh, blendShapeIndexMap) = m_settings.DivideVertexBuffer
|
||||
? MeshExporter_DividedVertexBuffer.Export(glTF, bufferIndex, unityMesh, Materials, m_settings.InverseAxis.Create(), m_settings)
|
||||
: MeshExporter_SharedVertexBuffer.Export(glTF, bufferIndex, unityMesh, Materials, m_settings.InverseAxis.Create(), m_settings)
|
||||
;
|
||||
glTF.meshes.Add(gltfMesh);
|
||||
Meshes.Add(unityMesh.Mesh);
|
||||
|
||||
@@ -125,17 +125,14 @@ namespace UniGLTF
|
||||
var gltf = new glTF();
|
||||
using (var exporter = new gltfExporter(gltf, new GltfExportSettings
|
||||
{
|
||||
InverseAxis = Axes.X
|
||||
InverseAxis = Axes.X,
|
||||
ExportOnlyBlendShapePosition = false,
|
||||
UseSparseAccessorForMorphTarget = false,
|
||||
DivideVertexBuffer = false,
|
||||
}))
|
||||
{
|
||||
exporter.Prepare(root);
|
||||
var settings = new GltfExportSettings
|
||||
{
|
||||
ExportOnlyBlendShapePosition = false,
|
||||
UseSparseAccessorForMorphTarget = false,
|
||||
DivideVertexBuffer = false,
|
||||
};
|
||||
exporter.Export(settings, new EditorTextureSerializer());
|
||||
exporter.Export(new EditorTextureSerializer());
|
||||
}
|
||||
Assert.AreEqual(1, gltf.images.Count);
|
||||
var exportedImage = gltf.images[0];
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace UniGLTF
|
||||
using (var exporter = new gltfExporter(gltf, new GltfExportSettings()))
|
||||
{
|
||||
exporter.Prepare(root);
|
||||
exporter.Export(new GltfExportSettings(), new EditorTextureSerializer());
|
||||
exporter.Export(new EditorTextureSerializer());
|
||||
return gltf.ToGlbBytes();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace UniGLTF
|
||||
using (var exporter = new gltfExporter(gltf, new GltfExportSettings()))
|
||||
{
|
||||
exporter.Prepare(go);
|
||||
exporter.Export(new GltfExportSettings(), new EditorTextureSerializer());
|
||||
exporter.Export(new EditorTextureSerializer());
|
||||
|
||||
// remove empty buffer
|
||||
gltf.buffers.Clear();
|
||||
@@ -297,7 +297,7 @@ namespace UniGLTF
|
||||
using (var exporter = new gltfExporter(gltf, new GltfExportSettings()))
|
||||
{
|
||||
exporter.Prepare(CreateSimpleScene());
|
||||
exporter.Export(new GltfExportSettings(), new EditorTextureSerializer());
|
||||
exporter.Export(new EditorTextureSerializer());
|
||||
}
|
||||
|
||||
var expected = gltf.ToJson().ParseAsJson();
|
||||
@@ -533,7 +533,7 @@ namespace UniGLTF
|
||||
using (var exporter = new gltfExporter(gltf, new GltfExportSettings()))
|
||||
{
|
||||
exporter.Prepare(go);
|
||||
exporter.Export(new UniGLTF.GltfExportSettings(), new EditorTextureSerializer());
|
||||
exporter.Export(new EditorTextureSerializer());
|
||||
|
||||
json = gltf.ToJson();
|
||||
}
|
||||
@@ -574,7 +574,7 @@ namespace UniGLTF
|
||||
{
|
||||
var storage = new SimpleStorage(new ArraySegment<byte>(new byte[1024 * 1024]));
|
||||
var data = new JsonWithStorageParser(json, storage).Parse();
|
||||
|
||||
|
||||
//Debug.LogFormat("{0}", context.Json);
|
||||
using (var context = new ImporterContext(data))
|
||||
using (var loaded = context.Load())
|
||||
@@ -615,7 +615,7 @@ namespace UniGLTF
|
||||
using (var exporter = new gltfExporter(gltf, new GltfExportSettings()))
|
||||
{
|
||||
exporter.Prepare(go);
|
||||
exporter.Export(new UniGLTF.GltfExportSettings(), new EditorTextureSerializer());
|
||||
exporter.Export(new EditorTextureSerializer());
|
||||
|
||||
json = gltf.ToJson();
|
||||
}
|
||||
@@ -628,7 +628,7 @@ namespace UniGLTF
|
||||
{
|
||||
var storage = new SimpleStorage(new ArraySegment<byte>(new byte[1024 * 1024]));
|
||||
var data = new JsonWithStorageParser(json, storage).Parse();
|
||||
|
||||
|
||||
using (var context = new ImporterContext(data))
|
||||
using (var loaded = context.Load())
|
||||
{
|
||||
@@ -679,7 +679,7 @@ namespace UniGLTF
|
||||
using (var exporter = new gltfExporter(gltf, new GltfExportSettings()))
|
||||
{
|
||||
exporter.Prepare(root);
|
||||
exporter.Export(new UniGLTF.GltfExportSettings(), new EditorTextureSerializer());
|
||||
exporter.Export(new EditorTextureSerializer());
|
||||
|
||||
json = gltf.ToJson();
|
||||
}
|
||||
|
||||
@@ -223,10 +223,10 @@ namespace VRM
|
||||
// 出力
|
||||
var sw = System.Diagnostics.Stopwatch.StartNew();
|
||||
var gltf = new UniGLTF.glTF();
|
||||
using (var exporter = new VRMExporter(gltf))
|
||||
using (var exporter = new VRMExporter(gltf, settings.MeshExportSettings))
|
||||
{
|
||||
exporter.Prepare(target);
|
||||
exporter.Export(settings.MeshExportSettings, new EditorTextureSerializer());
|
||||
exporter.Export(new EditorTextureSerializer());
|
||||
}
|
||||
var bytes = gltf.ToGlbBytes();
|
||||
Debug.LogFormat("Export elapsed {0}", sw.Elapsed);
|
||||
|
||||
@@ -18,17 +18,17 @@ namespace VRM
|
||||
public static glTF Export(GltfExportSettings configuration, GameObject go, ITextureSerializer textureSerializer)
|
||||
{
|
||||
var gltf = new glTF();
|
||||
using (var exporter = new VRMExporter(gltf))
|
||||
using (var exporter = new VRMExporter(gltf, configuration))
|
||||
{
|
||||
exporter.Prepare(go);
|
||||
exporter.Export(configuration, textureSerializer);
|
||||
exporter.Export(textureSerializer);
|
||||
}
|
||||
return gltf;
|
||||
}
|
||||
|
||||
public readonly VRM.glTF_VRM_extensions VRM = new glTF_VRM_extensions();
|
||||
|
||||
public VRMExporter(glTF gltf) : base(gltf, new GltfExportSettings())
|
||||
public VRMExporter(glTF gltf, GltfExportSettings exportSettings) : base(gltf, exportSettings)
|
||||
{
|
||||
gltf.extensionsUsed.Add(glTF_VRM_extensions.ExtensionName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user