Fix node names sharing same name
Uses node name if it is set, and globally unique id otherwise. This may still break in some models (glTF2 spec doesn’t guaruntee name values to be unique). However, I couldn’t cause it to break any further using gltf2 models on hand. Closes #1600pull/1603/head
parent
5c9ed540b2
commit
98e98dc40c
|
@ -516,7 +516,9 @@ aiNode* ImportNode(aiScene* pScene, glTF2::Asset& r, std::vector<unsigned int>&
|
||||||
{
|
{
|
||||||
Node& node = *ptr;
|
Node& node = *ptr;
|
||||||
|
|
||||||
aiNode* ainode = new aiNode(node.name);
|
std::string nameOrId = node.name.empty() ? node.id : node.name;
|
||||||
|
|
||||||
|
aiNode* ainode = new aiNode(nameOrId);
|
||||||
|
|
||||||
if (!node.children.empty()) {
|
if (!node.children.empty()) {
|
||||||
ainode->mNumChildren = unsigned(node.children.size());
|
ainode->mNumChildren = unsigned(node.children.size());
|
||||||
|
|
Loading…
Reference in New Issue