OpenGEXImporter: Store RefInfo in unique_ptr so they get automatically cleaned up
parent
775f984d99
commit
b841ed194b
|
@ -525,7 +525,7 @@ void OpenGEXImporter::handleObjectRefNode( DDLNode *node, aiScene *pScene ) {
|
||||||
m_currentNode->mNumMeshes = static_cast<unsigned int>(objRefNames.size());
|
m_currentNode->mNumMeshes = static_cast<unsigned int>(objRefNames.size());
|
||||||
m_currentNode->mMeshes = new unsigned int[ objRefNames.size() ];
|
m_currentNode->mMeshes = new unsigned int[ objRefNames.size() ];
|
||||||
if ( !objRefNames.empty() ) {
|
if ( !objRefNames.empty() ) {
|
||||||
m_unresolvedRefStack.push_back( new RefInfo( m_currentNode, RefInfo::MeshRef, objRefNames ) );
|
m_unresolvedRefStack.push_back( std::unique_ptr<RefInfo>( new RefInfo( m_currentNode, RefInfo::MeshRef, objRefNames ) ) );
|
||||||
}
|
}
|
||||||
} else if ( m_tokenType == Grammar::LightNodeToken ) {
|
} else if ( m_tokenType == Grammar::LightNodeToken ) {
|
||||||
// TODO!
|
// TODO!
|
||||||
|
@ -544,7 +544,7 @@ void OpenGEXImporter::handleMaterialRefNode( ODDLParser::DDLNode *node, aiScene
|
||||||
std::vector<std::string> matRefNames;
|
std::vector<std::string> matRefNames;
|
||||||
getRefNames( node, matRefNames );
|
getRefNames( node, matRefNames );
|
||||||
if( !matRefNames.empty() ) {
|
if( !matRefNames.empty() ) {
|
||||||
m_unresolvedRefStack.push_back( new RefInfo( m_currentNode, RefInfo::MaterialRef, matRefNames ) );
|
m_unresolvedRefStack.push_back( std::unique_ptr<RefInfo>( new RefInfo( m_currentNode, RefInfo::MaterialRef, matRefNames ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1165,8 +1165,8 @@ void OpenGEXImporter::resolveReferences() {
|
||||||
}
|
}
|
||||||
|
|
||||||
RefInfo *currentRefInfo( nullptr );
|
RefInfo *currentRefInfo( nullptr );
|
||||||
for( std::vector<RefInfo*>::iterator it = m_unresolvedRefStack.begin(); it != m_unresolvedRefStack.end(); ++it ) {
|
for( auto it = m_unresolvedRefStack.begin(); it != m_unresolvedRefStack.end(); ++it ) {
|
||||||
currentRefInfo = *it;
|
currentRefInfo = it->get();
|
||||||
if( nullptr != currentRefInfo ) {
|
if( nullptr != currentRefInfo ) {
|
||||||
aiNode *node( currentRefInfo->m_node );
|
aiNode *node( currentRefInfo->m_node );
|
||||||
if( RefInfo::MeshRef == currentRefInfo->m_type ) {
|
if( RefInfo::MeshRef == currentRefInfo->m_type ) {
|
||||||
|
|
|
@ -201,7 +201,7 @@ private:
|
||||||
std::vector<aiCamera*> m_cameraCache;
|
std::vector<aiCamera*> m_cameraCache;
|
||||||
std::vector<aiLight*> m_lightCache;
|
std::vector<aiLight*> m_lightCache;
|
||||||
std::vector<aiNode*> m_nodeStack;
|
std::vector<aiNode*> m_nodeStack;
|
||||||
std::vector<RefInfo*> m_unresolvedRefStack;
|
std::vector<std::unique_ptr<RefInfo> > m_unresolvedRefStack;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Namespace OpenGEX
|
} // Namespace OpenGEX
|
||||||
|
|
Loading…
Reference in New Issue