------------------------------------------------------------------------------------------------ Resolve node instances
| 280 | // ------------------------------------------------------------------------------------------------ |
| 281 | // Resolve node instances |
| 282 | void ColladaLoader::ResolveNodeInstances(const ColladaParser &pParser, const Node *pNode, |
| 283 | std::vector<const Node*> &resolved) const { |
| 284 | // reserve enough storage |
| 285 | resolved.reserve(pNode->mNodeInstances.size()); |
| 286 | |
| 287 | // ... and iterate through all nodes to be instanced as children of pNode |
| 288 | for (const auto &[mNode] : pNode->mNodeInstances) { |
| 289 | // find the corresponding node in the library |
| 290 | const auto itt = pParser.mNodeLibrary.find(mNode); |
| 291 | const Node *nd = itt == pParser.mNodeLibrary.end() ? nullptr : (*itt).second; |
| 292 | |
| 293 | // FIX for http://sourceforge.net/tracker/?func=detail&aid=3054873&group_id=226462&atid=1067632 |
| 294 | // need to check for both name and ID to catch all. To avoid breaking valid files, |
| 295 | // the workaround is only enabled when the first attempt to resolve the node has failed. |
| 296 | if (nullptr == nd) { |
| 297 | nd = FindNode(pParser.mRootNode, mNode); |
| 298 | } |
| 299 | if (nullptr == nd) { |
| 300 | ASSIMP_LOG_ERROR("Collada: Unable to resolve reference to instanced node ", mNode); |
| 301 | } else { |
| 302 | // attach this node to the list of children |
| 303 | resolved.push_back(nd); |
| 304 | } |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | // ------------------------------------------------------------------------------------------------ |
| 309 | // Resolve UV channels |