[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16615] trunk/blender/source: BGE patch: new 'Advanced Settings' button to keep special Bullet options away from main UI.

Benoit Bolsee benoit.bolsee at online.be
Fri Sep 19 22:41:47 CEST 2008


Revision: 16615
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16615
Author:   ben2610
Date:     2008-09-19 22:41:38 +0200 (Fri, 19 Sep 2008)

Log Message:
-----------
BGE patch: new 'Advanced Settings' button to keep special Bullet options away from main UI.

Three features that were on the main UI interface are now 
moved to the Advanced Settings panel:
Margin, Actor (that becomes Sensor Actor) and No sleeping.

Sensor Actor is now a feature: it can be turned on and off
for all types of objects, and not just static objects.
Select the Sensor Actor button to make the object visible
to Near and Radar sensor.
The button is selected by default for dynamic objects
and unselected by default for static objects, to match
previous behavior.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_blender.h
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/src/buttons_logic.c
    trunk/blender/source/blender/src/drawobject.c
    trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp

Modified: trunk/blender/source/blender/blenkernel/BKE_blender.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_blender.h	2008-09-19 20:22:54 UTC (rev 16614)
+++ trunk/blender/source/blender/blenkernel/BKE_blender.h	2008-09-19 20:41:38 UTC (rev 16615)
@@ -41,7 +41,7 @@
 struct MemFile;
 
 #define BLENDER_VERSION			247
-#define BLENDER_SUBVERSION		2
+#define BLENDER_SUBVERSION		3
 
 #define BLENDER_MINVERSION		245
 #define BLENDER_MINSUBVERSION	15

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2008-09-19 20:22:54 UTC (rev 16614)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2008-09-19 20:41:38 UTC (rev 16615)
@@ -7799,6 +7799,15 @@
 		}
 	}
 
+	if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 3)){
+		Object *ob;
+		for(ob = main->object.first; ob; ob= ob->id.next) {
+			// Starting from subversion 3, ACTOR is a separate feature.
+			// Before it was conditioning all the other dynamic flags
+			if (!(ob->gameflag & OB_ACTOR))
+				ob->gameflag &= ~(OB_GHOST|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_COLLISION_RESPONSE);
+		}
+	}
 	/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
 	/* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */
 

Modified: trunk/blender/source/blender/src/buttons_logic.c
===================================================================
--- trunk/blender/source/blender/src/buttons_logic.c	2008-09-19 20:22:54 UTC (rev 16614)
+++ trunk/blender/source/blender/src/buttons_logic.c	2008-09-19 20:41:38 UTC (rev 16615)
@@ -2969,6 +2969,45 @@
 	}
 }
 
+static uiBlock *advanced_bullet_menu(void *arg_ob)
+{
+	uiBlock *block;
+	Object *ob = arg_ob;
+	short yco = 65, xco = 0;
+
+	block= uiNewBlock(&curarea->uiblocks, "advanced_bullet_options", UI_EMBOSS, UI_HELV, curarea->win);
+	/* use this for a fake extra empy space around the buttons */
+	uiDefBut(block, LABEL, 0, "", -5, -10, 255, 100, NULL, 0, 0, 0, 0, "");
+
+	uiDefButBitI(block, TOG, OB_ACTOR, 0, "Sensor actor",
+				xco, yco, 118, 19, &ob->gameflag, 0, 0, 0, 0,
+				"Objects that are detected by the Near and Radar sensor");
+
+	if (ob->gameflag & OB_DYNAMIC) {
+		uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, 0, "No sleeping", 
+					xco+=120, yco, 118, 19, &ob->gameflag, 0, 0, 0, 0, 
+					"Disable auto (de)activation");
+	}
+
+	yco -= 25;
+	xco = 0;
+	if (ob->gameflag & OB_DYNAMIC) {
+		if (ob->margin < 0.001f)
+			ob->margin = 0.06f;
+		uiDefButF(block, NUM, 0, "Margin", 
+				xco, yco, 118, 19, &ob->margin, 0.001, 1.0, 1, 0, 
+				"Collision margin");
+	} else {
+		uiDefButF(block, NUM, 0, "Margin", 
+				xco, yco, 118, 19, &ob->margin, 0.0, 1.0, 1, 0, 
+				"Collision margin");
+	}
+			
+	uiBlockSetDirection(block, UI_TOP);
+
+	return block;
+}
+
 void buttons_bullet(uiBlock *block, Object *ob)
 {
 	uiBut *but;
@@ -2976,7 +3015,7 @@
 	/* determine the body_type setting based on flags */
 	if (!(ob->gameflag & OB_COLLISION))
 		ob->body_type = OB_BODY_TYPE_NO_COLLISION;
-	else if (!(ob->gameflag & OB_DYNAMIC) || !(ob->gameflag & OB_DYNAMIC))
+	else if (!(ob->gameflag & OB_DYNAMIC))
 		ob->body_type = OB_BODY_TYPE_STATIC;
 	else if (!(ob->gameflag & (OB_RIGID_BODY|OB_SOFT_BODY)))
 		ob->body_type = OB_BODY_TYPE_DYNAMIC;
@@ -2985,61 +3024,51 @@
 	else
 		ob->body_type = OB_BODY_TYPE_SOFT;
 
-	uiBlockBeginAlign(block);
 	but = uiDefButS(block, MENU, REDRAWVIEW3D, 
 			"Object type%t|No collision%x0|Static%x1|Dynamic%x2|Rigid body%x3|Soft body%x4", 
-			10, 205, 150, 19, &ob->body_type, 0, 0, 0, 0, "Selects the type of physical representation of the object");
+			10, 205, 120, 19, &ob->body_type, 0, 0, 0, 0, "Selects the type of physical representation");
 	uiButSetFunc(but, check_body_type, but, ob);
 
 	if (ob->gameflag & OB_COLLISION) {
-		but = uiDefButBitI(block, TOG, OB_ACTOR, B_REDR, "Actor",
-				160,205,55,19, &ob->gameflag, 0, 0, 0, 0,
-				"Objects that are detected by the Near and Radar sensor");
-		uiButSetFunc(but, check_actor, but, &ob->gameflag);
-		
-		uiDefButBitI(block, TOG, OB_GHOST, B_REDR, "Ghost", 215,205,55,19, 
+
+		uiBlockSetCol(block, TH_BUT_SETTING1);
+		uiDefBlockBut(block, advanced_bullet_menu, ob, 
+					  "Advanced Settings", 
+					  200, 205, 150, 20, "Display collision advanced settings");
+		uiBlockSetCol(block, TH_BUT_SETTING2);
+
+		uiBlockBeginAlign(block);
+		uiDefButBitI(block, TOG, OB_GHOST, 0, "Ghost", 10, 182, 60, 19, 
 				&ob->gameflag, 0, 0, 0, 0, 
 				"Objects that don't restitute collisions (like a ghost)");
+		if ((ob->gameflag & OB_DYNAMIC) || ((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE))) {
+			uiDefButF(block, NUM, REDRAWVIEW3D, "Radius:", 70, 182, 140, 19, 
+					&ob->inertia, 0.01, 10.0, 10, 2, 
+					"Bounding sphere radius, not used for other bounding shapes");
+		}
 		if(ob->gameflag & OB_DYNAMIC) {
-			uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, B_REDR, "No sleeping", 270,205,80,19, 
-					&ob->gameflag, 0, 0, 0, 0, 
-					"Disable auto (de)activation");
-			uiDefButF(block, NUM, B_DIFF, "Mass:", 10, 185, 170, 19, 
+			uiDefButF(block, NUM, B_DIFF, "Mass:", 210, 182, 140, 19, 
 					&ob->mass, 0.01, 10000.0, 10, 2, 
 					"The mass of the Object");
-			uiDefButF(block, NUM, REDRAWVIEW3D, "Radius:", 180, 185, 170, 19, 
-					&ob->inertia, 0.01, 10.0, 10, 2, 
-					"Bounding sphere radius, not used for other bounding shapes");
 
-			uiDefButF(block, NUMSLI, B_DIFF, "Damp ", 10, 165, 150, 19, 
+			uiDefButF(block, NUMSLI, B_DIFF, "Damp ", 10, 162, 150, 19, 
 					&ob->damping, 0.0, 1.0, 10, 0, 
 					"General movement damping");
-			uiDefButF(block, NUMSLI, B_DIFF, "RotDamp ", 160, 165, 190, 19, 
+			uiDefButF(block, NUMSLI, B_DIFF, "RotDamp ", 160, 162, 190, 19, 
 					&ob->rdamping, 0.0, 1.0, 10, 0, 
 					"General rotation damping");
 		}
 		uiBlockEndAlign(block);
 
 		uiBlockBeginAlign(block);
-		if ((ob->gameflag & (OB_ACTOR|OB_DYNAMIC)) == (OB_ACTOR|OB_DYNAMIC)) {
-			if (ob->margin < 0.001f)
-				ob->margin = 0.06f;
-			uiDefButF(block, NUM, B_DIFF, "Margin", 10, 105, 105, 19, 
-					&ob->margin, 0.001, 1.0, 1, 0, 
-					"Collision margin");
-		} else {
-			uiDefButF(block, NUM, B_DIFF, "Margin", 10, 105, 105, 19, 
-					&ob->margin, 0.0, 1.0, 1, 0, 
-					"Collision margin");
-		}
-		uiDefButBitI(block, TOG, OB_BOUNDS, B_REDR, "Bounds", 115, 105, 55, 19,
-				&ob->gameflag, 0, 0,0, 0,
+		uiDefButBitI(block, TOG, OB_BOUNDS, B_REDR, "Bounds", 10, 105, 80, 19,
+				&ob->gameflag, 0, 0, 0, 0,
 				"Specify a bounds object for physics");
 		if (ob->gameflag & OB_BOUNDS) {
 			uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull%x5|Static Mesh%x4",
 			//almost ready to enable this one:			uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull Polytope%x5|Static TriangleMesh %x4|Dynamic Mesh %x5|",
-				170, 105, 105, 19, &ob->boundtype, 0, 0, 0, 0, "Selects the collision type");
-			uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 275,105,75,19, 
+				90, 105, 150, 19, &ob->boundtype, 0, 0, 0, 0, "Selects the collision type");
+			uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 240,105,110,19, 
 					&ob->gameflag, 0, 0, 0, 0, 
 					"Add Children");
 		}

Modified: trunk/blender/source/blender/src/drawobject.c
===================================================================
--- trunk/blender/source/blender/src/drawobject.c	2008-09-19 20:22:54 UTC (rev 16614)
+++ trunk/blender/source/blender/src/drawobject.c	2008-09-19 20:41:38 UTC (rev 16615)
@@ -5187,7 +5187,7 @@
 	}
 
 	if(dt<OB_SHADED) {
-		if((ob->gameflag & OB_ACTOR) && (ob->gameflag & OB_DYNAMIC)) {
+		if(/*(ob->gameflag & OB_ACTOR) &&*/ (ob->gameflag & OB_DYNAMIC)) {
 			float tmat[4][4], imat[4][4], vec[3];
 
 			vec[0]= vec[1]= vec[2]= 0.0;

Modified: trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp	2008-09-19 20:22:54 UTC (rev 16614)
+++ trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp	2008-09-19 20:41:38 UTC (rev 16615)
@@ -1315,19 +1315,12 @@
 	objprop.m_isCompoundChild = isCompoundChild;
 	objprop.m_hasCompoundChildren = (blenderobject->gameflag & OB_CHILD) != 0;
 	objprop.m_margin = blenderobject->margin;
-
-	if ((objprop.m_isactor = (blenderobject->gameflag & OB_ACTOR)!=0))
-	{
-		objprop.m_dyna = (blenderobject->gameflag & OB_DYNAMIC) != 0;
-		objprop.m_angular_rigidbody = (blenderobject->gameflag & OB_RIGID_BODY) != 0;
-		objprop.m_ghost = (blenderobject->gameflag & OB_GHOST) != 0;
-		objprop.m_disableSleeping = (blenderobject->gameflag & OB_COLLISION_RESPONSE) != 0;//abuse the OB_COLLISION_RESPONSE flag
-	} else {
-		objprop.m_dyna = false;
-		objprop.m_angular_rigidbody = false;
-		objprop.m_ghost = false;
-		objprop.m_disableSleeping = false;
-	}
+	// ACTOR is now a separate feature
+	objprop.m_isactor = (blenderobject->gameflag & OB_ACTOR)!=0;
+	objprop.m_dyna = (blenderobject->gameflag & OB_DYNAMIC) != 0;
+	objprop.m_angular_rigidbody = (blenderobject->gameflag & OB_RIGID_BODY) != 0;
+	objprop.m_ghost = (blenderobject->gameflag & OB_GHOST) != 0;
+	objprop.m_disableSleeping = (blenderobject->gameflag & OB_COLLISION_RESPONSE) != 0;//abuse the OB_COLLISION_RESPONSE flag
 	//mmm, for now, taks this for the size of the dynamicobject
 	// Blender uses inertia for radius of dynamic object
 	objprop.m_radius = blenderobject->inertia;





More information about the Bf-blender-cvs mailing list