[Bf-blender-cvs] [22f3378c1ba] collada: Cleanup: Added back explicit object type checks in Animation Exporter

Gaia Clary noreply at git.blender.org
Wed Mar 28 21:30:15 CEST 2018


Commit: 22f3378c1ba44d125e9f0f969a8427d7240ad5ce
Author: Gaia Clary
Date:   Thu Mar 1 14:56:17 2018 +0100
Branches: collada
https://developer.blender.org/rB22f3378c1ba44d125e9f0f969a8427d7240ad5ce

Cleanup: Added back explicit object type checks in Animation Exporter

For exporting Lamp Animation or Camera Animation i added utility functions
to fetch the related actions. And only if a matching action was found, the
export was processed for the object. However it turned out that the code
became less clear by this change. So i reverted it back to first check
the object type and only fetch the related action if the object type matches.

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

M	source/blender/collada/AnimationExporter.cpp

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

diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index 6519420a939..400f5f0d4a3 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -328,36 +328,40 @@ void AnimationExporter::operator()(Object *ob)
 	//export_morph_animation(ob);
 		
 	//Export Lamp parameter animations
-	action = bc_getSceneLampAction(ob);
-	if (action) {
-		FCurve *fcu = (FCurve *)action->curves.first;
-		while (fcu) {
-			transformName = extract_transform_name(fcu->rna_path);
+	if (ob->type == OB_LAMP) {
+		action = bc_getSceneLampAction(ob);
+		if (action) {
+			FCurve *fcu = (FCurve *)action->curves.first;
+			while (fcu) {
+				transformName = extract_transform_name(fcu->rna_path);
 
-			if ((STREQ(transformName, "color")) || (STREQ(transformName, "spot_size")) ||
-			    (STREQ(transformName, "spot_blend")) || (STREQ(transformName, "distance")))
-			{
-				create_keyframed_animation(ob, fcu, transformName, true);
+				if ((STREQ(transformName, "color")) || (STREQ(transformName, "spot_size")) ||
+					(STREQ(transformName, "spot_blend")) || (STREQ(transformName, "distance")))
+				{
+					create_keyframed_animation(ob, fcu, transformName, true);
+				}
+				fcu = fcu->next;
 			}
-			fcu = fcu->next;
 		}
 	}
 
 	//Export Camera parameter animations
-	action = bc_getSceneCameraAction(ob);
-	if (action) {
-		FCurve *fcu = (FCurve *)action->curves.first;
-		while (fcu) {
-			transformName = extract_transform_name(fcu->rna_path);
+	if (ob->type == OB_CAMERA) {
+		action = bc_getSceneCameraAction(ob);
+		if (action) {
+			FCurve *fcu = (FCurve *)action->curves.first;
+			while (fcu) {
+				transformName = extract_transform_name(fcu->rna_path);
 
-			if ((STREQ(transformName, "lens")) ||
-			    (STREQ(transformName, "ortho_scale")) ||
-			    (STREQ(transformName, "clip_end")) || 
-				(STREQ(transformName, "clip_start")))
-			{
-				create_keyframed_animation(ob, fcu, transformName, true);
+				if ((STREQ(transformName, "lens")) ||
+					(STREQ(transformName, "ortho_scale")) ||
+					(STREQ(transformName, "clip_end")) ||
+					(STREQ(transformName, "clip_start")))
+				{
+					create_keyframed_animation(ob, fcu, transformName, true);
+				}
+				fcu = fcu->next;
 			}
-			fcu = fcu->next;
 		}
 	}



More information about the Bf-blender-cvs mailing list