diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-05-10 05:48:14 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-05-10 05:48:14 +0400 |
commit | 136d4c34badc12b72f5c3541fcdaf2b1459af408 (patch) | |
tree | 2fc2952fb508234c74f9b1f1151dfea6dc242303 /source/gameengine/PyDoc | |
parent | f155da0039104af88379bb354674e32ef2595960 (diff) |
deprecate controller.getActuator(name) and controller.getSensor(name) for
controller.actuators[name] and controller.sensors[name]
Made a read-only sequence type for logic brick sensors and actuators which can access single items or be used like a list or dictionary.
We could use a python dictionary or CValueList but that would be slower to create.
So you can do...
for s in controller.sensors: print s
print controller.sensors["Sensor"]
print controller.sensors[0]
sensors = list(controller.sensors)
This sequence type keeps a reference to the proxy it came from and will raise an error on access if the proxy has been removed.
Diffstat (limited to 'source/gameengine/PyDoc')
-rw-r--r-- | source/gameengine/PyDoc/KX_GameObject.py | 6 | ||||
-rw-r--r-- | source/gameengine/PyDoc/SCA_IController.py | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/source/gameengine/PyDoc/KX_GameObject.py b/source/gameengine/PyDoc/KX_GameObject.py index 0f9bfea98f3..257a25e8ad9 100644 --- a/source/gameengine/PyDoc/KX_GameObject.py +++ b/source/gameengine/PyDoc/KX_GameObject.py @@ -67,15 +67,15 @@ class KX_GameObject(SCA_IObject): - note: Most objects use only 1 mesh. - note: Changes to this list will not update the KX_GameObject. @type meshes: list of L{KX_MeshProxy} - @ivar sensors: a list of L{SCA_ISensor} objects. + @ivar sensors: a sequence of L{SCA_ISensor} objects with string/index lookups and iterator support. - note: This attribute is experemental and may be removed (but probably wont be). - note: Changes to this list will not update the KX_GameObject. @type sensors: list - @ivar controllers: a list of L{SCA_IController} objects. + @ivar controllers: a sequence of L{SCA_IController} objects with string/index lookups and iterator support. - note: This attribute is experemental and may be removed (but probably wont be). - note: Changes to this list will not update the KX_GameObject. @type controllers: list of L{SCA_ISensor}. - @ivar actuators: a list of L{SCA_IActuator} objects. + @ivar actuators: a list of L{SCA_IActuator} with string/index lookups and iterator support. - note: This attribute is experemental and may be removed (but probably wont be). - note: Changes to this list will not update the KX_GameObject. @type actuators: list diff --git a/source/gameengine/PyDoc/SCA_IController.py b/source/gameengine/PyDoc/SCA_IController.py index 3e6ee45e115..cfb4c18a826 100644 --- a/source/gameengine/PyDoc/SCA_IController.py +++ b/source/gameengine/PyDoc/SCA_IController.py @@ -12,13 +12,13 @@ class SCA_IController(SCA_ILogicBrick): @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 + @type sensors: sequence supporting index/string lookups and iteration. @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 + @type actuators: sequence supporting index/string lookups and iteration. - @group Deprecated: getState, getSensors, getActuators + @group Deprecated: getState, getSensors, getActuators, getSensor, getActuator """ def getState(): @@ -39,6 +39,7 @@ class SCA_IController(SCA_ILogicBrick): """ def getSensor(name): """ + DEPRECATED: use the sensors[name] property Gets the named linked sensor. @type name: string @@ -53,6 +54,7 @@ class SCA_IController(SCA_ILogicBrick): """ def getActuator(name): """ + DEPRECATED: use the actuators[name] property Gets the named linked actuator. @type name: string |