Revision: 39585 http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39585 Author: phabtar Date: 2011-08-21 13:51:04 +0000 (Sun, 21 Aug 2011) Log Message: ----------- export animations if a bone is in a deform group. ( on hold )
Modified Paths: -------------- branches/soc-2011-pepper/source/blender/collada/AnimationExporter.cpp branches/soc-2011-pepper/source/blender/collada/AnimationExporter.h branches/soc-2011-pepper/source/blender/collada/ArmatureExporter.cpp Modified: branches/soc-2011-pepper/source/blender/collada/AnimationExporter.cpp =================================================================== --- branches/soc-2011-pepper/source/blender/collada/AnimationExporter.cpp 2011-08-21 13:31:46 UTC (rev 39584) +++ branches/soc-2011-pepper/source/blender/collada/AnimationExporter.cpp 2011-08-21 13:51:04 UTC (rev 39585) @@ -352,13 +352,34 @@ 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; Modified: branches/soc-2011-pepper/source/blender/collada/AnimationExporter.h =================================================================== --- branches/soc-2011-pepper/source/blender/collada/AnimationExporter.h 2011-08-21 13:31:46 UTC (rev 39584) +++ branches/soc-2011-pepper/source/blender/collada/AnimationExporter.h 2011-08-21 13:51:04 UTC (rev 39585) @@ -102,6 +102,8 @@ 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); Modified: branches/soc-2011-pepper/source/blender/collada/ArmatureExporter.cpp =================================================================== --- branches/soc-2011-pepper/source/blender/collada/ArmatureExporter.cpp 2011-08-21 13:31:46 UTC (rev 39584) +++ branches/soc-2011-pepper/source/blender/collada/ArmatureExporter.cpp 2011-08-21 13:51:04 UTC (rev 39585) @@ -167,6 +167,7 @@ // 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); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs