[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22829] trunk/blender/source: fix for crash when a parent compound object didn' t get a physics controller.

Campbell Barton ideasman42 at gmail.com
Fri Aug 28 01:29:07 CEST 2009


Revision: 22829
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22829
Author:   campbellbarton
Date:     2009-08-28 01:29:07 +0200 (Fri, 28 Aug 2009)

Log Message:
-----------
fix for crash when a parent compound object didn't get a physics controller.
also show this in the UI.

Modified Paths:
--------------
    trunk/blender/source/blender/src/buttons_logic.c
    trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp

Modified: trunk/blender/source/blender/src/buttons_logic.c
===================================================================
--- trunk/blender/source/blender/src/buttons_logic.c	2009-08-27 23:23:45 UTC (rev 22828)
+++ trunk/blender/source/blender/src/buttons_logic.c	2009-08-27 23:29:07 UTC (rev 22829)
@@ -3513,14 +3513,20 @@
 			}
 			if (ob->body_type!=OB_BODY_TYPE_SOFT)
 			{
-				if (ob->parent)
-					uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Add to parent", 240,105,110,19, 
-							&ob->gameflag, 0, 0, 0, 0, 
-							"Add this shape to the parent compound shape");
-				else
-					uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 240,105,110,19, 
-							&ob->gameflag, 0, 0, 0, 0, 
-							"Create a compound shape with the children's shape that are tagged for addition");
+				if (ob->parent) {
+					if(ob->parent->gameflag & (OB_DYNAMIC|OB_COLLISION)) {
+						uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Add to parent", 240,105,110,19, 
+								&ob->gameflag, 0, 0, 0, 0, 
+								"Add this shape to the parent compound shape");
+					}
+				}
+				else {
+					if(ob->gameflag & (OB_DYNAMIC|OB_COLLISION)) {
+						uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 240,105,110,19, 
+								&ob->gameflag, 0, 0, 0, 0, 
+								"Create a compound shape with the children's shape that are tagged for addition");
+					}
+				}
 			}
 		}
 		uiBlockEndAlign(block);

Modified: trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp	2009-08-27 23:23:45 UTC (rev 22828)
+++ trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp	2009-08-27 23:29:07 UTC (rev 22829)
@@ -1381,7 +1381,9 @@
 	bool isCompoundChild = false;
 	bool hasCompoundChildren = !parent && (blenderobject->gameflag & OB_CHILD);
 
-	if (parent/* && (parent->gameflag & OB_DYNAMIC)*/) {
+	/* When the parent is not OB_DYNAMIC and has no OB_COLLISION then it gets no bullet controller
+	 * and cant be apart of the parents compound shape */
+	if (parent && (parent->gameflag & (OB_DYNAMIC | OB_COLLISION))) {
 		
 		if ((parent->gameflag & OB_CHILD) != 0 && (blenderobject->gameflag & OB_CHILD))
 		{





More information about the Bf-blender-cvs mailing list