Commit Graph

26 Commits

Author SHA1 Message Date
Campbell Barton
c1e1091f02 moved py controller functions from SCA_PythonController to SCA_IController - the base controller class so python can get the sensors & actuators from any controller (not just SCA_PythonController types)
also deprecated getActuators() and getSensors() for 'sensors' and 'actuators' attributes.

an example of getting every sensor connected to an object.
 all_sensors = [s for c in ob.controllers for s in c.sensors]
2009-05-06 09:12:08 +00:00
Campbell Barton
ef20036b84 BGE Py API patch from Mitchell Stokes, adds extra attributes and docs 2009-05-02 02:40:11 +00:00
Benoit Bolsee
672492f563 BGE: New function GameLogic.setMaxLogicFrame() to allow better control over the time spent on logic.
This function sets the maximum number of logic frame executed per render frame.
Valid values: 1..5

This function is useful to control the amount of processing consumed by logic.
By default, up to 5 logic frames can be executed per render frame. This is fine
as long as the time spent on logic is negligible compared to the render time. 
If it's not the case, the default value will drag the performance of the game
down by executing unnecessary logic frames that take up most of the CPU time. 

You can avoid that by lowering the value with this function. 
The drawback is less precision in the logic system to physics and I/O activity.
	
Note that it does not affect the physics system: physics will still run 
at full frame rate (actually up to 5 times the ticrate).
You can further control the render frame rate with GameLogic.setLogicTicRate().
2009-05-01 16:35:06 +00:00
Campbell Barton
0c482f7607 BGE API - small changes
- print CListValue errors only once.
- bge_api_validate_py.txt now validates modules as well as types.
- added missing functions and consts for epydoc modules. some of these in GameLogic.py still need sorting.
2009-04-24 20:27:04 +00:00
Campbell Barton
e14e66f041 BGE Py API
- added keyboard senser attribute "events" to replace getEventList()
- fix 2 memory leaks in the python api (was making a list but not returning it)
- setting readonly attributes didnt give a good error message.
2009-04-09 12:53:56 +00:00
Benoit Bolsee
db33320df7 BGE patch #18350: Add sendMessage() to GameLogic. Added sendMessage to both GameLogic and KX_GameObject. 2009-04-08 16:57:08 +00:00
Campbell Barton
960fa534b7 BGE Epydocs were missing some functions
renamed KX_Light -> KX_LightObject
added some missing controllers
2009-04-06 13:13:25 +00:00
Benoit Bolsee
f6f47a08eb BGE API cleanup: DynamicActuator, ReplaceMeshActuator, TrackToActuator. 2009-03-31 21:03:15 +00:00
Benoit Bolsee
8518f6e660 BGE API cleanup, patch from Moguri: RaySensor, NetworkMessageActuator, NetworkMessageSensor. 2009-03-31 19:02:01 +00:00
Benoit Bolsee
6c409ed541 BGE API cleanup: apply patch from Moguri: Near, Radar, Touch sensor updated. 2009-02-28 21:00:27 +00:00
Campbell Barton
6c7c38a4e4 BGE Py API
* Made GameLogic.addActiveActuator(actu, bool) to raise an error if the actuator is not in the list. Before it would allow any value as the actuator and fail silently (makes debugging scripts more difficult).

* Allow the actuator to be a string which is convenient if you dont want to change the settings of the actuator.
* Added activate/deactivate functions to the controller, this is more logical since the GameLogic.addActiveActuator() function is running through the controller anyway.

GameLogic.addActiveActuator(controller.getActuator("SomeAct"), True)
...can be replaced with...
controller.activate("SomeAct")
2009-02-24 05:50:45 +00:00
Campbell Barton
03d5780b76 Added joystick epydocs, only changed incorrect docstrings in SCA_JoystickSensor.cpp
patch [#17857] HotKeys Update by dfelinto - SmoothStroke and Anchored.
	Made own edits, removed videoscape and added curve and armature specials.
2008-10-18 13:23:30 +00:00
Brecht Van Lommel
cb89decfdc Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:

* GLSL support in the viewport and game engine, enable in the game
  menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
  gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
  storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.

* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
  An extra texture slot shows up once the last slot is used.

* Memory limit for undo, not enabled by default yet because it
  needs the .B.blend to be changed.
* Multiple undo for image painting.

* An offset for dupligroups, so not all objects in a group have to
  be at the origin.
2008-09-04 20:51:28 +00:00
Campbell Barton
9b29810912 BGE Python API - GameLogic.getBlendFileList(path='//') to return a list of blend's in the current directory. Needed for creating a level selector that lists all files in the level directory.
CMakeFile include path to compile with recent changes.
2008-08-22 06:02:01 +00:00
Benoit Bolsee
fda00bc034 BGE patch: New Delay sensor (derived from patch #17472)
Introduction of a new Delay sensor that can be used to 
generate positive and negative triggers at precise time,
expressed in number of frames. 
The delay parameter defines the length of the initial 
OFF period. A positive trigger is generated at the end
of this period. The duration parameter defines the 
length of the ON period following the OFF period.
A negative trigger is generated at the end of the ON period. 
If duration is 0, the sensor stays ON and there is no 
negative trigger. 
The sensor runs the OFF-ON cycle once unless the repeat 
option is set: the OFF-ON cycle repeats indefinately 
(or the OFF cycle if duration is 0).

The new generic SCA_ISensor::reset() Python function
can be used at any time to restart the sensor: the
current cycle is interrupted and no trigger is generated.
2008-08-16 20:45:37 +00:00
Benoit Bolsee
96486b356f fix BGE bug #8668: Behavior of os.getcwd() is not consistent between operating systems
Add a function GameLogic.expandPath() that works like Blender.sys.expandpath() and is also available in the BlenderPlayer.
Fix the game actuator in the BlenderPlayer to work like in Blender: 
- try first to load the .blend from the current working directory
- if not found, try to load from the startup .blend or runtime base directory
2008-05-11 18:45:30 +00:00
Kester Maddock
183ee861e8 PyDoc updates 2004-12-29 01:39:34 +00:00
Kester Maddock
7b2567924b Switch fixed time system. Logic updates should now happen at 30Hz, physics at 60Hz. (By default, use Python to set.) Some actuators still run at framerate (IPO, Action) for nice smooth animation, and an excuse to buy high end hardware.
Keyboard sensors can now hook escape key.  Ctrl-Break can be used from within blender if you've forgotten an end game actuator.

Fixed a stupid bug preventing some actuators working (like TrackTo).
2004-10-16 11:41:50 +00:00
Stefan Gartner
ea8c97b44b fix typo in GameLogic documentation 2004-09-01 13:19:42 +00:00
Kester Maddock
baa2f99f07 Port Python updates from Tuhopuu2:
getType/setType to action/sound actuator (sgefant)
Use a more generic python -> math conversion.
2004-07-17 05:28:23 +00:00
Kester Maddock
4c53f38756 Minor Fixes:
Better use of booleans for python
#include fixes for Windows
Python Doc fixes
Use the farthest vertex as the face position when z sorting faces. (Camera is on -z axis!)
2004-06-26 09:15:41 +00:00
Kester Maddock
c16444e624 Python updates:
Added scene module
2004-06-07 11:03:12 +00:00
Kester Maddock
976e3a1824 Updates to GamePython Reference.
Added Actuator documentation.
2004-06-02 12:43:27 +00:00
Kester Maddock
0dfc3a3b78 Use epydoc for generating game python reference (like the bpython guys) 2004-05-31 13:06:04 +00:00
Kester Maddock
d38329b5aa Added Python module for Lights.
Added attributes to the vertex class.
2004-05-30 11:09:46 +00:00
Kester Maddock
a96955efc2 Game Python Reference Manual.
This manual lists all the Python classes and modules for Game Objects, Sensor bricks, Controllers etc.
Missing: Actuator & Controller reference.
2004-05-24 07:49:50 +00:00