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