Python API get/setObject update for Actuators. (SetParent, AddObject, Camera and TrackTo)
* bugfix for BGE python api - SetParent actuator getObject would segfault if the object was not set. * Added utility function ConvertPythonToGameObject() that can take a GameObject, string or None and set the game object from this since it was being done in a number of places. * allow setObject(None), since no object is valid for actuators, Python should be able to set this. * added optional argument for getObject() so it returns the KX_GameObject rather then its name, would prefer this be default but it could break existing games.
This commit is contained in:
@@ -8,11 +8,13 @@ class KX_CameraActuator(SCA_IActuator):
|
||||
|
||||
@author: snail
|
||||
"""
|
||||
def getObject():
|
||||
def getObject(name_only = 1):
|
||||
"""
|
||||
Returns the name of the object this actuator tracks.
|
||||
|
||||
rtype: string
|
||||
@type name_only: bool
|
||||
@param name_only: optional argument, when 0 return a KX_GameObject
|
||||
@rtype: string, KX_GameObject or None if no object is set
|
||||
"""
|
||||
|
||||
def setObject(target):
|
||||
@@ -20,7 +22,7 @@ class KX_CameraActuator(SCA_IActuator):
|
||||
Sets the object this actuator tracks.
|
||||
|
||||
@param target: the object to track.
|
||||
@type target: string or L{KX_GameObject}
|
||||
@type target: L{KX_GameObject}, string or None
|
||||
"""
|
||||
|
||||
def getMin():
|
||||
|
||||
Reference in New Issue
Block a user