diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-11-15 14:32:53 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-11-15 14:32:53 +0300 |
commit | 635a98a4cec5d96ff566c965c9f15c6e5e57643b (patch) | |
tree | 0f0237bcfaa1210163390ff5ab915564beb173b6 /source | |
parent | 61fe981a0faaa234480ac7e900f038cd9cd50aeb (diff) |
[#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
).
Diffstat (limited to 'source')
-rw-r--r-- | source/gameengine/Converter/KX_IpoConvert.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
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); |