diff options
-rw-r--r-- | source/blender/collada/AnimationExporter.cpp | 23 | ||||
-rw-r--r-- | source/blender/collada/AnimationExporter.h | 2 | ||||
-rw-r--r-- | source/blender/collada/ArmatureExporter.cpp | 1 |
3 files changed, 25 insertions, 1 deletions
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 8a7d285abcb..014c13d8986 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -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; diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index c628e5633b7..495cdefc9a2 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -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); diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index 082105baaba..bd7aea16b29 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -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); |