[ 3460982] Patch for Bug 3460978 - Obj loader not generating new objects for material groups.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1108 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/5/head
aramis_acg 2012-01-11 13:38:56 +00:00
parent e52a49a990
commit 2c0965795c
1 changed files with 9 additions and 0 deletions

View File

@ -377,6 +377,15 @@ void ObjFileParser::getFace(aiPrimitiveType type)
// Get values for a new material description // Get values for a new material description
void ObjFileParser::getMaterialDesc() void ObjFileParser::getMaterialDesc()
{ {
// Each material request a new object.
// Sometimes the object is already created (see 'o' tag by example), but it is not initialized !
// So, we create a new object only if the current on is already initialized !
if (m_pModel->m_pCurrent != NULL &&
( m_pModel->m_pCurrent->m_Meshes.size() > 1 ||
(m_pModel->m_pCurrent->m_Meshes.size() == 1 && m_pModel->m_Meshes[m_pModel->m_pCurrent->m_Meshes[0]]->m_Faces.size() != 0) )
)
m_pModel->m_pCurrent = NULL;
// Get next data for material data // Get next data for material data
m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd); m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
if (m_DataIt == m_DataItEnd) if (m_DataIt == m_DataItEnd)