From e14e66f041104c87033ec0b58596fb49c591908c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 9 Apr 2009 12:53:56 +0000 Subject: 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. --- source/gameengine/PyDoc/GameLogic.py | 8 +++---- source/gameengine/PyDoc/SCA_2DFilterActuator.py | 2 +- source/gameengine/PyDoc/SCA_KeyboardSensor.py | 32 +++++++++++++++++-------- 3 files changed, 27 insertions(+), 15 deletions(-) (limited to 'source/gameengine') diff --git a/source/gameengine/PyDoc/GameLogic.py b/source/gameengine/PyDoc/GameLogic.py index 29d1b64350a..1996aa3f8a9 100644 --- a/source/gameengine/PyDoc/GameLogic.py +++ b/source/gameengine/PyDoc/GameLogic.py @@ -205,9 +205,9 @@ def addActiveActuator(actuator, activate): @type activate: boolean @param activate: whether to activate or deactivate the given actuator. """ -def sendMessage(subject, body="", to="", from=""): +def sendMessage(subject, body="", to="", message_from=""): """ - Sends a message. + Sends a message to sensors in any active scene. @param subject: The subject of the message @type subject: string @@ -215,8 +215,8 @@ def sendMessage(subject, body="", to="", from=""): @type body: string @param to: The name of the object to send the message to (optional) @type to: string - @param from: The name of the object that the message is coming from (optional) - @type from: string + @param message_from: The name of the object that the message is coming from (optional) + @type message_from: string """ def getRandomFloat(): """ diff --git a/source/gameengine/PyDoc/SCA_2DFilterActuator.py b/source/gameengine/PyDoc/SCA_2DFilterActuator.py index 12baed6fa0c..9a010e8f221 100644 --- a/source/gameengine/PyDoc/SCA_2DFilterActuator.py +++ b/source/gameengine/PyDoc/SCA_2DFilterActuator.py @@ -20,7 +20,7 @@ class SCA_2DFilterActuator(SCA_IActuator): @ivar disableMotionBlur: action on motion blur: 0=enable, 1=disable @type disableMotionBlur: integer @ivar type: type of 2D filter, use one of the following constants: - RAS_2DFILTER_ENABLED (-2) : enable the filter that was previously disabled + RAS_2DFILTER_ENABLED (-2) : enable the filter that was previously disabled RAS_2DFILTER_DISABLED (-1) : disable the filter that is currently active RAS_2DFILTER_NOFILTER (0) : disable and destroy the filter that is currently active RAS_2DFILTER_MOTIONBLUR (1) : create and enable preset filters diff --git a/source/gameengine/PyDoc/SCA_KeyboardSensor.py b/source/gameengine/PyDoc/SCA_KeyboardSensor.py index f6a7a7d8a97..93a09acafcf 100644 --- a/source/gameengine/PyDoc/SCA_KeyboardSensor.py +++ b/source/gameengine/PyDoc/SCA_KeyboardSensor.py @@ -20,11 +20,23 @@ class SCA_KeyboardSensor(SCA_ISensor): @type targetProperty: string @ivar useAllKeys: Flag to determine whether or not to accept all keys. @type useAllKeys: boolean + @ivar events: a list of pressed keys that have either been pressed, or just released, or are active this frame. (read only). + + - 'keycode' matches the values in L{GameKeys}. + - 'status' uses... + - L{GameLogic.KX_INPUT_NONE} + - L{GameLogic.KX_INPUT_JUST_ACTIVATED} + - L{GameLogic.KX_INPUT_ACTIVE} + - L{GameLogic.KX_INPUT_JUST_RELEASED} + + @type events: list [[keycode, status], ...] """ def getEventList(): """ Get a list of pressed keys that have either been pressed, or just released, or are active this frame. + B{DEPRECATED: Use the "events" property instead}. + @rtype: list of key status. [[keycode, status]] @return: A list of keyboard events """ @@ -33,18 +45,18 @@ class SCA_KeyboardSensor(SCA_ISensor): """ Get the status of a key. - @rtype: key state (KX_NO_INPUTSTATUS, KX_JUSTACTIVATED, KX_ACTIVE or KX_JUSTRELEASED) + @rtype: key state L{GameLogic} members (KX_INPUT_NONE, KX_INPUT_JUST_ACTIVATED, KX_INPUT_ACTIVE, KX_INPUT_JUST_RELEASED) @return: The state of the given key @type keycode: integer @param keycode: The code that represents the key you want to get the state of """ - #--The following methods are deprecated-- + #--The following methods are DEPRECATED-- def getKey(): """ Returns the key code this sensor is looking for. - Deprecated: Use the "key" property instead. + B{DEPRECATED: Use the "key" property instead}. @rtype: keycode from L{GameKeys} module """ @@ -53,7 +65,7 @@ class SCA_KeyboardSensor(SCA_ISensor): """ Set the key this sensor should listen for. - Deprecated: Use the "key" property instead. + B{DEPRECATED: Use the "key" property instead}. @type keycode: keycode from L{GameKeys} module """ @@ -62,7 +74,7 @@ class SCA_KeyboardSensor(SCA_ISensor): """ Returns the key code for the first modifier this sensor is looking for. - Deprecated: Use the "hold1" property instead. + B{DEPRECATED: Use the "hold1" property instead}. @rtype: keycode from L{GameKeys} module """ @@ -71,7 +83,7 @@ class SCA_KeyboardSensor(SCA_ISensor): """ Sets the key code for the first modifier this sensor should look for. - Deprecated: Use the "hold1" property instead. + B{DEPRECATED: Use the "hold1" property instead}. @type keycode: keycode from L{GameKeys} module """ @@ -80,7 +92,7 @@ class SCA_KeyboardSensor(SCA_ISensor): """ Returns the key code for the second modifier this sensor is looking for. - Deprecated: Use the "hold2" property instead. + B{DEPRECATED: Use the "hold2" property instead}. @rtype: keycode from L{GameKeys} module """ @@ -89,7 +101,7 @@ class SCA_KeyboardSensor(SCA_ISensor): """ Sets the key code for the second modifier this sensor should look for. - Deprecated: Use the "hold2" property instead. + B{DEPRECATED: Use the "hold2" property instead.} @type keycode: keycode from L{GameKeys} module """ @@ -98,7 +110,7 @@ class SCA_KeyboardSensor(SCA_ISensor): """ Get a list of keys that have either been pressed, or just released this frame. - Deprecated: Use getEventList() instead. + B{DEPRECATED: Use "events" instead.} @rtype: list of key status. [[keycode, status]] """ @@ -107,7 +119,7 @@ class SCA_KeyboardSensor(SCA_ISensor): """ Get a list of currently pressed keys that have either been pressed, or just released - Deprecated: Use getEventList() instead. + B{DEPRECATED: Use "events" instead.} @rtype: list of key status. [[keycode, status]] """ \ No newline at end of file -- cgit v1.2.3