diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-11-13 00:16:53 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-11-13 00:16:53 +0300 |
commit | bdfe7d89e2f1292644577972c716931b4ce3c6c3 (patch) | |
tree | d00eb50b749cb001e2b08272c91791e66740b05d /source/gameengine/PyDoc/GameLogic.py | |
parent | 78a1c27c4a6abe0ed31ca93ad21910f3df04da56 (diff) | |
parent | 7e4db234cee71ead34ee81a12e27da4bd548eb4b (diff) |
Merge of trunk into blender 2.5:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r12987:17416
Issues:
* GHOST/X11 had conflicting changes. Some code was added in 2.5, which was
later added in trunk also, but reverted partially, specifically revision
16683. I have left out this reversion in the 2.5 branch since I think it is
needed there.
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16683
* Scons had various conflicting changes, I decided to go with trunk version
for everything except priorities and some library renaming.
* In creator.c, there were various fixes and fixes for fixes related to the -w
-W and -p options. In 2.5 -w and -W is not coded yet, and -p is done
differently. Since this is changed so much, and I don't think those fixes
would be needed in 2.5, I've left them out.
* Also in creator.c: there was code for a python bugfix where the screen was not
initialized when running with -P. The code that initializes the screen there
I had to disable, that can't work in 2.5 anymore but left it commented as a
reminder.
Further I had to disable some new function calls. using src/ and python/, as
was done already in this branch, disabled function calls:
* bpath.c: error reporting
* BME_conversions.c: editmesh conversion functions.
* SHD_dynamic: disabled almost completely, there is no python/.
* KX_PythonInit.cpp and Ketsji/ build files: Mathutils is not there, disabled.
* text.c: clipboard copy call.
* object.c: OB_SUPPORT_MATERIAL.
* DerivedMesh.c and subsurf_ccg, stipple_quarttone.
Still to be done:
* Go over files and functions that were moved to a different location but could
still use changes that were done in trunk.
Diffstat (limited to 'source/gameengine/PyDoc/GameLogic.py')
-rw-r--r-- | source/gameengine/PyDoc/GameLogic.py | 95 |
1 files changed, 64 insertions, 31 deletions
diff --git a/source/gameengine/PyDoc/GameLogic.py b/source/gameengine/PyDoc/GameLogic.py index fcfd8bfc4eb..9dab7db6081 100644 --- a/source/gameengine/PyDoc/GameLogic.py +++ b/source/gameengine/PyDoc/GameLogic.py @@ -13,11 +13,10 @@ Documentation for the GameLogic Module. See L{WhatsNew} for updates, changes and new functionality in the Game Engine Python API. Examples:: - # To get a controller: - import GameLogic - co = GameLogic.getCurrentController() + # To get the controller thats running this python script: + co = GameLogic.getCurrentController() # GameLogic is automatically imported - # To get the game object associated with this controller: + # To get the game object this controller is on: obj = co.getOwner() L{KX_GameObject} and L{KX_Camera} or L{KX_Light} methods are available depending on the type of object:: @@ -32,16 +31,18 @@ Documentation for the GameLogic Module. sensors = co.getSensors() See the sensor's reference for available methods: - - L{KX_NetworkMessageSensor} - - L{KX_RaySensor} - - L{KX_MouseFocusSensor} - - L{KX_NearSensor} - - L{KX_RadarSensor} - - L{KX_TouchSensor} - - L{SCA_KeyboardSensor} - - L{SCA_MouseSensor} - - L{SCA_PropertySensor} - - L{SCA_RandomSensor} + - L{DelaySensor<SCA_DelaySensor.SCA_DelaySensor>} + - L{JoystickSensor<SCA_JoystickSensor.SCA_JoystickSensor>} + - L{KeyboardSensor<SCA_KeyboardSensor.SCA_KeyboardSensor>} + - L{MouseFocusSensor<KX_MouseFocusSensor.KX_MouseFocusSensor>} + - L{MouseSensor<SCA_MouseSensor.SCA_MouseSensor>} + - L{NearSensor<KX_NearSensor.KX_NearSensor>} + - L{NetworkMessageSensor<KX_NetworkMessageSensor.KX_NetworkMessageSensor>} + - L{PropertySensor<SCA_PropertySensor.SCA_PropertySensor>} + - L{RadarSensor<KX_RadarSensor.KX_RadarSensor>} + - L{RandomSensor<SCA_RandomSensor.SCA_RandomSensor>} + - L{RaySensor<KX_RaySensor.KX_RaySensor>} + - L{TouchSensor<KX_TouchSensor.KX_TouchSensor>} You can also access actuators linked to the controller:: # To get an actuator attached to the controller: @@ -54,23 +55,23 @@ Documentation for the GameLogic Module. GameLogic.addActiveActuator(actuator, True) See the actuator's reference for available methods: - - L{BL_ActionActuator} - - L{KX_CameraActuator} - - L{KX_CDActuator} - - L{KX_ConstraintActuator} - - L{KX_GameActuator} - - L{KX_IpoActuator} - - L{KX_NetworkMessageActuator} - - L{KX_ObjectActuator} - - L{KX_SCA_AddObjectActuator} - - L{KX_SCA_EndObjectActuator} - - L{KX_SCA_ReplaceMeshActuator} - - L{KX_SceneActuator} - - L{KX_SoundActuator} - - L{KX_TrackToActuator} - - L{KX_VisibilityActuator} - - L{SCA_PropertyActuator} - - L{SCA_RandomActuator} + - L{ActionActuator<BL_ActionActuator.BL_ActionActuator>} + - L{AddObjectActuator<KX_SCA_AddObjectActuator.KX_SCA_AddObjectActuator>} + - L{CameraActuator<KX_CameraActuator.KX_CameraActuator>} + - L{CDActuator<KX_CDActuator.KX_CDActuator>} + - L{ConstraintActuator<KX_ConstraintActuator.KX_ConstraintActuator>} + - L{EndObjectActuator<KX_SCA_EndObjectActuator.KX_SCA_EndObjectActuator>} + - L{GameActuator<KX_GameActuator.KX_GameActuator>} + - L{IpoActuator<KX_IpoActuator.KX_IpoActuator>} + - L{NetworkMessageActuator<KX_NetworkMessageActuator.KX_NetworkMessageActuator>} + - L{ObjectActuator<KX_ObjectActuator.KX_ObjectActuator>} + - L{PropertyActuator<SCA_PropertyActuator.SCA_PropertyActuator>} + - L{RandomActuator<SCA_RandomActuator.SCA_RandomActuator>} + - L{ReplaceMeshActuator<KX_SCA_ReplaceMeshActuator.KX_SCA_ReplaceMeshActuator>} + - L{SceneActuator<KX_SceneActuator.KX_SceneActuator>} + - L{SoundActuator<KX_SoundActuator.KX_SoundActuator>} + - L{TrackToActuator<KX_TrackToActuator.KX_TrackToActuator>} + - L{VisibilityActuator<KX_VisibilityActuator.KX_VisibilityActuator>} Most logic brick's methods are accessors for the properties available in the logic buttons. Consult the logic bricks documentation for more information on how each logic brick works. @@ -220,4 +221,36 @@ def setPhysicsTicRate(ticrate): @param ticrate: The new update frequency (in Hz). @type ticrate: float """ +def getAverageFrameRate(): + """ + Gets the estimated average framerate + + @return: The estimed average framerate in frames per second + @rtype: float + """ + +def expandPath(path): + """ + Converts a blender internal path into a proper file system path. + Use / as directory separator in path + You can use '//' at the start of the string to define a relative path; + Blender replaces that string by the directory of the startup .blend or runtime file + to make a full path name (doesn't change during the game, even if you load other .blend). + The function also converts the directory separator to the local file system format. + + @param path: The path string to be converted/expanded. + @type path: string + @return: The converted string + @rtype: string + """ + +def getBlendFileList(path = "//"): + """ + Returns a list of blend files in the same directory as the open blend file, or from using the option argument. + + @param path: Optional directory argument, will be expanded (like expandPath) into the full path. + @type path: string + @return: A list of filenames, with no directory prefix + @rtype: list + """ |