KX_BlenderSceneConverter::~KX_BlenderSceneConverter() { // clears meshes, and hashmaps from blender to gameengine data // delete sumoshapes if (m_threadinfo) { vector<pthread_t>::iterator pit = m_threadinfo->threads.begin(); while (pit != m_threadinfo->threads.end()) { pthread_join((*pit), NULL); pit++; } pthread_mutex_destroy(&m_threadinfo->merge_lock); delete m_threadinfo; } int numAdtLists = m_map_blender_to_gameAdtList.size(); for (int i = 0; i < numAdtLists; i++) { BL_InterpolatorList *adtList = *m_map_blender_to_gameAdtList.at(i); delete (adtList); } vector<pair<KX_Scene *, KX_WorldInfo *> >::iterator itw = m_worldinfos.begin(); while (itw != m_worldinfos.end()) { delete itw->second; itw++; } m_worldinfos.clear(); vector<pair<KX_Scene *,RAS_IPolyMaterial *> >::iterator itp = m_polymaterials.begin(); while (itp != m_polymaterials.end()) { delete itp->second; itp++; } m_polymaterials.clear(); // delete after RAS_IPolyMaterial vector<pair<KX_Scene *,BL_Material *> >::iterator itmat = m_materials.begin(); while (itmat != m_materials.end()) { delete itmat->second; itmat++; } m_materials.clear(); vector<pair<KX_Scene *,RAS_MeshObject *> >::iterator itm = m_meshobjects.begin(); while (itm != m_meshobjects.end()) { delete itm->second; itm++; } m_meshobjects.clear(); /* free any data that was dynamically loaded */ while (m_DynamicMaggie.size() != 0) { FreeBlendFile(m_DynamicMaggie[0]); } m_DynamicMaggie.clear(); }
KX_BlenderSceneConverter::~KX_BlenderSceneConverter() { // clears meshes, and hashmaps from blender to gameengine data // delete sumoshapes int numAdtLists = m_map_blender_to_gameAdtList.size(); for (int i = 0; i < numAdtLists; i++) { BL_InterpolatorList *adtList = *m_map_blender_to_gameAdtList.at(i); delete (adtList); } vector<pair<KX_Scene *, KX_WorldInfo *> >::iterator itw = m_worldinfos.begin(); while (itw != m_worldinfos.end()) { delete itw->second; itw++; } m_worldinfos.clear(); vector<pair<KX_Scene *,RAS_IPolyMaterial *> >::iterator itp = m_polymaterials.begin(); while (itp != m_polymaterials.end()) { delete itp->second; itp++; } m_polymaterials.clear(); // delete after RAS_IPolyMaterial vector<pair<KX_Scene *,BL_Material *> >::iterator itmat = m_materials.begin(); while (itmat != m_materials.end()) { delete itmat->second; itmat++; } m_materials.clear(); vector<pair<KX_Scene *,RAS_MeshObject *> >::iterator itm = m_meshobjects.begin(); while (itm != m_meshobjects.end()) { delete itm->second; itm++; } m_meshobjects.clear(); /* free any data that was dynamically loaded */ while (m_DynamicMaggie.size() != 0) { FreeBlendFile(m_DynamicMaggie[0]); } m_DynamicMaggie.clear(); if (m_threadinfo) { /* Thread infos like mutex must be freed after FreeBlendFile function. Because it needs to lock the mutex, even if there's no active task when it's in the scene converter destructor. */ BLI_task_pool_free(m_threadinfo->m_pool); BLI_mutex_end(&m_threadinfo->m_mutex); delete m_threadinfo; } }
bool KX_BlenderSceneConverter::FreeBlendFile(const char *path) { return FreeBlendFile(GetMainDynamicPath(path)); }