[Bf-blender-cvs] [dfe1b9b] master: Fix T40146: BGE Compound parent crash
Mitchell Stokes
noreply at git.blender.org
Wed Jul 16 02:55:45 CEST 2014
Commit: dfe1b9b7a727d5d4cf998a89153aad9f3f6fde55
Author: Mitchell Stokes
Date: Tue Jul 15 17:52:01 2014 -0700
https://developer.blender.org/rBdfe1b9b7a727d5d4cf998a89153aad9f3f6fde55
Fix T40146: BGE Compound parent crash
===================================================================
M source/gameengine/Ketsji/KX_KetsjiEngine.h
M source/gameengine/Physics/Bullet/CMakeLists.txt
M source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
M source/gameengine/Physics/Bullet/SConscript
===================================================================
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h
index 45d594e..2bc5bad 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.h
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h
@@ -223,6 +223,7 @@ public:
PyObject* GetPyProfileDict();
#endif
void SetSceneConverter(KX_ISceneConverter* sceneconverter);
+ KX_ISceneConverter* GetSceneConverter() { return m_sceneconverter; }
void SetAnimRecordMode(bool animation_record, int startFrame);
RAS_IRasterizer* GetRasterizer() { return m_rasterizer; }
diff --git a/source/gameengine/Physics/Bullet/CMakeLists.txt b/source/gameengine/Physics/Bullet/CMakeLists.txt
index 87d8510..fbaa7bb 100644
--- a/source/gameengine/Physics/Bullet/CMakeLists.txt
+++ b/source/gameengine/Physics/Bullet/CMakeLists.txt
@@ -29,6 +29,7 @@ remove_strict_flags()
set(INC
.
../common
+ ../../Converter
../../Expressions
../../GameLogic
../../Ketsji
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index f34311d..3e0b99e 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -42,6 +42,7 @@ subject to the following restrictions:
#include "PHY_Pro.h"
#include "KX_GameObject.h"
#include "KX_PythonInit.h" // for KX_RasterizerDrawDebugLine
+#include "KX_BlenderSceneConverter.h"
#include "RAS_MeshObject.h"
#include "RAS_Polygon.h"
#include "RAS_TexVert.h"
@@ -3044,9 +3045,17 @@ void CcdPhysicsEnvironment::ConvertObject(KX_GameObject *gameobj, RAS_MeshObject
CcdConstructionInfo ci;
class CcdShapeConstructionInfo *shapeInfo = new CcdShapeConstructionInfo();
- KX_GameObject *parent = gameobj->GetParent();
- if (parent)
+ // get Root Parent of blenderobject
+ Object *blenderparent = blenderobject->parent;
+ while (blenderparent && blenderparent->parent) {
+ blenderparent = blenderparent->parent;
+ }
+
+ KX_GameObject *parent = NULL;
+ if (blenderparent)
{
+ KX_BlenderSceneConverter *converter = (KX_BlenderSceneConverter*)KX_GetActiveEngine()->GetSceneConverter();
+ parent = converter->FindGameObject(blenderparent);
isbulletdyna = false;
isbulletsoftbody = false;
shapeprops->m_mass = 0.f;
diff --git a/source/gameengine/Physics/Bullet/SConscript b/source/gameengine/Physics/Bullet/SConscript
index 2700997..2a8249b 100644
--- a/source/gameengine/Physics/Bullet/SConscript
+++ b/source/gameengine/Physics/Bullet/SConscript
@@ -39,6 +39,7 @@ incs = [
'#source/blender/blenkernel',
'#source/blender/blenlib',
'#source/blender/makesdna',
+ '#source/gameengine/Converter',
'#source/gameengine/Expressions',
'#source/gameengine/GameLogic',
'#source/gameengine/Ketsji',
More information about the Bf-blender-cvs
mailing list