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

Method readColladaFile

Engine/source/ts/collada/colladaShapeLoader.cpp:616–648  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

614}
615
616domCOLLADA* ColladaShapeLoader::readColladaFile(const String& path)
617{
618 // Check if this file is already loaded into the database
619 domCOLLADA* root = sDAE.getRoot(path.c_str());
620 if (root)
621 return root;
622
623 // Load the Collada file into memory
624 FileObject fo;
625 if (!fo.readMemory(path))
626 {
627 daeErrorHandler::get()->handleError(avar("Could not read %s into memory", path.c_str()));
628 return NULL;
629 }
630
631 root = sDAE.openFromMemory(path.c_str(), (const char*)fo.buffer());
632 if (!root || !root->getLibrary_visual_scenes_array().getCount()) {
633 daeErrorHandler::get()->handleError(avar("Could not parse %s", path.c_str()));
634 return NULL;
635 }
636
637 // Fixup issues in the model
638 ColladaUtils::applyConditioners(root);
639
640 // Recursively load external DAE references
641 TSShapeLoader::updateProgress(TSShapeLoader::Load_ExternalRefs, "Loading external references...");
642 for (S32 iRef = 0; iRef < root->getDocument()->getReferencedDocuments().getCount(); iRef++) {
643 String refPath = (daeString)root->getDocument()->getReferencedDocuments()[iRef];
644 if (refPath.endsWith(".dae") && !readColladaFile(refPath))
645 daeErrorHandler::get()->handleError(avar("Failed to load external reference: %s", refPath.c_str()));
646 }
647 return root;
648}
649
650//-----------------------------------------------------------------------------
651/// 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
endsWithMethod · 0.80
getFunction · 0.50
getRootMethod · 0.45
c_strMethod · 0.45
handleErrorMethod · 0.45
bufferMethod · 0.45
getCountMethod · 0.45
getDocumentMethod · 0.45

Tested by

no test coverage detected