forked from bartvdbraak/blender
47c2271d67
* 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.
24 lines
684 B
Python
24 lines
684 B
Python
# $Id: KX_ParentActuator.py 2615 2004-06-02 12:43:27Z kester $
|
|
# Documentation for KX_ParentActuator
|
|
from SCA_IActuator import *
|
|
|
|
class KX_ParentActuator(SCA_IActuator):
|
|
"""
|
|
The parent actuator can set or remove an objects parent object.
|
|
"""
|
|
def setObject(object):
|
|
"""
|
|
Sets the object to set as parent.
|
|
|
|
Object can be either a L{KX_GameObject} or the name of the object.
|
|
|
|
@type object: L{KX_GameObject}, string or None
|
|
"""
|
|
def getObject(name_only = 1):
|
|
"""
|
|
Returns the name of the object to change to.
|
|
@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
|
|
"""
|