[Bf-blender-cvs] [b9303b8] blender-v2.72-release: Fix another crash with Navigation mesh.

Benoit Bolsee noreply at git.blender.org
Wed Oct 15 13:08:26 CEST 2014


Commit: b9303b880531c9fd75386432c5db59cbfddc724d
Author: Benoit Bolsee
Date:   Sat Oct 11 12:14:02 2014 +0200
Branches: blender-v2.72-release
https://developer.blender.org/rBb9303b880531c9fd75386432c5db59cbfddc724d

Fix another crash with Navigation mesh.

Navigation mesh object need to access the current scene at
creation time. This can be at scene start or when an object
is instantiated from an inactive layer. The method of getting
the scene differs in these cases. This fix handles both.

===================================================================

M	source/gameengine/Ketsji/KX_GameObject.cpp

===================================================================

diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index c681e08..dc24640 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -1587,9 +1587,10 @@ CListValue* KX_GameObject::GetChildrenRecursive()
 KX_Scene* KX_GameObject::GetScene()
 {
 	SG_Node* node = this->GetSGNode();
-	KX_Scene* scene = static_cast<KX_Scene*>(node->GetSGClientInfo());
-
-	return scene;
+    if (node == NULL)
+        // this happens for object in non active layers, rely on static scene then
+        return KX_GetActiveScene();
+    return static_cast<KX_Scene*>(node->GetSGClientInfo());
 }
 
 /* ---------------------------------------------------------------------




More information about the Bf-blender-cvs mailing list