Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-05-06 13:12:08 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-05-06 13:12:08 +0400
commitc1e1091f027e2d1b8a84ff5595e9a85b092f1b88 (patch)
tree94fed2d523ef0f3fa548645798dadcc2141e746d /source/gameengine/PyDoc
parent25b415f310bd181671f11afbe9d9b0ab899a87ec (diff)
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]
Diffstat (limited to 'source/gameengine/PyDoc')
-rw-r--r--source/gameengine/PyDoc/GameLogic.py6
-rw-r--r--source/gameengine/PyDoc/KX_SceneActuator.py2
-rw-r--r--source/gameengine/PyDoc/SCA_IController.py52
-rw-r--r--source/gameengine/PyDoc/SCA_PythonController.py42
4 files changed, 60 insertions, 42 deletions
diff --git a/source/gameengine/PyDoc/GameLogic.py b/source/gameengine/PyDoc/GameLogic.py
index 708dc29f137..d16c00ca272 100644
--- a/source/gameengine/PyDoc/GameLogic.py
+++ b/source/gameengine/PyDoc/GameLogic.py
@@ -59,7 +59,7 @@ Documentation for the GameLogic Module.
actuator = co.getActuator("actuatorname")
# Activate an actuator
- GameLogic.addActiveActuator(actuator, True)
+ controller.activate(actuator)
See the actuator's reference for available methods:
- L{2DFilterActuator<SCA_2DFilterActuator.SCA_2DFilterActuator>}
@@ -307,6 +307,8 @@ KX_SCENE_RESUME: See L{KX_SceneActuator}
@var VIEWMATRIX_INVERSE:
@var VIEWMATRIX_INVERSETRANSPOSE:
@var VIEWMATRIX_TRANSPOSE:
+
+@group Deprecated: addActiveActuator
"""
# TODO
@@ -335,7 +337,7 @@ def getSceneList():
"""
def addActiveActuator(actuator, activate):
"""
- Activates the given actuator.
+ Activates the given actuator. (B{deprecated})
@type actuator: L{SCA_IActuator} or the actuator name as a string.
@type activate: boolean
diff --git a/source/gameengine/PyDoc/KX_SceneActuator.py b/source/gameengine/PyDoc/KX_SceneActuator.py
index 8e806c2c50e..937c94c91e6 100644
--- a/source/gameengine/PyDoc/KX_SceneActuator.py
+++ b/source/gameengine/PyDoc/KX_SceneActuator.py
@@ -20,7 +20,7 @@ class KX_SceneActuator(SCA_IActuator):
@type camera: L{KX_Camera} on read, string or L{KX_Camera} on write
@ivar useRestart: Set flag to True to restart the sene
@type useRestart: bool
- @type mode: The mode of the actuator
+ @ivar mode: The mode of the actuator
@type mode: int from 0 to 5 L{GameLogic.Scene Actuator}
"""
def setUseRestart(flag):
diff --git a/source/gameengine/PyDoc/SCA_IController.py b/source/gameengine/PyDoc/SCA_IController.py
index f83e7c97dce..3e6ee45e115 100644
--- a/source/gameengine/PyDoc/SCA_IController.py
+++ b/source/gameengine/PyDoc/SCA_IController.py
@@ -5,5 +5,57 @@ from SCA_ILogicBrick import *
class SCA_IController(SCA_ILogicBrick):
"""
Base class for all controller logic bricks.
+
+ @ivar state: the controllers state bitmask.
+ This can be used with the GameObject's state to test if the controller is active.
+ @type state: int bitmask
+ @ivar sensors: a list of sensors linked to this controller
+ - note: the sensors are not necessarily owned by the same object.
+ - note: when objects are instanced in dupligroups links may be lost from objects outside the dupligroup.
+ @type sensors: list
+ @ivar actuators: a list of actuators linked to this controller.
+ - note: the sensors are not necessarily owned by the same object.
+ - note: when objects are instanced in dupligroups links may be lost from objects outside the dupligroup.
+ @type actuators: list
+
+ @group Deprecated: getState, getSensors, getActuators
"""
+ def getState():
+ """
+ DEPRECATED: use the state property
+ Get the controllers state bitmask, this can be used with the GameObject's state to test if the the controller is active.
+ This for instance will always be true however you could compare with a previous state to see when the state was activated.
+ GameLogic.getCurrentController().getState() & GameLogic.getCurrentController().getOwner().getState()
+
+ @rtype: int
+ """
+ def getSensors():
+ """
+ DEPRECATED: use the sensors property
+ Gets a list of all sensors attached to this controller.
+
+ @rtype: list [L{SCA_ISensor}]
+ """
+ def getSensor(name):
+ """
+ Gets the named linked sensor.
+
+ @type name: string
+ @rtype: L{SCA_ISensor}
+ """
+ def getActuators():
+ """
+ DEPRECATED: use the actuators property
+ Gets a list of all actuators linked to this controller.
+
+ @rtype: list [L{SCA_IActuator}]
+ """
+ def getActuator(name):
+ """
+ Gets the named linked actuator.
+
+ @type name: string
+ @rtype: L{SCA_IActuator}
+ """
+ \ No newline at end of file
diff --git a/source/gameengine/PyDoc/SCA_PythonController.py b/source/gameengine/PyDoc/SCA_PythonController.py
index 9684b41d481..7b9b6ccd80a 100644
--- a/source/gameengine/PyDoc/SCA_PythonController.py
+++ b/source/gameengine/PyDoc/SCA_PythonController.py
@@ -11,9 +11,8 @@ class SCA_PythonController(SCA_IController):
@ivar script: the Python script this controller executes
@type script: string, read-only
- @ivar state: the controllers state bitmask.
- This can be used with the GameObject's state to test if the controller is active.
- @type state: integer
+
+ @group Deprecated: getScript, setScript
"""
def activate(actuator):
"""
@@ -25,33 +24,6 @@ class SCA_PythonController(SCA_IController):
Deactivates an actuator attached to this controller.
@type actuator: actuator or the actuator name as a string
"""
-
- def getSensors():
- """
- Gets a list of all sensors attached to this controller.
-
- @rtype: list [L{SCA_ISensor}]
- """
- def getSensor(name):
- """
- Gets the named linked sensor.
-
- @type name: string
- @rtype: L{SCA_ISensor}
- """
- def getActuators():
- """
- Gets a list of all actuators linked to this controller.
-
- @rtype: list [L{SCA_IActuator}]
- """
- def getActuator(name):
- """
- Gets the named linked actuator.
-
- @type name: string
- @rtype: L{SCA_IActuator}
- """
def getScript():
"""
DEPRECATED: use the script property
@@ -61,17 +33,9 @@ class SCA_PythonController(SCA_IController):
"""
def setScript(script):
"""
+ DEPRECATED: use the script property
Sets the Python script this controller executes.
@type script: string.
"""
- def getState():
- """
- DEPRECATED: use the state property
- Get the controllers state bitmask, this can be used with the GameObject's state to test if the the controller is active.
- This for instance will always be true however you could compare with a previous state to see when the state was activated.
- GameLogic.getCurrentController().getState() & GameLogic.getCurrentController().getOwner().getState()
-
- @rtype: int
- """