[#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
).
This commit is contained in:
Campbell Barton 2009-11-15 11:32:53 +00:00
parent 61fe981a0f
commit 635a98a4ce

@ -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);