[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20618] trunk/blender: BGE small fixes

Campbell Barton ideasman42 at gmail.com
Thu Jun 4 09:42:04 CEST 2009


Revision: 20618
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20618
Author:   campbellbarton
Date:     2009-06-04 09:42:03 +0200 (Thu, 04 Jun 2009)

Log Message:
-----------
BGE small fixes
- script template use new property syntax
- Python could set the axis/hat to a negative index and crash blender (nobody complained)
- Servo control UI had overlapping text

Modified Paths:
--------------
    trunk/blender/release/scripts/scripttemplate_gamelogic.py
    trunk/blender/source/blender/src/buttons_logic.c
    trunk/blender/source/gameengine/GameLogic/SCA_JoystickSensor.cpp

Modified: trunk/blender/release/scripts/scripttemplate_gamelogic.py
===================================================================
--- trunk/blender/release/scripts/scripttemplate_gamelogic.py	2009-06-03 23:56:04 UTC (rev 20617)
+++ trunk/blender/release/scripts/scripttemplate_gamelogic.py	2009-06-04 07:42:03 UTC (rev 20618)
@@ -1,7 +1,7 @@
 #!BPY
 """
 Name: 'GameLogic Example'
-Blender: 245
+Blender: 249
 Group: 'ScriptTemplate'
 Tooltip: 'Script template with examples of how to use game logic'
 """
@@ -82,10 +82,10 @@
 	actu_collide = cont.sensors['collision_sens']
 	for ob in actu_collide.objectHitList:
 		# Check to see the object has this property
-		if hasattr(ob, 'life'):
-			own.life += ob.life
-			ob.life = 0
-	print own.life
+		if ob.has_key('life'):
+			own['life'] += ob['life']
+			ob['life'] = 0
+	print own['life']
 	"""
 
 main()

Modified: trunk/blender/source/blender/src/buttons_logic.c
===================================================================
--- trunk/blender/source/blender/src/buttons_logic.c	2009-06-03 23:56:04 UTC (rev 20617)
+++ trunk/blender/source/blender/src/buttons_logic.c	2009-06-04 07:42:03 UTC (rev 20618)
@@ -1864,7 +1864,7 @@
 				}
 				uiDefBut(block, LABEL, 0, "Servo",	xco, yco-152, 45, 19, NULL, 0, 0, 0, 0, "Coefficients of the PID servo controller");
 				uiDefButF(block, NUMSLI, B_REDR, "P: ",		xco+45, yco-152, wval*3, 19, oa->forcerot, 0.00, 200.0, 100, 0, "Proportional coefficient, typical value is 60x Integral coefficient");
-				uiDefBut(block, LABEL, 0, "Slow",	xco, yco-152, 45, 19, NULL, 0, 0, 0, 0, "Low value of I coefficient correspond to slow response");
+				uiDefBut(block, LABEL, 0, "Slow",	xco, yco-171, 45, 19, NULL, 0, 0, 0, 0, "Low value of I coefficient correspond to slow response");
 				but = uiDefButF(block, NUMSLI, B_REDR, " I : ",		xco+45, yco-171, wval*3, 19, oa->forcerot+1, 0.0, 3.0, 1, 0, "Integral coefficient, low value (0.01) for slow response, high value (0.5) for fast response");
 				uiButSetFunc(but, update_object_actuator_PID, oa, NULL);
 				uiDefBut(block, LABEL, 0, "Fast",	xco+45+3*wval, yco-171, 45, 19, NULL, 0, 0, 0, 0, "High value of I coefficient correspond to fast response");

Modified: trunk/blender/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
===================================================================
--- trunk/blender/source/gameengine/GameLogic/SCA_JoystickSensor.cpp	2009-06-03 23:56:04 UTC (rev 20617)
+++ trunk/blender/source/gameengine/GameLogic/SCA_JoystickSensor.cpp	2009-06-04 07:42:03 UTC (rev 20618)
@@ -392,6 +392,8 @@
 	}
 	m_axis = axis;
 	m_axisf = axisflag;
+	
+	CheckAxis((void *)this, NULL); /* clamp values */
 	Py_RETURN_NONE;
 }
 
@@ -533,6 +535,8 @@
 	}
 	m_hat = hat;
 	m_hatf = hatflag;
+	
+	CheckHat((void *)this, NULL); /* clamp values */
 	Py_RETURN_NONE;
 }
 





More information about the Bf-blender-cvs mailing list