[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24570] trunk/blender/source/gameengine/ Converter/KX_IpoConvert.cpp: [#19896] [bugfix] Fixing converting of rotation f-curves

Campbell Barton ideasman42 at gmail.com
Sun Nov 15 12:32:53 CET 2009


Revision: 24570
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24570
Author:   campbellbarton
Date:     2009-11-15 12:32:53 +0100 (Sun, 15 Nov 2009)

Log Message:
-----------
[#19896] [bugfix] Fixing converting of rotation f-curves
from Mitchell Stokes (moguri) 

--- from the patch
With f-curves there are 3 rotation modes, rotation_euler, rotation_axis_angle, and rotation_quaternion. The IPO converter
was still simply looking for "rotation" f-curves instead of specific ones. This patch fixes that and also
fixes bug #19873 ( http://projects.blender.org/tracker/index.php?func=detail&aid=19873&group_id=9&atid=306
).

Modified Paths:
--------------
    trunk/blender/source/gameengine/Converter/KX_IpoConvert.cpp

Modified: trunk/blender/source/gameengine/Converter/KX_IpoConvert.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/KX_IpoConvert.cpp	2009-11-15 11:32:29 UTC (rev 24569)
+++ trunk/blender/source/gameengine/Converter/KX_IpoConvert.cpp	2009-11-15 11:32:53 UTC (rev 24570)
@@ -53,6 +53,7 @@
 #endif
 
 #include "DNA_object_types.h"
+#include "DNA_action_types.h"
 #include "DNA_ipo_types.h"
 #include "DNA_lamp_types.h"
 #include "DNA_world_types.h"
@@ -120,6 +121,21 @@
 			)
 		);
 
+		char *rotmode, *drotmode;
+
+		switch(blenderobject->rotmode)
+		{
+		case ROT_MODE_AXISANGLE:
+			rotmode = "rotation_axis_angle";
+			drotmode = "delta_rotation_axis_angle";
+		case ROT_MODE_QUAT:
+			rotmode = "rotation_quaternion";
+			drotmode = "delta_rotation_quaternion";
+		default:
+			rotmode = "rotation_euler";
+			drotmode = "delta_rotation_euler";
+		}
+
 		BL_InterpolatorList *adtList= GetAdtList(blenderobject->adt, converter);
 		
 		// For each active channel in the adtList add an
@@ -143,14 +159,14 @@
 			}
 		}
 		for(int i=0; i<3; i++) {
-			if ((interp = adtList->GetScalarInterpolator("rotation", i))) {
+			if ((interp = adtList->GetScalarInterpolator(rotmode, i))) {
 				interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetEulerAngles()[i]), interp);
 				ipocontr->AddInterpolator(interpolator);
 				ipocontr->SetIPOChannelActive(OB_ROT_X+i, true);
 			}
 		}
 		for(int i=0; i<3; i++) {
-			if ((interp = adtList->GetScalarInterpolator("delta_rotation", i))) {
+			if ((interp = adtList->GetScalarInterpolator(drotmode, i))) {
 				interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetDeltaEulerAngles()[i]), interp);
 				ipocontr->AddInterpolator(interpolator);
 				ipocontr->SetIPOChannelActive(OB_DROT_X+i, true);





More information about the Bf-blender-cvs mailing list