Commit Graph

114 Commits

Author SHA1 Message Date
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
a5f4d7cb53 BGE PyAPI epydoc errors fixed 2009-04-24 07:45:17 +00:00
Dalai Felinto
7ac233be8a BGE Rasterizer methods to handle Screen Space - (getScreenPosition, getScreenVect, getScreenRay)
getScreenPosition(obj):
 - Gets the position of an object projected on screen space.

getScreenVect(x, y):
 - Gets the vector from the camera position in the screen coordinate direction.

getScreenRay(x, y, dist, property):
 - Look towards a screen coordinate (x,y) and find first object hit within dist that matches prop.
- The ray is a call to KX_GameObject->rayCastTo from the KX_Camera object.

Patch [#18589] test files can be found there. Patch reviewed by Campbell
2009-04-23 00:49:38 +00:00
Campbell Barton
dee32d0b3f BGE Python API
- initialize pythons sys.argv in the blenderplayer
- ignore all arguments after a single " - " in the blenderplayer (like in blender), so args can be passed to the game.
- add a utility function PyOrientationTo() - to take a Py euler, quat or 3x3 matrix and convert into a C++ MT_Matrix3x3.
- add utility function ConvertPythonToMesh to get a RAS_MeshObject from a KX_MeshProxy or a name.
- Added error prefix arguments to ConvertPythonToGameObject, ConvertPythonToMesh and PyOrientationTo so the error messages can include what function they came from.
- deprecated brick.getOwner() for the "owner" attribute.
2009-04-20 09:13:59 +00:00
Campbell Barton
9078ce5da2 Scons epydos changed options
- no source code since this is only useful if the epydocs contain code, ours are only docstrings.
- set inheritance to included so you dont have to search up the classes to find available functions.
- SConstruct, isolate the exception for importing epydoc.
- Added a print to the SConscript files otherwise it looks like nothings happening.
2009-04-19 22:02:48 +00:00
Nathan Letwory
fcdbbee208 SCons / epydoc support
* properly detect if epydoc is installed.
  patch by Brandano
2009-04-19 21:26:29 +00:00
Benoit Bolsee
bbdaa03d65 BGE bug #18168: Get local orientation of object using game engine python script system. Added localOrientation and worldOrientation. orientation attribute deprecated. Same for position and scaling. World attributes are read-only except for worldPosition. Add systematic check on NULL SGNode in all python functions. This is necessary to handle zombie objects (deleted by the game but kept alive by a reference in a list). 2009-04-15 21:17:08 +00:00
Campbell Barton
514c78ba39 BGE MouseFocusSensor
- fix for multiple viewpors broke single viewport (both work now)
- python could get uninitialized values from m_prevTargetPoint and m_prevSourcePoint
- getting the RayDirection for python could crash blender trying to normalize a zero length vector.
- added python attributes
- removed unused canvas from the MouseFocusSensor class
2009-04-15 13:50:56 +00:00
Campbell Barton
e8f4d93221 Disable using KX_GameObjects in python that have been removed from the scene (zombie objects) by raising a RuntimeError when accessing methods, attributes or passing to a function.
Common cases of this are when python references an object from the AddObject actuator that has ended, or a scene has been loaded and the old objects freed.

This means some scripts will raise errors now in certain cases but better give the error early rather then failing silently with strange hard to track down behavior & crashes.

Added "isValid" attribute for checking objects are in a scene.

At the moment it uses the SceneGraph Node to check of the objects valid but it might be better to do this in a more generic way so scenes, meshes etc also have this check.
2009-04-15 10:57:28 +00:00
Campbell Barton
3511f8ef9f BGE Physics
Clamp objects min/max velocity.
Accessed with bullet physics from the advanced button with dynamic and rigid body objects.
- useful for preventing unstable physics in cases where objects move too fast.
- can add linear velocity with the motion actuator to give smooth motion transitions, without moving too fast.
- minimum velocity means objects don't stop moving.
- python scripts can adjust these values speedup or throttle velocity in the existing direction.

Also made copy properties from an object with no properties work (in case you want to clear all props)
2009-04-14 12:34:39 +00:00
Benoit Bolsee
0b8661ab4d BGE: Occlusion culling and other performance improvements.
Added occlusion culling capability in the BGE. 
More info: http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.49/Game_Engine#BGE_Scenegraph_improvement
MSVC, scons, cmake, Makefile updated.

Other minor performance improvements:
- The rasterizer was computing the openGL model matrix of the objects too many times
- DBVT view frustrum culling was not properly culling behind the near plane:
  Large objects behind the camera were sent to the GPU
- Remove all references to mesh split/join feature as it is not yet functional
2009-04-13 20:08:33 +00:00
Guillermo S. Romero
6f12e584a9 SVN maintenance. 2009-04-13 19:33:22 +00:00
Campbell Barton
1b73d3ce05 mesh proxy attributes from andrecastelo 2009-04-13 03:43:16 +00:00
Campbell Barton
4cd088b105 BGE Py API
- setting the scene attributes would always add to the scenes custom dictionary.
- new CListValue method from_id(id)

so you can store a Game Objects id and use it to get the game object back.

 ob_id = id(gameOb)
 ...
 gameOb = scene.objects.from_id(ob_id)
 
This is useful because names are not always unique.
2009-04-11 20:58:09 +00:00
Benoit Bolsee
5031fe982e BGE API cleanup: ConstraintActuator. 2009-04-09 23:10:12 +00:00
Campbell Barton
ac45472a17 BGE Bugfix
The End key didn't work work at all for the keyboard sensor.
Removed getEventList() since it was added since 2.48a release.
2009-04-09 22:15:26 +00:00
Benoit Bolsee
b0cca7de26 BGE API cleanup: StateActuator. 2009-04-09 21:15:44 +00:00
Benoit Bolsee
09a5ffdf07 BGE API cleanup: sound actuator. 2009-04-09 20:40:12 +00:00
Campbell Barton
4669fa48a8 Added GameKeys.EventToCharacter(event, is_shift) so you can get the character that would be types when pressing a key.
Last commit was made in the pydocs folder only, so this includes changes mentioned in rev 19620.
2009-04-09 16:00:45 +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
5b0d75e831 BGE API cleanup: 2DFilterActuator. 2009-04-08 21:40:55 +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
Benoit Bolsee
370850146f BGE patch #18051: add localInertia attribute to GameObject. 2009-04-08 16:25:00 +00:00
Campbell Barton
bdfa61fbbe BGE api added place holder docs and CListValue docs. 2009-04-07 17:54:56 +00:00
Campbell Barton
1534eca60f Updated bge_api_validate_py.txt to check for undocumented attributes
All types methods and attributes are now documented (except for some types have no epydoc .py files for at all)
2009-04-07 11:45:48 +00:00
Campbell Barton
885fa49aa4 BGE Joystick Sensor
- Raised limit of 2 axis to 4 axis pairs (4==8 joysticks axis pairs)
- Added a new Joystick Sensor type "Single Axis", so you can detect horizontal or vertical movement, rather then just Up/Down/Left/Right
- added Python attribute "axisSingle" so you can get the value from the selected axis (rather then getting it out of the axis list)
- renamed Py attribute "axisPosition" to "axisValues" (was never in a release)

If we need to increase the axis limit again just change JOYAXIS_MAX and the button limits.
2009-04-07 06:23:45 +00:00
Campbell Barton
46a440c7a5 BGE Python API
- added a module for the BGE - GameTypes, only contains types.
- added KX_PYATTRIBUTE_DUMMY attributes for KX_Light, KX_PolyProxy, KX_VertexProxy, so all types should give correct results from a dir().
- added a script to check for missing methods in the epydocs - bge_api_validate_py.txt
2009-04-06 13:27:28 +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
Campbell Barton
033a63f858 BGE Bugfixes (mostly in the py api)
KX_PolygonMaterial and KX_BlenderMaterial - Added a print function (would raise a python error on printing)

* Crashes *
KX_GameObject SetParent - Disallowed setting a parent to its self, caused a recursion crash.
KX_MeshProxy "materials" attribute was segfaulting because of my recent change - I was wrong, you do need to check material types (no idea why since they are both PyObject * at the base)
KX_VisibilityActuator - Wasn't initialized with PyType_Ready() making it crash on access (own fault) 

* Crashes because of missing NULL checks *
KX_PolygonMaterial's "gl_texture" attribute wasnt checking for a valid m_tface
KX_GameObject - added checks for GetPhysicsController()
KX_RayCast::RayTest - didnt check for a valid physics_environment
KX_SceneActuator's getCamera python function wasnt checking if there was a camera.
2009-04-05 14:01:49 +00:00
Campbell Barton
7d4dc4f0f5 - fixed errors with bge epydocs
- changed epy_docgen.sh so inherited attributes & methods are included inline for each type, removed source option since its not useful and makes the download bigger.
2009-04-05 10:03:23 +00:00
Campbell Barton
f8cc272575 added experimental KX_GameObject attributes "sensors", "controllers" and "actuators" 2009-04-05 08:48:51 +00:00
Campbell Barton
04ef5a492a Made KX_MeshProxy use PyAttributeDef. simplified getting the 'materials' attribute (no need to differentiate between types)
Added KX_GameObject 'meshes' attribute to replace getMesh(i)
2009-04-04 15:54:07 +00:00
Benoit Bolsee
48e4a48340 BGE API cleanup: ReplaceMeshActuator mesh attributes now returns a KX_MeshProxy. Fix a bug in KX_MeshProxy where the Python type was not set right. 2009-04-01 08:59:36 +00:00
Guillermo S. Romero
441f26a170 Clean up for the imminent migration from SVN to GIT. 2009-03-31 22:34:34 +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
d57811ada1 BGE API cleanup: CDActuator, ParentActuator, VisibilityActuator done. Thanks to Andre. 2009-03-29 15:17:55 +00:00
Benoit Bolsee
afec404962 BGE API Cleanup: GameActuator (patch from Andre) 2009-03-27 22:11:30 +00:00
Benoit Bolsee
059c2a10c4 BGE API cleanup: AddObject, DeleteObject and Scene actuator added. 2009-03-27 21:54:16 +00:00
Campbell Barton
bba2bdf41e Added attributes for Ipo Actuator settings (replacing all methods) 2009-03-26 01:42:01 +00:00
Campbell Barton
c78b460fce Use Benoits attributes in KX_GameObject.
Deprecated..
getPosition, setPosition, getOrientation, setOrientation, getState, setState, getParent, getVisible, getMass

* swapped set/get to get/set in KX_PYATTRIBUTE_RW_FUNCTION macro to match pythons getsetattrs.
* deprecation warnings in the api and notes in epydocs.
* added 'state' attribute
* gameob.mass = 10 # now works because its not checking only for float values.
* dir(gameob) # includes attributes now
2009-03-24 19:37:17 +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
6bfb8ca6b0 - Attributes for the collision sensor: propertyName, materialCheck, pulseCollisions, objectHit and objectHitList.
Removed a check in Python API touch.setProperty() for the property name on the sensor owner before allowing the name to be set - it makes no sense and isnt checked when creating the sensor.
- SCA_DelaySensor.py indent error making epydoc fail.
2009-02-26 04:17:23 +00:00
Campbell Barton
adaa4b0fd0 Making KX_GameObject names read only.
This was committed in revision 2832 but never accounted for existing object name hashes which existed since revision 2.

Its possible to update the names elsewhere but unlikely anyone ever used this successfully so removing.
2009-02-24 12:38:56 +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
c597863783 "object" and "objectLastCreated" attribute for actuators, deprecates getObject/setObject() & getLastCreatedObject()
also removed some warnings
2009-02-19 10:34:51 +00:00
Benoit Bolsee
59e96a2831 BGE Py API cleanup: Camera Actuator. 2009-02-07 20:35:16 +00:00
Benoit Bolsee
8a95c67a50 BGE API cleanup: shape action actuator. 2009-01-22 17:40:47 +00:00
Benoit Bolsee
8bd7aa0a01 BGE API cleanup: action actuator. 2009-01-21 13:54:53 +00:00
Benoit Bolsee
1c663bbc7e First batch of GE API cleanup.
The principle is to replace most get/set methods of logic bricks by direct property access. 
To make porting of game code easier, the properties have usually the same type and use than
the return values/parameters of the get/set methods. 
More details on http://wiki.blender.org/index.php/GameEngineDev/Python_API_Clean_Up

Old methods are still available but will produce deprecation warnings on the console: 

"<method> is deprecated, use the <property> property instead"

You can avoid these messages by turning on the "Ignore deprecation warnings" option in Game menu.

PyDoc is updated to include the new properties and display a deprecation warning
for the get/set methods that are being deprecated.
2008-12-29 16:36:58 +00:00