From 635a98a4cec5d96ff566c965c9f15c6e5e57643b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 15 Nov 2009 11:32:53 +0000 Subject: [#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 ). --- source/gameengine/Converter/KX_IpoConvert.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'source/gameengine') diff --git a/source/gameengine/Converter/KX_IpoConvert.cpp b/source/gameengine/Converter/KX_IpoConvert.cpp index 848fcfcdaa0..cb823805435 100644 --- a/source/gameengine/Converter/KX_IpoConvert.cpp +++ b/source/gameengine/Converter/KX_IpoConvert.cpp @@ -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 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend ) ); + 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 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend } } 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); -- cgit v1.2.3