Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions glTF-BinImporter/GltfRhinoConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using glTFLoader.Schema;

namespace glTF_BinImporter
{
Expand Down Expand Up @@ -100,6 +101,11 @@ public bool Convert()

for(int i = 0; i < gltf.Meshes.Length; i++)
{
if (gltf.Meshes[i].Name == null)
{
OverwriteMeshName(i, gltf.Meshes[i], gltf.Nodes);
}

GltfRhinoMeshConverter converter = new GltfRhinoMeshConverter(gltf.Meshes[i], this, doc);
meshHolders.Add(converter.Convert());
}
Expand All @@ -109,6 +115,16 @@ public bool Convert()
return true;
}

private void OverwriteMeshName(int meshIndex, Mesh gltfMesh, Node[] gltfNodes)
{
for (var i = 0; i < gltf.Nodes.Length; i++)
{
var node = gltf.Nodes[i];
if (node.Mesh != meshIndex || node.Mesh == null) continue;
gltf.Meshes[meshIndex].Name = node.Name;
}
}

private void ProcessHierarchy()
{
HashSet<int> children = new HashSet<int>();
Expand Down