[3118522] OBJ material/texture filename with spaces support.

I also added a test case for this issue.

(see https://sourceforge.net/tracker/?func=detail&aid=3118522&group_id=226462&atid=1067632)

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1157 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
This commit is contained in:
aramis_acg
2012-02-03 18:16:15 +00:00
parent 06bfcbf22d
commit c84a14a7a8
3 changed files with 138 additions and 2 deletions

View File

@@ -146,7 +146,8 @@ inline char_t skipLine( char_t it, char_t end, unsigned int &uiLine )
return it;
}
/** @brief Get a name, must be separated with a blank.
/** @brief Get a name from the current line. Preserve space in the middle,
* but trim it at the end.
* @param it set to current position
* @param end set to end of scratch buffer for readout
* @param name Separated name
@@ -161,8 +162,14 @@ inline char_t getName( char_t it, char_t end, std::string &name )
return end;
char *pStart = &( *it );
while ( !isEndOfBuffer( it, end ) && !isSeparator( *it ) )
while ( !isEndOfBuffer( it, end ) && !isNewLine( *it ) ) {
++it;
}
while(isEndOfBuffer( it, end ) || isNewLine( *it ) || isSeparator(*it)) {
--it;
}
++it;
// Get name
std::string strName( pStart, &(*it) );