diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2006-12-25 07:11:39 +0300 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2006-12-25 07:11:39 +0300 |
commit | 5aabafeb9944b2ed27b1a9158154f134e0d2f150 (patch) | |
tree | 4caa694229eedec458cb851f57142642c1fc1f08 /source/gameengine | |
parent | e820cdf6a0ab757cd83ffafd0ea04d736c3faa63 (diff) |
prevent crashes: some python scripts keep 'global variable' access to destroyed game objects.
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index dfd9af1a93f..67c82ee2082 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -519,7 +519,8 @@ void KX_GameObject::NodeSetLocalPosition(const MT_Point3& trans) m_pPhysicsController1->setPosition(trans); } - GetSGNode()->SetLocalPosition(trans); + if (GetSGNode()) + GetSGNode()->SetLocalPosition(trans); } @@ -530,8 +531,13 @@ void KX_GameObject::NodeSetLocalOrientation(const MT_Matrix3x3& rot) { m_pPhysicsController1->setOrientation(rot.getRotation()); } - - GetSGNode()->SetLocalOrientation(rot); + if (GetSGNode()) + GetSGNode()->SetLocalOrientation(rot); + else + { + int i; + i=0; + } } @@ -543,21 +549,24 @@ void KX_GameObject::NodeSetLocalScale(const MT_Vector3& scale) m_pPhysicsController1->setScaling(scale); } - GetSGNode()->SetLocalScale(scale); + if (GetSGNode()) + GetSGNode()->SetLocalScale(scale); } void KX_GameObject::NodeSetRelativeScale(const MT_Vector3& scale) { - GetSGNode()->RelativeScale(scale); + if (GetSGNode()) + GetSGNode()->RelativeScale(scale); } void KX_GameObject::NodeUpdateGS(double time,bool bInitiator) { - GetSGNode()->UpdateWorldData(time); + if (GetSGNode()) + GetSGNode()->UpdateWorldData(time); } |