- Charlie fixed some bugs related to copying armature-constraint data (these are different from Bullet rigidbody constraints like the hinge, and point 2 point!)

- fixed a crashing bug related to objects without meshes (tried to get material info from it)
This commit is contained in:
Erwin Coumans 2006-04-28 17:35:03 +00:00
parent 702207f03f
commit be282bdf3f
4 changed files with 26 additions and 25 deletions

@ -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;
};
*/
}

@ -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);

@ -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;
}

@ -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);