FixNodeName

#678
This commit is contained in:
ousttrue
2021-01-25 13:52:40 +09:00
parent dda0ce2d2f
commit 7fa8bc0990

View File

@@ -310,6 +310,7 @@ namespace UniGLTF
RestoreOlderVersionValues();
FixUnique();
FixNodeName();
// parepare byte buffer
//GLTF.baseDir = System.IO.Path.GetDirectoryName(Path);
@@ -346,6 +347,21 @@ namespace UniGLTF
}
}
/// <summary>
/// rename empty name to $"{index}"
/// </summary>
void FixNodeName()
{
for (var i = 0; i < GLTF.nodes.Count; ++i)
{
var node = GLTF.nodes[i];
if (string.IsNullOrWhiteSpace(node.name))
{
node.name = $"{i}";
}
}
}
void RestoreOlderVersionValues()
{
var parsed = UniJSON.JsonParser.Parse(Json);