Just copied over changes in engine, from bf-blender. This someohow was
missing in the previous bf-blender sync. Now engine compiles for orange tree too.
This commit is contained in:
@@ -59,18 +59,18 @@
|
||||
BL_ActionActuator::~BL_ActionActuator()
|
||||
{
|
||||
if (m_pose) {
|
||||
// clear_pose(m_pose);
|
||||
free_pose_channels(m_pose);
|
||||
MEM_freeN(m_pose);
|
||||
m_pose = NULL;
|
||||
};
|
||||
|
||||
if (m_userpose){
|
||||
// clear_pose(m_userpose);
|
||||
free_pose_channels(m_userpose);
|
||||
MEM_freeN(m_userpose);
|
||||
m_userpose=NULL;
|
||||
}
|
||||
if (m_blendpose) {
|
||||
// clear_pose(m_blendpose);
|
||||
free_pose_channels(m_blendpose);
|
||||
MEM_freeN(m_blendpose);
|
||||
m_blendpose = NULL;
|
||||
};
|
||||
|
||||
@@ -68,15 +68,16 @@ void BL_ArmatureObject::ProcessReplica(BL_ArmatureObject *replica)
|
||||
BL_ArmatureObject::~BL_ArmatureObject()
|
||||
{
|
||||
if (m_mrdPose){
|
||||
// clear_pose(m_mrdPose);
|
||||
free_pose_channels(m_mrdPose);
|
||||
MEM_freeN(m_mrdPose);
|
||||
}
|
||||
}
|
||||
|
||||
/* note, you can only call this for exisiting Armature objects, and not mix it with other Armatures */
|
||||
/* there is only 1 unique Pose per Armature */
|
||||
void BL_ArmatureObject::ApplyPose()
|
||||
{
|
||||
if (m_pose){
|
||||
// apply_pose_armature(GetArmature(), m_pose, 1);
|
||||
if (!m_mrdPose)
|
||||
copy_pose (&m_mrdPose, m_pose, 0);
|
||||
else
|
||||
@@ -160,18 +161,16 @@ bool BL_ArmatureObject::GetBoneMatrix(Bone* bone, MT_Matrix4x4& matrix) const
|
||||
{
|
||||
// ton hack
|
||||
bPoseChannel *pchan= get_pose_channel(m_pose, bone->name);
|
||||
|
||||
// MT_assert(verify_boneptr((bArmature*) GetArmature(), bone) && "Bone is not part of this armature.");
|
||||
|
||||
matrix.setValue(&pchan->pose_mat[0][0]);
|
||||
|
||||
return true;
|
||||
|
||||
if(pchan) {
|
||||
matrix.setValue(&pchan->pose_mat[0][0]);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
float BL_ArmatureObject::GetBoneLength(Bone* bone) const
|
||||
{
|
||||
// MT_assert(verify_boneptr((bArmature*) GetArmature(), bone) && "Bone is not part of this armature.");
|
||||
|
||||
return (MT_Point3(bone->head) - MT_Point3(bone->tail)).length();
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,8 @@ BL_SkinDeformer::~BL_SkinDeformer()
|
||||
{
|
||||
};
|
||||
|
||||
/* XXX note, this __NLA_OLDDEFORM define seems to be obsolete */
|
||||
|
||||
bool BL_SkinDeformer::Apply(RAS_IPolyMaterial *mat)
|
||||
{
|
||||
size_t i, j, index;
|
||||
@@ -113,7 +115,8 @@ bool BL_SkinDeformer::Apply(RAS_IPolyMaterial *mat)
|
||||
co[2]=mvert->co[2];
|
||||
|
||||
// Do the deformation
|
||||
GB_calc_armature_deform(co, dvert);
|
||||
/* XXX note, doesnt exist anymore */
|
||||
// GB_calc_armature_deform(co, dvert);
|
||||
tv->SetXYZ(co);
|
||||
#else
|
||||
// Set the data
|
||||
@@ -149,27 +152,30 @@ void BL_SkinDeformer::Update(void)
|
||||
if (m_lastUpdate!=m_armobj->GetLastFrame()){
|
||||
|
||||
/* Do all of the posing necessary */
|
||||
GB_init_armature_deform (m_defbase, m_premat, m_postmat);
|
||||
m_armobj->ApplyPose();
|
||||
// precalc_armature_posemats (m_armobj->GetArmature());
|
||||
// for (Bone *curBone=(Bone*)m_armobj->GetArmature()->bonebase.first; curBone; curBone=(Bone*)curBone->next)
|
||||
// precalc_bone_defmat(curBone);
|
||||
// note: where_is_pose() does it all...
|
||||
|
||||
VerifyStorage();
|
||||
|
||||
/* Transform the verts & store locally */
|
||||
/* 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);
|
||||
|
||||
/* store verts locally */
|
||||
for (int v =0; v<m_bmesh->totvert; v++){
|
||||
float co[3];
|
||||
|
||||
co[0]=m_bmesh->mvert[v].co[0];
|
||||
co[1]=m_bmesh->mvert[v].co[1];
|
||||
co[2]=m_bmesh->mvert[v].co[2];
|
||||
GB_calc_armature_deform(co, &m_bmesh->dvert[v]);
|
||||
|
||||
m_transverts[v]=MT_Point3(co);
|
||||
/* XXX note, dunno about this line */
|
||||
m_transverts[v]=MT_Point3(m_bmesh->mvert[v].co);
|
||||
}
|
||||
|
||||
/* XXX note: now use this call instead */
|
||||
// void armature_deform_verts(Object *armOb, Object *target, float (*vertexCos)[3], int numVerts, int deformflag)
|
||||
// - armOb = armature object
|
||||
// - target = Mesh
|
||||
// - vertexCos[3] = array of numVerts float vectors (3 floats)
|
||||
// - set deformflag to ARM_DEF_VGROUP
|
||||
// example (after having filled the m_transverts array):
|
||||
// armature_deform_verts(m_armobj, m_meshobj, m_transverts, m_bmesh->totvert, ARM_DEF_VGROUP);
|
||||
|
||||
VerifyStorage();
|
||||
|
||||
RecalcNormals();
|
||||
|
||||
|
||||
@@ -178,15 +184,17 @@ void BL_SkinDeformer::Update(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX note: I propose to drop this function */
|
||||
|
||||
void BL_SkinDeformer::SetArmature(BL_ArmatureObject *armobj)
|
||||
{
|
||||
m_armobj = armobj;
|
||||
// m_armobj = armobj;
|
||||
|
||||
for (bDeformGroup *dg=(bDeformGroup*)m_defbase->first; dg; dg=(bDeformGroup*)dg->next) {
|
||||
// for (bDeformGroup *dg=(bDeformGroup*)m_defbase->first; dg; dg=(bDeformGroup*)dg->next) {
|
||||
|
||||
/* dg->data no longer exists needs update
|
||||
dg->data = (void*)get_named_bone(m_armobj->GetArmature(), dg->name); */
|
||||
}
|
||||
// }
|
||||
|
||||
GB_validate_defgroups(m_bmesh, m_defbase);
|
||||
// GB_validate_defgroups(m_bmesh, m_defbase);
|
||||
}
|
||||
|
||||
@@ -71,9 +71,9 @@ public:
|
||||
m_defbase(&bmeshobj->defbase)
|
||||
{
|
||||
/* Build all precalculatable matrices for bones */
|
||||
|
||||
GB_build_mats(bmeshobj->parent->obmat, bmeshobj->obmat, m_premat, m_postmat);
|
||||
GB_validate_defgroups((Mesh*)bmeshobj->data, m_defbase);
|
||||
/* XXX note: obsolete */
|
||||
// GB_build_mats(bmeshobj->parent->obmat, bmeshobj->obmat, m_premat, m_postmat);
|
||||
// GB_validate_defgroups((Mesh*)bmeshobj->data, m_defbase);
|
||||
// Validate bone data in bDeformGroups
|
||||
/*
|
||||
for (bDeformGroup *dg=(bDeformGroup*)m_defbase->first; dg; dg=(bDeformGroup*)dg->next)
|
||||
@@ -91,8 +91,9 @@ public:
|
||||
m_lastUpdate(-1),
|
||||
m_defbase(&bmeshobj_old->defbase)
|
||||
{
|
||||
GB_build_mats(bmeshobj_new->parent->obmat, bmeshobj_new->obmat, m_premat, m_postmat);
|
||||
GB_validate_defgroups((Mesh*)bmeshobj_old->data, m_defbase);
|
||||
/* XXX note: obsolete */
|
||||
// GB_build_mats(bmeshobj_new->parent->obmat, bmeshobj_new->obmat, m_premat, m_postmat);
|
||||
// GB_validate_defgroups((Mesh*)bmeshobj_old->data, m_defbase);
|
||||
};
|
||||
|
||||
virtual void ProcessReplica();
|
||||
@@ -103,8 +104,9 @@ public:
|
||||
|
||||
protected:
|
||||
BL_ArmatureObject *m_armobj; // Our parent object
|
||||
float m_premat[4][4];
|
||||
float m_postmat[4][4];
|
||||
/* XXX note obsolete */
|
||||
// float m_premat[4][4];
|
||||
// float m_postmat[4][4];
|
||||
float m_time;
|
||||
double m_lastUpdate;
|
||||
ListBase *m_defbase;
|
||||
|
||||
Reference in New Issue
Block a user