----------------------------------------------------------------------------- Get the root collada DOM element for the given DAE file
| 582 | //----------------------------------------------------------------------------- |
| 583 | /// Get the root collada DOM element for the given DAE file |
| 584 | domCOLLADA* ColladaShapeLoader::getDomCOLLADA(const Torque::Path& path) |
| 585 | { |
| 586 | daeErrorHandler::setErrorHandler(&sErrorHandler); |
| 587 | |
| 588 | TSShapeLoader::updateProgress(TSShapeLoader::Load_ReadFile, path.getFullFileName().c_str()); |
| 589 | |
| 590 | // Check if we can use the last loaded file |
| 591 | FileTime daeModifyTime; |
| 592 | if (Platform::getFileTimes(path.getFullPath(), NULL, &daeModifyTime)) |
| 593 | { |
| 594 | if ((path == sLastPath) && (Platform::compareFileTimes(sLastModTime, daeModifyTime) >= 0)) |
| 595 | return sDAE.getRoot(path.getFullPath().c_str()); |
| 596 | } |
| 597 | |
| 598 | sDAE.clear(); |
| 599 | sDAE.setBaseURI(""); |
| 600 | |
| 601 | TSShapeLoader::updateProgress(TSShapeLoader::Load_ParseFile, "Parsing XML..."); |
| 602 | domCOLLADA* root = readColladaFile(path.getFullPath()); |
| 603 | if (!root) |
| 604 | { |
| 605 | TSShapeLoader::updateProgress(TSShapeLoader::Load_Complete, "Import failed"); |
| 606 | sDAE.clear(); |
| 607 | return NULL; |
| 608 | } |
| 609 | |
| 610 | sLastPath = path; |
| 611 | sLastModTime = daeModifyTime; |
| 612 | |
| 613 | return root; |
| 614 | } |
| 615 | |
| 616 | domCOLLADA* ColladaShapeLoader::readColladaFile(const String& path) |
| 617 | { |
nothing calls this directly
no test coverage detected