MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / readColladaFile

Method readColladaFile

Engine/source/ts/collada/colladaShapeLoader.cpp:610–642  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

608}
609
610domCOLLADA* ColladaShapeLoader::readColladaFile(const String& path)
611{
612 // Check if this file is already loaded into the database
613 domCOLLADA* root = sDAE.getRoot(path.c_str());
614 if (root)
615 return root;
616
617 // Load the Collada file into memory
618 FileObject fo;
619 if (!fo.readMemory(path))
620 {
621 daeErrorHandler::get()->handleError(avar("Could not read %s into memory", path.c_str()));
622 return NULL;
623 }
624
625 root = sDAE.openFromMemory(path.c_str(), (const char*)fo.buffer());
626 if (!root || !root->getLibrary_visual_scenes_array().getCount()) {
627 daeErrorHandler::get()->handleError(avar("Could not parse %s", path.c_str()));
628 return NULL;
629 }
630
631 // Fixup issues in the model
632 ColladaUtils::applyConditioners(root);
633
634 // Recursively load external DAE references
635 TSShapeLoader::updateProgress(TSShapeLoader::Load_ExternalRefs, "Loading external references...");
636 for (S32 iRef = 0; iRef < root->getDocument()->getReferencedDocuments().getCount(); iRef++) {
637 String refPath = (daeString)root->getDocument()->getReferencedDocuments()[iRef];
638 if (refPath.endsWith(".dae") && !readColladaFile(refPath))
639 daeErrorHandler::get()->handleError(avar("Failed to load external reference: %s", refPath.c_str()));
640 }
641 return root;
642}
643
644//-----------------------------------------------------------------------------
645/// This function is invoked by the resource manager based on file extension.

Callers

nothing calls this directly

Calls 11

avarFunction · 0.85
readMemoryMethod · 0.80
openFromMemoryMethod · 0.80
bufferMethod · 0.80
getDocumentMethod · 0.80
endsWithMethod · 0.80
getFunction · 0.50
getRootMethod · 0.45
c_strMethod · 0.45
handleErrorMethod · 0.45
getCountMethod · 0.45

Tested by

no test coverage detected