forked from bartvdbraak/blender
BGE Animations: The IPO conversion code relied on objects having an adt, but this isn't always the case. object->adt can be NULL, which causes a crash. Now BL_InterpolatorLists are cached by action instead of adt.
This commit is contained in:
parent
c334bf69a7
commit
5cc0bb0d1b
@ -566,18 +566,18 @@ void KX_BlenderSceneConverter::RegisterPolyMaterial(RAS_IPolyMaterial *polymat)
|
||||
|
||||
|
||||
void KX_BlenderSceneConverter::RegisterInterpolatorList(
|
||||
BL_InterpolatorList *adtList,
|
||||
struct AnimData *for_adt)
|
||||
BL_InterpolatorList *actList,
|
||||
struct bAction *for_act)
|
||||
{
|
||||
m_map_blender_to_gameAdtList.insert(CHashedPtr(for_adt), adtList);
|
||||
m_map_blender_to_gameAdtList.insert(CHashedPtr(for_act), actList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
BL_InterpolatorList *KX_BlenderSceneConverter::FindInterpolatorList(
|
||||
struct AnimData *for_adt)
|
||||
struct bAction *for_act)
|
||||
{
|
||||
BL_InterpolatorList **listp = m_map_blender_to_gameAdtList[CHashedPtr(for_adt)];
|
||||
BL_InterpolatorList **listp = m_map_blender_to_gameAdtList[CHashedPtr(for_act)];
|
||||
|
||||
return listp?*listp:NULL;
|
||||
}
|
||||
|
@ -113,8 +113,8 @@ public:
|
||||
|
||||
void RegisterBlenderMaterial(BL_Material *mat);
|
||||
|
||||
void RegisterInterpolatorList(BL_InterpolatorList *adtList, struct AnimData *for_adt);
|
||||
BL_InterpolatorList *FindInterpolatorList(struct AnimData *for_adt);
|
||||
void RegisterInterpolatorList(BL_InterpolatorList *actList, struct bAction *for_act);
|
||||
BL_InterpolatorList *FindInterpolatorList(struct bAction *for_act);
|
||||
|
||||
void RegisterGameActuator(SCA_IActuator *act, struct bActuator *for_actuator);
|
||||
SCA_IActuator *FindGameActuator(struct bActuator *for_actuator);
|
||||
|
@ -73,12 +73,12 @@
|
||||
|
||||
#include "STR_HashedString.h"
|
||||
|
||||
static BL_InterpolatorList *GetAdtList(struct AnimData *for_adt, KX_BlenderSceneConverter *converter) {
|
||||
BL_InterpolatorList *adtList= converter->FindInterpolatorList(for_adt);
|
||||
static BL_InterpolatorList *GetAdtList(struct bAction *for_act, KX_BlenderSceneConverter *converter) {
|
||||
BL_InterpolatorList *adtList= converter->FindInterpolatorList(for_act);
|
||||
|
||||
if (!adtList) {
|
||||
adtList = new BL_InterpolatorList(for_adt->action);
|
||||
converter->RegisterInterpolatorList(adtList, for_adt);
|
||||
adtList = new BL_InterpolatorList(for_act);
|
||||
converter->RegisterInterpolatorList(adtList, for_act);
|
||||
}
|
||||
|
||||
return adtList;
|
||||
@ -128,7 +128,7 @@ SG_Controller *BL_CreateIPO(struct bAction *action, KX_GameObject* gameobj, KX_B
|
||||
drotmode = "delta_rotation_euler";
|
||||
}
|
||||
|
||||
BL_InterpolatorList *adtList= GetAdtList(blenderobject->adt, converter);
|
||||
BL_InterpolatorList *adtList= GetAdtList(action, converter);
|
||||
|
||||
// For each active channel in the adtList add an
|
||||
// interpolator to the game object.
|
||||
@ -222,7 +222,7 @@ void BL_ConvertLampIpos(struct Lamp* blenderlamp, KX_GameObject *lightobj,KX_Ble
|
||||
ipocontr->m_col_rgb[2] = blenderlamp->b;
|
||||
ipocontr->m_dist = blenderlamp->dist;
|
||||
|
||||
BL_InterpolatorList *adtList= GetAdtList(blenderlamp->adt, converter);
|
||||
BL_InterpolatorList *adtList= GetAdtList(blenderlamp->adt->action, converter);
|
||||
|
||||
// For each active channel in the adtList add an
|
||||
// interpolator to the game object.
|
||||
@ -268,7 +268,7 @@ void BL_ConvertCameraIpos(struct Camera* blendercamera, KX_GameObject *cameraobj
|
||||
ipocontr->m_clipstart = blendercamera->clipsta;
|
||||
ipocontr->m_clipend = blendercamera->clipend;
|
||||
|
||||
BL_InterpolatorList *adtList= GetAdtList(blendercamera->adt, converter);
|
||||
BL_InterpolatorList *adtList= GetAdtList(blendercamera->adt->action, converter);
|
||||
|
||||
// For each active channel in the adtList add an
|
||||
// interpolator to the game object.
|
||||
@ -316,7 +316,7 @@ void BL_ConvertWorldIpos(struct World* blenderworld,KX_BlenderSceneConverter *co
|
||||
ipocontr->m_mist_rgb[1] = blenderworld->horg;
|
||||
ipocontr->m_mist_rgb[2] = blenderworld->horb;
|
||||
|
||||
BL_InterpolatorList *adtList= GetAdtList(blenderworld->adt, converter);
|
||||
BL_InterpolatorList *adtList= GetAdtList(blenderworld->adt->action, converter);
|
||||
|
||||
// For each active channel in the adtList add an
|
||||
// interpolator to the game object.
|
||||
@ -358,7 +358,7 @@ static void ConvertMaterialIpos(
|
||||
gameobj->GetSGNode()->AddSGController(ipocontr);
|
||||
ipocontr->SetObject(gameobj->GetSGNode());
|
||||
|
||||
BL_InterpolatorList *adtList= GetAdtList(blendermaterial->adt, converter);
|
||||
BL_InterpolatorList *adtList= GetAdtList(blendermaterial->adt->action, converter);
|
||||
|
||||
|
||||
ipocontr->m_rgba[0] = blendermaterial->r;
|
||||
|
Loading…
Reference in New Issue
Block a user