Fixing a crash when dynamically loading a scene that contains a bone parent.
authorMitchell Stokes <mogurijin@gmail.com>
Fri, 19 Nov 2010 04:06:06 +0000 (04:06 +0000)
committerMitchell Stokes <mogurijin@gmail.com>
Fri, 19 Nov 2010 04:06:06 +0000 (04:06 +0000)
source/gameengine/Ketsji/KX_Scene.cpp

index c48112dbcb73a13913c7ba131aebc961921419ee..0605650bb091a5b1f842af1be9cbc57e8ab8c900 100644 (file)
@@ -1722,6 +1722,11 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene
        if(sg) {
                if(sg->GetSGClientInfo() == from) {
                        sg->SetSGClientInfo(to);
+
+                       /* Make sure to grab the children too since they might not be tied to a game object */
+                       NodeList children = sg->GetSGChildren();
+                       for (int i=0; i<children.size(); i++)
+                                       children[i]->SetSGClientInfo(to);
                }
 #ifdef USE_BULLET
                SGControllerList::iterator contit;