export animations if a bone is in a deform group. ( on hold )

This commit is contained in:
2011-08-21 13:51:04 +00:00
parent ee938c3be8
commit 4f75566672
3 changed files with 25 additions and 1 deletions

View File

@@ -352,13 +352,34 @@ void AnimationExporter::exportAnimations(Scene *sce)
if (!ob_arm->adt)
return;
//This will only export animations of bones in deform group.
/*if(!is_bone_deform_group(bone))
return;*/
sample_and_write_bone_animation_matrix(ob_arm, bone);
for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next)
write_bone_animation_matrix(ob_arm, child);
}
bool AnimationExporter::is_bone_deform_group(Bone * bone)
{
bool is_def;
//Check if current bone is deform
if((bone->flag & BONE_NO_DEFORM) == 0 ) return true;
//Check child bones
else
{
for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next){
//loop through all the children until deform bone is found, and then return
is_def = is_bone_deform_group(child);
if (is_def) return true;
}
}
//no deform bone found in children also
return false;
}
void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, Bone *bone)
{
bArmature *arm = (bArmature*)ob_arm->data;

View File

@@ -102,6 +102,8 @@ protected:
void sample_and_write_bone_animation(Object *ob_arm, Bone *bone, int transform_type);
bool is_bone_deform_group(Bone * bone);
void sample_and_write_bone_animation_matrix(Object *ob_arm, Bone *bone);
void sample_animation(float *v, std::vector<float> &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pChan);

View File

@@ -167,6 +167,7 @@ std::string ArmatureExporter::get_joint_sid(Bone *bone, Object *ob_arm)
// parent_mat is armature-space
void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm)
{
/*if((bone->flag & BONE_NO_DEFORM) == 0 ){*/
std::string node_id = get_joint_id(bone, ob_arm);
std::string node_name = std::string(bone->name);
std::string node_sid = get_joint_sid(bone, ob_arm);