In ColladaLoader in version 3.2.0 (release est. 2015) the name assignment was based on name attribute (xml) with optional fallbacks to id and sid. Over time this was changed to fix a bug and support for names was removed, only to be later (re)added using an optional `useColladaName` setting. We discovered a problem that with when using the name based assignment it doesn't assign automatically generated names like what it did in the logic in v3.2.0 and on the id based approach on current master.
We discovered this causes problems with matching the aiCamera and aiLight. So we rectified this problem by auto generating names also on the name based method.pull/2353/head
parent
d5a0a21f8c
commit
e9eda062a1
|
@ -1926,21 +1926,28 @@ const Collada::Node* ColladaLoader::FindNodeBySID( const Collada::Node* pNode, c
|
||||||
std::string ColladaLoader::FindNameForNode( const Collada::Node* pNode)
|
std::string ColladaLoader::FindNameForNode( const Collada::Node* pNode)
|
||||||
{
|
{
|
||||||
// If explicitly requested, just use the collada name.
|
// If explicitly requested, just use the collada name.
|
||||||
if (useColladaName) {
|
if (useColladaName)
|
||||||
return pNode->mName;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now setup the name of the assimp node. The collada name might not be
|
|
||||||
// unique, so we use the collada ID.
|
|
||||||
if (!pNode->mID.empty())
|
|
||||||
return pNode->mID;
|
|
||||||
else if (!pNode->mSID.empty())
|
|
||||||
return pNode->mSID;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
// No need to worry. Unnamed nodes are no problem at all, except
|
if (!pNode->mName.empty()) {
|
||||||
// if cameras or lights need to be assigned to them.
|
return pNode->mName;
|
||||||
return format() << "$ColladaAutoName$_" << mNodeNameCounter++;
|
} else {
|
||||||
|
return format() << "$ColladaAutoName$_" << mNodeNameCounter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Now setup the name of the assimp node. The collada name might not be
|
||||||
|
// unique, so we use the collada ID.
|
||||||
|
if (!pNode->mID.empty())
|
||||||
|
return pNode->mID;
|
||||||
|
else if (!pNode->mSID.empty())
|
||||||
|
return pNode->mSID;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// No need to worry. Unnamed nodes are no problem at all, except
|
||||||
|
// if cameras or lights need to be assigned to them.
|
||||||
|
return format() << "$ColladaAutoName$_" << mNodeNameCounter++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue