BGE: fix bug #26775, crash when physics constraint is defined on non-active objects...
authorBenoit Bolsee <benoit.bolsee@online.be>
Mon, 30 May 2011 15:40:01 +0000 (15:40 +0000)
committerBenoit Bolsee <benoit.bolsee@online.be>
Mon, 30 May 2011 15:40:01 +0000 (15:40 +0000)
source/gameengine/Converter/BL_BlenderDataConversion.cpp

index 1fb30925446cf8c2a6678602b03835ff1387f3ff..af768050bb62b5e36a70224222480d2729017170 100644 (file)
@@ -2608,6 +2608,9 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
                bConstraint *curcon;
                conlist = get_active_constraints2(blenderobject);
 
+               if((gameobj->GetLayer()&activeLayerBitInfo)==0)
+                       continue;
+
                if (conlist) {
                        for (curcon = (bConstraint *)conlist->first; curcon; curcon=(bConstraint *)curcon->next) {
                                if (curcon->type==CONSTRAINT_TYPE_RIGIDBODYJOINT){
@@ -2621,7 +2624,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
                                                if (dat->tar)
                                                {
                                                        KX_GameObject *gotar=getGameOb(dat->tar->id.name+2,sumolist);
-                                                       if (gotar && gotar->GetPhysicsController())
+                                                       if (gotar && ((gotar->GetLayer()&activeLayerBitInfo)!=0) && gotar->GetPhysicsController())
                                                                physctr2 = (PHY_IPhysicsController*) gotar->GetPhysicsController()->GetUserData();
                                                }