[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32423] trunk/blender/release/scripts/ templates: update for gamelogic templates
Campbell Barton
ideasman42 at gmail.com
Tue Oct 12 00:25:29 CEST 2010
Revision: 32423
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32423
Author: campbellbarton
Date: 2010-10-12 00:25:28 +0200 (Tue, 12 Oct 2010)
Log Message:
-----------
update for gamelogic templates
Modified Paths:
--------------
trunk/blender/release/scripts/templates/gamelogic.py
trunk/blender/release/scripts/templates/gamelogic_basic.py
trunk/blender/release/scripts/templates/gamelogic_module.py
Modified: trunk/blender/release/scripts/templates/gamelogic.py
===================================================================
--- trunk/blender/release/scripts/templates/gamelogic.py 2010-10-11 22:05:45 UTC (rev 32422)
+++ trunk/blender/release/scripts/templates/gamelogic.py 2010-10-11 22:25:28 UTC (rev 32423)
@@ -1,11 +1,8 @@
# This script must be assigned to a python controller
# where it can access the object that owns it and the sensors/actuators that it connects to.
-# GameLogic has been added to the global namespace no need to import
+import bge
-# for keyboard event comparison
-# import GameKeys
-
# support for Vector(), Matrix() types and advanced functions like Matrix.Scale(...) and Matrix.Rotation(...)
# import mathutils
@@ -13,7 +10,7 @@
# import Rasterizer
def main():
- cont = GameLogic.getCurrentController()
+ cont = bge.logic.getCurrentController()
# The KX_GameObject that owns this controller.
own = cont.owner
@@ -57,7 +54,7 @@
# Loop through all other objects in the scene
- sce = GameLogic.getCurrentScene()
+ sce = bge.logic.getCurrentScene()
print('Scene Objects:', sce.name)
for ob in sce.objects:
print(' ', ob.name, ob.worldPosition)
Modified: trunk/blender/release/scripts/templates/gamelogic_basic.py
===================================================================
--- trunk/blender/release/scripts/templates/gamelogic_basic.py 2010-10-11 22:05:45 UTC (rev 32422)
+++ trunk/blender/release/scripts/templates/gamelogic_basic.py 2010-10-11 22:25:28 UTC (rev 32423)
@@ -1,7 +1,8 @@
+import bge
def main():
- cont = GameLogic.getCurrentController()
+ cont = bge.logic.getCurrentController()
own = cont.owner
sens = cont.sensors['mySensor']
Modified: trunk/blender/release/scripts/templates/gamelogic_module.py
===================================================================
--- trunk/blender/release/scripts/templates/gamelogic_module.py 2010-10-11 22:05:45 UTC (rev 32422)
+++ trunk/blender/release/scripts/templates/gamelogic_module.py 2010-10-11 22:25:28 UTC (rev 32423)
@@ -5,7 +5,7 @@
# * External text modules are supported as long as they are at
# the same location as the blendfile or one of its libraries.
-import GameLogic
+import bge
# variables defined here will only be set once when the
# module is first imported. Set object spesific vars
@@ -23,4 +23,4 @@
else:
cont.deactivate(actu)
-# dont call main(GameLogic.getCurrentController()), the py controller will
+# dont call main(bge.logic.getCurrentController()), the py controller will
More information about the Bf-blender-cvs
mailing list