diff --git a/source/gameengine/Converter/BL_BlenderConverter.cpp b/source/gameengine/Converter/BL_BlenderConverter.cpp index 683328460d63..a32cb9ebecac 100644 --- a/source/gameengine/Converter/BL_BlenderConverter.cpp +++ b/source/gameengine/Converter/BL_BlenderConverter.cpp @@ -688,6 +688,16 @@ bool BL_BlenderConverter::FreeBlendFile(Main *maggie) KX_Scene *scene = sit->first; SceneSlot& sceneSlot = sit->second; + for (UniquePtrList::iterator it = sceneSlot.m_meshobjects.begin(); it != sceneSlot.m_meshobjects.end(); ) { + RAS_MeshObject *mesh = (*it).get(); + if (IS_TAGGED(mesh->GetMesh())) { + it = sceneSlot.m_meshobjects.erase(it); + } + else { + ++it; + } + } + for (UniquePtrList::iterator it = sceneSlot.m_materials.begin(); it != sceneSlot.m_materials.end(); ) { KX_BlenderMaterial *mat = (*it).get(); Material *bmat = mat->GetBlenderMaterial(); @@ -711,16 +721,6 @@ bool BL_BlenderConverter::FreeBlendFile(Main *maggie) ++it; } } - - for (UniquePtrList::iterator it = sceneSlot.m_meshobjects.begin(); it != sceneSlot.m_meshobjects.end(); ) { - RAS_MeshObject *mesh = (*it).get(); - if (IS_TAGGED(mesh->GetMesh())) { - it = sceneSlot.m_meshobjects.erase(it); - } - else { - ++it; - } - } } #ifdef WITH_PYTHON