MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / getNodeById_

Method getNodeById_

source/MRIOExtras/MR3mf.cpp:343–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341}
342
343Expected<Node*> ThreeMFLoader::getNodeById_( int id, const char* pathAttr )
344{
345 auto it = nodeByIdMap_.find( id );
346 if ( it != nodeByIdMap_.end() )
347 return it->second;
348
349 if ( !pathAttr )
350 return unexpected( "Invalid 'p:path attribute'" );
351
352 std::filesystem::path path = rootPath_ / asU8String( "./" + std::string( pathAttr ) );
353 auto docIt = xmlDocuments_.find( utf8string( path.lexically_normal() ) );
354 if ( docIt == xmlDocuments_.end() )
355 return unexpected( "Cannot find file specified in p:path" );
356
357 // no progress reporting because this can be called from another loadDocument_
358 if ( auto e = loadDocument_( docIt->second, {} ); !e )
359 return unexpected( std::move( e.error() ) );
360
361 it = nodeByIdMap_.find( id );
362 if ( it != nodeByIdMap_.end() )
363 return it->second;
364 return unexpected( "Invalid object id" );
365}
366
367Expected<void> ThreeMFLoader::loadTree_( const ProgressCallback& callback )
368{

Callers 3

loadObject_Method · 0.80
loadBuildData_Method · 0.80
loadTexture2dGroup_Method · 0.80

Calls 5

utf8stringFunction · 0.85
errorMethod · 0.80
unexpectedFunction · 0.50
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected