mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-08-22 10:34:54 -05:00
fix none vertex mesh export
This commit is contained in:
@@ -160,6 +160,11 @@ namespace UniGLTF
|
||||
{
|
||||
node.mesh = meshIndex;
|
||||
}
|
||||
else if(mesh != null && !mesh.vertices.Any())
|
||||
{
|
||||
// 頂点データが無い場合
|
||||
node.mesh = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// MeshとMaterialが一致するものが見つからなかった
|
||||
@@ -178,6 +183,11 @@ namespace UniGLTF
|
||||
node.mesh = meshIndex;
|
||||
node.skin = skins.IndexOf(skinnedMeshRenderer);
|
||||
}
|
||||
else if (mesh != null && !mesh.vertices.Any())
|
||||
{
|
||||
// 頂点データが無い場合
|
||||
node.mesh = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// MeshとMaterialが一致するものが見つからなかった
|
||||
@@ -218,8 +228,15 @@ namespace UniGLTF
|
||||
.Skip(1) // exclude root object for the symmetry with the importer
|
||||
.ToList();
|
||||
|
||||
var unityMeshes = MeshWithRenderer.FromNodes(Nodes).Where(x => x.Mesh.vertices.Any()).ToList();
|
||||
var uniqueUnityMeshes = new List<MeshWithRenderer>();
|
||||
foreach (var um in unityMeshes)
|
||||
{
|
||||
if (!uniqueUnityMeshes.Any(x => x.IsSameMeshAndMaterials(um))) uniqueUnityMeshes.Add(um);
|
||||
}
|
||||
|
||||
#region Materials and Textures
|
||||
Materials = Nodes.SelectMany(x => x.GetSharedMaterials()).Where(x => x != null).Distinct().ToList();
|
||||
Materials = uniqueUnityMeshes.SelectMany(x => x.Renderer.sharedMaterials).Where(x => x != null).Distinct().ToList();
|
||||
|
||||
TextureManager = new TextureExporter(useAsset);
|
||||
|
||||
@@ -228,13 +245,6 @@ namespace UniGLTF
|
||||
#endregion
|
||||
|
||||
#region Meshes
|
||||
var unityMeshes = MeshWithRenderer.FromNodes(Nodes).Where(x => x.Mesh.vertices.Any()).ToList();
|
||||
var uniqueUnityMeshes = new List<MeshWithRenderer>();
|
||||
foreach (var um in unityMeshes)
|
||||
{
|
||||
if (!uniqueUnityMeshes.Any(x => x.IsSameMeshAndMaterials(um))) uniqueUnityMeshes.Add(um);
|
||||
}
|
||||
|
||||
MeshBlendShapeIndexMap = new Dictionary<Mesh, Dictionary<int, int>>();
|
||||
foreach (var unityMesh in uniqueUnityMeshes)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user