MCPcopy Create free account
hub / github.com/assimp/assimp / ResolveNodeInstances

Method ResolveNodeInstances

code/AssetLib/Collada/ColladaLoader.cpp:282–306  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------ Resolve node instances

Source from the content-addressed store, hash-verified

280// ------------------------------------------------------------------------------------------------
281// Resolve node instances
282void 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

Callers

nothing calls this directly

Calls 5

FindNodeFunction · 0.50
reserveMethod · 0.45
sizeMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected