svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r22625:22668
authorCampbell Barton <ideasman42@gmail.com>
Fri, 21 Aug 2009 03:09:27 +0000 (03:09 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 21 Aug 2009 03:09:27 +0000 (03:09 +0000)
needed this for 2.5 testing

source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/Converter/KX_BlenderSceneConverter.cpp

index 3d38759d9516f074a8be18835e34d87e48cd6585..6cb4e980a3de05c0692ca86b1036ebfacb0e48ae 100644 (file)
@@ -2404,8 +2404,11 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
                                        obj->Release();
                        }
                        childrenlist->Release();
+                       
                        // now destroy recursively
+                       converter->UnregisterGameObject(childobj); // removing objects during conversion make sure this runs too
                        kxscene->RemoveObject(childobj);
+                       
                        continue;
                }
 
index 3220672c392bc4774ef2747fa8f662f0dc2f3276..151564391f307a3efd6bd609be51af3f39dd794a 100644 (file)
@@ -462,10 +462,11 @@ void KX_BlenderSceneConverter::RegisterGameObject(
        m_map_blender_to_gameobject.insert(CHashedPtr(for_blenderobject),gameobject);
 }
 
+/* only need to run this during conversion since
+ * m_map_blender_to_gameobject is freed after conversion */
 void KX_BlenderSceneConverter::UnregisterGameObject(
                                                                        KX_GameObject *gameobject) 
 {
-#if 0
        struct Object *bobp= gameobject->GetBlenderObject();
        if (bobp) {
                CHashedPtr bptr(bobp);
@@ -477,7 +478,6 @@ void KX_BlenderSceneConverter::UnregisterGameObject(
                        m_map_blender_to_gameobject.remove(bptr);
                }
        }
-#endif
 }
 
 KX_GameObject *KX_BlenderSceneConverter::FindGameObject(