fix name handling of geoemtryobjectname nodes

Signed-off-by: Kim Kulling <kim.kulling@googlemail.com>
pull/552/head
Kim Kulling 2015-05-05 22:27:05 +02:00
parent 2c60da38f3
commit fd3a0d4a9d
2 changed files with 10 additions and 3 deletions

View File

@ -223,6 +223,7 @@ OpenGEXImporter::OpenGEXImporter()
, m_currentNode( NULL ) , m_currentNode( NULL )
, m_currentMesh( NULL ) , m_currentMesh( NULL )
, m_currentMaterial( NULL ) , m_currentMaterial( NULL )
, m_tokenType( Grammar::NoneType )
, m_nodeStack() , m_nodeStack()
, m_unresolvedRefStack() { , m_unresolvedRefStack() {
// empty // empty
@ -406,7 +407,12 @@ void OpenGEXImporter::handleNameNode( DDLNode *node, aiScene *pScene ) {
} }
const std::string name( val->getString() ); const std::string name( val->getString() );
m_currentNode->mName.Set( name.c_str() ); if( m_tokenType == Grammar::GeometryNodeToken ) {
m_currentNode->mName.Set( name.c_str() );
} else if( m_tokenType == Grammar::MaterialToken ) {
}
} }
} }
@ -462,6 +468,7 @@ void OpenGEXImporter::handleMaterialRefNode( ODDLParser::DDLNode *node, aiScene
void OpenGEXImporter::handleGeometryNode( DDLNode *node, aiScene *pScene ) { void OpenGEXImporter::handleGeometryNode( DDLNode *node, aiScene *pScene ) {
aiNode *newNode = new aiNode; aiNode *newNode = new aiNode;
pushNode( newNode, pScene ); pushNode( newNode, pScene );
m_tokenType = Grammar::GeometryNodeToken;
m_currentNode = newNode; m_currentNode = newNode;
handleNodes( node, pScene ); handleNodes( node, pScene );
@ -768,9 +775,8 @@ static ColorType getColorType( Identifier *id ) {
void OpenGEXImporter::handleMaterialNode( ODDLParser::DDLNode *node, aiScene *pScene ) { void OpenGEXImporter::handleMaterialNode( ODDLParser::DDLNode *node, aiScene *pScene ) {
m_currentMaterial = new aiMaterial; m_currentMaterial = new aiMaterial;
m_materialCache.push_back( m_currentMaterial ); m_materialCache.push_back( m_currentMaterial );
m_tokenType = Grammar::MaterialToken;
handleNodes( node, pScene ); handleNodes( node, pScene );
} }
//------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------

View File

@ -179,6 +179,7 @@ private:
VertexContainer m_currentVertices; VertexContainer m_currentVertices;
aiMesh *m_currentMesh; aiMesh *m_currentMesh;
aiMaterial *m_currentMaterial; aiMaterial *m_currentMaterial;
int m_tokenType;
std::vector<aiMaterial*> m_materialCache; std::vector<aiMaterial*> m_materialCache;
std::vector<aiNode*> m_nodeStack; std::vector<aiNode*> m_nodeStack;
std::vector<RefInfo*> m_unresolvedRefStack; std::vector<RefInfo*> m_unresolvedRefStack;