- Charlie fixed some bugs related to copying armature-constraint data (these are...
authorErwin Coumans <blender@erwincoumans.com>
Fri, 28 Apr 2006 17:35:03 +0000 (17:35 +0000)
committerErwin Coumans <blender@erwincoumans.com>
Fri, 28 Apr 2006 17:35:03 +0000 (17:35 +0000)
- fixed a crashing bug related to objects without meshes (tried to get material info from it)

source/gameengine/Converter/BL_ActionActuator.cpp
source/gameengine/Converter/BL_ArmatureObject.cpp
source/gameengine/Converter/BL_SkinDeformer.cpp
source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp

index 293845c51b3f888e6b6a795683710040c7982699..2a7503d610d67641a49d56b3cbdc75600b1fb453 100644 (file)
@@ -58,8 +58,7 @@
 
 BL_ActionActuator::~BL_ActionActuator()
 {
-       //todo Charlie, can you look into this?
-       /*
+
        if (m_pose) {
                free_pose_channels(m_pose);
                MEM_freeN(m_pose);
@@ -76,8 +75,6 @@ BL_ActionActuator::~BL_ActionActuator()
                MEM_freeN(m_blendpose);
                m_blendpose = NULL;
        };
-       */
-
        
 }
 
index 7497f10724d9bbaa0720047a8bce6024315245a3..91c527f198006ee159b367486f9741a3d56063e8 100644 (file)
@@ -146,8 +146,16 @@ void BL_ArmatureObject::GetPose(bPose **pose)
 {
        /* If the caller supplies a null pose, create a new one. */
        /* Otherwise, copy the armature's pose channels into the caller-supplied pose */
-       if (!*pose)
-               copy_pose(pose, m_pose, 0);
+
+       if (!*pose) {
+               /*      probably not to good of an idea to
+                       duplicate everying, but it clears up 
+                       a crash and memory leakage when 
+                       &BL_ActionActuator::m_pose is freed
+               */
+               int copy_constraint_channels_hack = 1;
+               copy_pose(pose, m_pose, copy_constraint_channels_hack);
+       }
        else
                extract_pose_from_pose(*pose, m_pose);
 
index dc35221335a57b94d22c084491718fdad60bfd85..3645491412e360812ba4b10bb77bce02b982ab5a 100644 (file)
@@ -164,28 +164,18 @@ void BL_SkinDeformer::Update(void)
                
                /* XXX note: where_is_pose() (from BKE_armature.h) calculates all matrices needed to start deforming */
                /* but it requires the blender object pointer... */
-               //void where_is_pose (Object *ob);
-//             where_is_pose (m_blenderArmatureObj);
-               
-               /* store verts locally */
-//             for (int v =0; v<m_bmesh->totvert; v++){
-                       /* XXX note, dunno about this line */
-//                     m_transverts[v]=MT_Point3(m_bmesh->mvert[v].co);
-//             }
-               
-//             float   test[1000][3];
-
-//             armature_deform_verts(m_blenderArmatureObj,m_blenderMeshObject,test,m_bmesh->totvert,ARM_DEF_VGROUP);
-
 
                Object* par_arma = m_armobj->GetArmatureObject();
                where_is_pose( par_arma ); 
+
                /* store verts locally */
                VerifyStorage();
+       
+               /* duplicate */
                for (int v =0; v<m_bmesh->totvert; v++)
                        VECCOPY(m_transverts[v], m_bmesh->mvert[v].co);
 
-               armature_deform_verts( par_arma, m_objMesh,m_transverts, m_bmesh->totvert, ARM_DEF_VGROUP );
+               armature_deform_verts( par_arma, m_objMesh, m_transverts, m_bmesh->totvert, ARM_DEF_VGROUP );
                RecalcNormals();
 
                /* Update the current frame */
@@ -196,7 +186,6 @@ void BL_SkinDeformer::Update(void)
 /* XXX note: I propose to drop this function */
 void BL_SkinDeformer::SetArmature(BL_ArmatureObject *armobj)
 {
-       // --
        // only used to set the object now
        m_armobj = armobj;
 }
index ddf6c5bb321295268946ebe573e614997c4dd0b3..7a01849d1a16cfe116c361e70461661daf1db434 100644 (file)
@@ -890,7 +890,7 @@ void        KX_ConvertBulletObject( class   KX_GameObject* gameobj,
        struct  KX_ObjectProperties*    objprop)
 {
 
-               CcdPhysicsEnvironment* env = (CcdPhysicsEnvironment*)kxscene->GetPhysicsEnvironment();
+       CcdPhysicsEnvironment* env = (CcdPhysicsEnvironment*)kxscene->GetPhysicsEnvironment();
        assert(env);
        
 
@@ -900,7 +900,9 @@ void        KX_ConvertBulletObject( class   KX_GameObject* gameobj,
 
        if (objprop->m_ghost)
        {
+               
                ci.m_collisionFlags |= CollisionObject::noContactResponse;
+       
        }
 
        if (!objprop->m_dyna)
@@ -1111,9 +1113,14 @@ void     KX_ConvertBulletObject( class   KX_GameObject* gameobj,
        bool isActor = objprop->m_isactor;
        gameobj->getClientInfo()->m_type = (isActor ? KX_ClientObjectInfo::ACTOR : KX_ClientObjectInfo::STATIC);
        // store materialname in auxinfo, needed for touchsensors
-       const STR_String& matname=meshobj->GetMaterialName(0);
-       gameobj->getClientInfo()->m_auxilary_info = (matname.Length() ? (void*)(matname.ReadPtr()+2) : NULL);
-       
+       if (meshobj)
+       {
+               const STR_String& matname=meshobj->GetMaterialName(0);
+               gameobj->getClientInfo()->m_auxilary_info = (matname.Length() ? (void*)(matname.ReadPtr()+2) : NULL);
+       } else
+       {
+               gameobj->getClientInfo()->m_auxilary_info = 0;
+       }
 
 
        gameobj->GetSGNode()->AddSGController(physicscontroller);