[Bf-blender-cvs] [1cf4f1dd5fb] collada: Fix: Collada: Added back the handling of Armature animation export.

Gaia Clary noreply at git.blender.org
Wed Mar 28 21:31:12 CEST 2018


Commit: 1cf4f1dd5fb56d441f5046187cde0087e268354b
Author: Gaia Clary
Date:   Sat Mar 24 18:15:32 2018 +0100
Branches: collada
https://developer.blender.org/rB1cf4f1dd5fb56d441f5046187cde0087e268354b

Fix: Collada: Added back the handling of Armature animation export.

The previous commit removed also the Export of bone animations.
This is now fixed.

===================================================================

M	source/blender/collada/AnimationExporter.cpp
M	source/blender/collada/AnimationExporter.h

===================================================================

diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index 605ce3c5c76..59189969573 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -152,9 +152,29 @@ void AnimationExporter::exportObjectAnimation(Object *ob, BCAnimationSampler &sa
 		export_curve_animation_set(ob, sampler); // each curve might have different frames
 	}
 
+	if (ob->type == OB_ARMATURE) {
+		container_is_open = exportArmatureAnimation(ob, sampler, container_is_open);
+	}
+
 	close_animation_container(container_is_open);
 }
 
+bool AnimationExporter::exportArmatureAnimation(Object *ob, BCAnimationSampler &sampler, bool has_container)
+{
+	/* TODO: This needs to be handled by extra profiles, postponed for now
+	* export_morph_animation(ob);
+	*/
+
+	if (ob->type == OB_ARMATURE) {
+		/* Export skeletal animation (if any) */
+		bArmature *arm = (bArmature *)ob->data;
+		for (Bone *root_bone = (Bone *)arm->bonebase.first; root_bone; root_bone = root_bone->next)
+			export_bone_animation_recursive(ob, root_bone, sampler);
+	}
+
+	return has_container;
+}
+
 /*
  * Export all animation FCurves of an Object.
  *
diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h
index 39938f3a371..280b96e15f0 100644
--- a/source/blender/collada/AnimationExporter.h
+++ b/source/blender/collada/AnimationExporter.h
@@ -108,6 +108,7 @@ public:
 
 	// Main entry point into Animation export (called for each exported object)
 	void exportObjectAnimation(Object *ob, BCAnimationSampler &sampler);
+	bool exportArmatureAnimation(Object *ob, BCAnimationSampler &sampler, bool has_container);
 
 protected:



More information about the Bf-blender-cvs mailing list