[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27909] trunk/blender/source: BGE fix: Parenting the object to itself crashes BGE + stubs update

Dalai Felinto dfelinto at gmail.com
Thu Apr 1 00:50:01 CEST 2010


Revision: 27909
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27909
Author:   dfelinto
Date:     2010-04-01 00:49:59 +0200 (Thu, 01 Apr 2010)

Log Message:
-----------
BGE fix: Parenting the object to itself crashes BGE + stubs update
it may happen if you start doing exec, setParent, ... in Python
not a big deal, but to crash Blender is always bad

Modified Paths:
--------------
    trunk/blender/source/blenderplayer/bad_level_call_stubs/stubs.c
    trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp

Modified: trunk/blender/source/blenderplayer/bad_level_call_stubs/stubs.c
===================================================================
--- trunk/blender/source/blenderplayer/bad_level_call_stubs/stubs.c	2010-03-31 20:39:08 UTC (rev 27908)
+++ trunk/blender/source/blenderplayer/bad_level_call_stubs/stubs.c	2010-03-31 22:49:59 UTC (rev 27909)
@@ -186,6 +186,8 @@
 
 
 /* rna editors */
+int insert_vert_fcurve(struct FCurve *fcu, float x, float y, short flag){return 0;}
+void delete_fcurve_key(struct FCurve *fcu, int index, short do_recalc){}
 struct KeyingSetInfo *ANIM_keyingset_info_find_named (const char name[]){return (struct KeyingSetInfo *) NULL;}
 struct KeyingSet *ANIM_scene_get_active_keyingset (struct Scene *scene){return (struct KeyingSet *) NULL;}
 int ANIM_scene_get_keyingset_index(struct Scene *scene, struct KeyingSet *ks){return 0;}

Modified: trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp	2010-03-31 20:39:08 UTC (rev 27908)
+++ trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp	2010-03-31 22:49:59 UTC (rev 27909)
@@ -238,7 +238,8 @@
 		GetSGNode() &&			// object is not zombi
 		obj->GetSGNode() &&		// object is not zombi
 		GetSGNode()->GetSGParent() != obj->GetSGNode() &&	// not already parented to same object
-		!GetSGNode()->IsAncessor(obj->GetSGNode()))			// no parenting loop
+		!GetSGNode()->IsAncessor(obj->GetSGNode()) && 		// no parenting loop
+		this != obj)										// not the object itself
 	{
 		// Make sure the objects have some scale
 		MT_Vector3 scale1 = NodeGetWorldScaling();





More information about the Bf-blender-cvs mailing list