fix loadMJCF/BulletMJCFImporter to load from fileIO
This commit is contained in:
@@ -9,9 +9,9 @@
|
|||||||
#include "../../CommonInterfaces/CommonFileIOInterface.h"
|
#include "../../CommonInterfaces/CommonFileIOInterface.h"
|
||||||
#include "../ImportURDFDemo/UrdfFindMeshFile.h"
|
#include "../ImportURDFDemo/UrdfFindMeshFile.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "../../Utils/b3ResourcePath.h"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include "../../Utils/b3ResourcePath.h"
|
||||||
#include "../ImportURDFDemo/URDF2Bullet.h"
|
#include "../ImportURDFDemo/URDF2Bullet.h"
|
||||||
#include "../ImportURDFDemo/UrdfParser.h"
|
#include "../ImportURDFDemo/UrdfParser.h"
|
||||||
#include "../ImportURDFDemo/urdfStringSplit.h"
|
#include "../ImportURDFDemo/urdfStringSplit.h"
|
||||||
@@ -1453,17 +1453,21 @@ bool BulletMJCFImporter::loadMJCF(const char* fileName, MJCFErrorLogger* logger,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int maxPathLen = 1024;
|
//read file
|
||||||
fu.extractPath(relativeFileName, m_data->m_pathPrefix, maxPathLen);
|
int fileId = m_data->m_fileIO->fileOpen(relativeFileName,"r");
|
||||||
|
|
||||||
std::fstream xml_file(relativeFileName, std::fstream::in);
|
char destBuffer[8192];
|
||||||
while (xml_file.good())
|
char* line = 0;
|
||||||
|
do
|
||||||
{
|
{
|
||||||
std::string line;
|
line = m_data->m_fileIO->readLine(fileId, destBuffer, 8192);
|
||||||
std::getline(xml_file, line);
|
if (line)
|
||||||
xml_string += (line + "\n");
|
{
|
||||||
|
xml_string += (std::string(destBuffer) + "\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
xml_file.close();
|
while (line);
|
||||||
|
m_data->m_fileIO->fileClose(fileId);
|
||||||
|
|
||||||
if (parseMJCFString(xml_string.c_str(), logger))
|
if (parseMJCFString(xml_string.c_str(), logger))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user