Skip to content
Snippets Groups Projects
Commit 07e0a4bd authored by Mathieu Westphal (Kitware)'s avatar Mathieu Westphal (Kitware) :zap:
Browse files

vtkOBJImporter: Fix small parsing issues with spaces

parent 79e07cd3
No related branches found
No related tags found
No related merge requests found
......@@ -418,8 +418,8 @@ int vtkOBJPolyDataProcessor::RequestData(vtkInformation* vtkNotUsed(request),
_extractLine(rawLine);
// in the OBJ format the first characters determine how to interpret the line:
// Skip comments
if (strcmp(cmd, "#") == 0)
// Skip comments and empty lines
if (cmd[0] == '#' || cmd[0] == '\0')
{
continue;
}
......@@ -430,9 +430,13 @@ int vtkOBJPolyDataProcessor::RequestData(vtkInformation* vtkNotUsed(request),
{
pLine++;
}
// Recover the mtllib without the \n at the end
while (isspace(*(pEnd - 1)) && pLine < pEnd)
{
pEnd--;
}
// Recover the mtllib
mtlname = vtksys::SystemTools::GetFilenamePath(this->FileName) + "/" +
std::string(pLine, strlen(pLine) - 1);
std::string(pLine, pEnd - pLine);
mtllibDefined = true;
break;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment