[#18802] BGE conversion script: more attributes; updated GameTypes.py
Patch from Alex Fraser (z0r) - All attributes in the conversion map have been checked against the docs. More ambiguities have been resolved. - Added option to convert all text buffers in Blender. - Updated GameTypes.py: there were inconsistencies. The script works well (causes no errors) with 0_FPS_Template.blend and vehicle_demo.blend from the physics-2.43-physics-testfiles pack. Caveats: - Conversions were checked against other deprecated attributes. I may have missed some cases where a deprecated attribute has the same name as a non-deprecated attribute. I did catch a few though. - As with the last version, the conversion is purely text-based and doesn't compile the code. It's easy to create a script that would break on conversion. Still, it should get you 90% of the way to a converted script.
This commit is contained in:
@@ -24,6 +24,53 @@ Tooltip: 'Attemps to update deprecated usage of game engine API.'
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# This script updates game engine scripts that were designed for pre-2.49
|
||||||
|
# versions of Blender to run with the new API. Deprecated function calls are
|
||||||
|
# listed in attributeRenameDict. This script searches for instances of the keys
|
||||||
|
# in a target script and re-writes them.
|
||||||
|
#
|
||||||
|
# Some deprecated functions are complicated to re-write. The most common
|
||||||
|
# conversions have been implemented, but some have not. Running this will reduce
|
||||||
|
# the number of deprecation warnings in your scripts, but may not eliminate them
|
||||||
|
# entirely.
|
||||||
|
#
|
||||||
|
# NOTE: The conversion is not guaranteed to be perfect. It is strongly
|
||||||
|
# recommended that you review all changes after running this script.
|
||||||
|
#
|
||||||
|
# TODO: The following attributes are either ambiguous or need special processing
|
||||||
|
# to handle parameters.
|
||||||
|
#
|
||||||
|
# getLinearVelocity (KX_SCA_AddObjectActuator)
|
||||||
|
# Conflicts with KX_GameObject.
|
||||||
|
# setLinearVelocity (KX_SCA_AddObjectActuator)
|
||||||
|
# Conflicts with KX_GameObject.
|
||||||
|
# getAngularVelocity (KX_SCA_AddObjectActuator)
|
||||||
|
# Conflicts with KX_GameObject.
|
||||||
|
# setAngularVelocity (KX_SCA_AddObjectActuator)
|
||||||
|
# Conflicts with KX_GameObject.
|
||||||
|
# setAction (BL_ShapeActionActuator, BL_ActionActuator)
|
||||||
|
# `reset' argument has no conversion target.
|
||||||
|
# set (KX_VisibilityActuator, KX_IpoActuator)
|
||||||
|
# Different numbers of arguments.
|
||||||
|
# Arguments map to multiple attributes.
|
||||||
|
# getIndex (SCA_JoystickSensor)
|
||||||
|
# Incompatible values: Old = 1-based index; new = 0-based.
|
||||||
|
# getMesh (KX_SCA_ReplaceMeshActuator)
|
||||||
|
# Return types differ. Need to call object.name.
|
||||||
|
# getObject (KX_SCA_AddObjectActuator, KX_CameraActuator,
|
||||||
|
# KX_TrackToActuator, KX_ParentActuator)
|
||||||
|
# Default return type differs between classes.
|
||||||
|
# setIndex (SCA_JoystickSensor)
|
||||||
|
# Incompatible values: Old = 1-based index; new = 0-based.
|
||||||
|
# setObject (KX_SCA_AddObjectActuator, KX_CameraActuator,
|
||||||
|
# KX_TrackToActuator, KX_ParentActuator)
|
||||||
|
# Incompatible types: Old = KX_GameObject or String; new =
|
||||||
|
# KX_GameObject.
|
||||||
|
# setOperation (KX_SCA_DynamicActuator, KX_StateActuator)
|
||||||
|
# Ambiguous: different target names.
|
||||||
|
#
|
||||||
|
|
||||||
import string
|
import string
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@@ -36,7 +83,7 @@ def findBalancedParens(lines, row, col, openChar = '(', closeChar = ')'):
|
|||||||
"""Finds a balanced pair of parentheses, searching from lines[row][col].
|
"""Finds a balanced pair of parentheses, searching from lines[row][col].
|
||||||
The opening parenthesis must be on the starting line.
|
The opening parenthesis must be on the starting line.
|
||||||
|
|
||||||
Returns a 4-tuple containing the row and column of the opening paren, and
|
Returns two tuples containing the row and column of the opening paren, and
|
||||||
the row and column of the matching paren.
|
the row and column of the matching paren.
|
||||||
|
|
||||||
Throws a ParseError if the first character is not openChar, or if a matching
|
Throws a ParseError if the first character is not openChar, or if a matching
|
||||||
@@ -163,6 +210,25 @@ def replaceSimpleSetter(lines, row, colStart, colEnd, newName):
|
|||||||
|
|
||||||
lines[row] = replaceSubstr(lines[row], colStart, colEnd, newName + ' = ')
|
lines[row] = replaceSubstr(lines[row], colStart, colEnd, newName + ' = ')
|
||||||
|
|
||||||
|
def replaceArgsWithListSetter(lines, row, colStart, colEnd, newName):
|
||||||
|
"""Replace a call to a multi-agument setter function with a reference to a
|
||||||
|
list property, e.g. foo.setBar(baz, bazZ) -> foo.bar = [baz, bazZ]
|
||||||
|
|
||||||
|
The function identifier being replaced must be on line `row' and
|
||||||
|
between `colStart' and `colEnd'. The opening parenthesis must follow
|
||||||
|
immediately (whitespace is allowed). The closing parenthesis may be on the
|
||||||
|
same or following lines.
|
||||||
|
|
||||||
|
Throws a ConversionError if the parentheses can't be found. In this case
|
||||||
|
the content of `lines' will be untouched."""
|
||||||
|
try:
|
||||||
|
replaceNextParens(lines, row, colEnd, newOpenChar = '[', newCloseChar = ']')
|
||||||
|
except ParseError:
|
||||||
|
raise ConversionError, ("Deprecated function reference.")
|
||||||
|
|
||||||
|
lines[row] = replaceSubstr(lines[row], colStart, colEnd, newName + ' = ')
|
||||||
|
|
||||||
|
|
||||||
def replaceKeyedGetter(lines, row, colStart, colEnd, newName):
|
def replaceKeyedGetter(lines, row, colStart, colEnd, newName):
|
||||||
"""Replace a call to a keyed getter function with a reference to a
|
"""Replace a call to a keyed getter function with a reference to a
|
||||||
property, e.g. foo.getBar(baz) -> foo.bar[baz]
|
property, e.g. foo.getBar(baz) -> foo.bar[baz]
|
||||||
@@ -261,6 +327,10 @@ def replaceAddActiveActuator(lines, row, colStart, colEnd, closure):
|
|||||||
lines[row] = replaceSubstr(lines[row], gameLogicStart, closeCol + 1, newExpr)
|
lines[row] = replaceSubstr(lines[row], gameLogicStart, closeCol + 1, newExpr)
|
||||||
|
|
||||||
def getObject(line, attributeStart):
|
def getObject(line, attributeStart):
|
||||||
|
'''Get the object that an attribute belongs to. `attributeStart' is the
|
||||||
|
index of the first character of the attribute name in the string `line'.
|
||||||
|
Returns: the identifier preceding `attributeStart', or None if one can't be
|
||||||
|
found.'''
|
||||||
match = re.search(r'([a-zA-Z_]\w*)\s*\.\s*$', line[0:attributeStart])
|
match = re.search(r'([a-zA-Z_]\w*)\s*\.\s*$', line[0:attributeStart])
|
||||||
if not match:
|
if not match:
|
||||||
return None
|
return None
|
||||||
@@ -268,7 +338,7 @@ def getObject(line, attributeStart):
|
|||||||
|
|
||||||
def replaceGetActuator(lines, row, colStart, colEnd, closure):
|
def replaceGetActuator(lines, row, colStart, colEnd, closure):
|
||||||
'''getActuator is ambiguous: it could belong to SCA_IController or
|
'''getActuator is ambiguous: it could belong to SCA_IController or
|
||||||
SCA_ActuatorSensor. Try to resolve.
|
SCA_ActuatorSensor. Try to resolve and then convert.
|
||||||
|
|
||||||
Raises a ConversionError if the parentheses can't be found, or if the
|
Raises a ConversionError if the parentheses can't be found, or if the
|
||||||
ambiguity can't be resolved.'''
|
ambiguity can't be resolved.'''
|
||||||
@@ -284,6 +354,54 @@ def replaceGetActuator(lines, row, colStart, colEnd, closure):
|
|||||||
|
|
||||||
raise ConversionError, "Ambiguous: addActiveActuator -> actuators[key] (SCA_IController) or actuator (SCA_ActuatorSensor)."
|
raise ConversionError, "Ambiguous: addActiveActuator -> actuators[key] (SCA_IController) or actuator (SCA_ActuatorSensor)."
|
||||||
|
|
||||||
|
def replaceSetOrientation(lines, row, colStart, colEnd, closure):
|
||||||
|
'''setOrientation is ambiguous: it could belong to KX_SoundActuator or
|
||||||
|
KX_GameObject. Try to resolve and then convert. If the type can't be
|
||||||
|
determined, it is assumed to be a KX_GameObject. Currently, only the
|
||||||
|
conversion for KX_GameObject is implemented.
|
||||||
|
|
||||||
|
Raises a ConversionError if the parentheses can't be found, or if the
|
||||||
|
object is found to be a KX_SoundActuator.'''
|
||||||
|
# Get the name of the object this attribute is attached to.
|
||||||
|
obName = getObject(lines[row], colStart)
|
||||||
|
if obName:
|
||||||
|
# Try to find out whether the object is an actuator.
|
||||||
|
assn = findLastAssignment(lines, row, obName)
|
||||||
|
if assn:
|
||||||
|
match = re.search(r'([a-zA-Z_]\w*)' # Controller identifier
|
||||||
|
r'\s*\.\s*' # Dot
|
||||||
|
r'(actuators\s*\[|getActuator\s*\()', # Dictionary/getter identifier
|
||||||
|
assn)
|
||||||
|
if match:
|
||||||
|
# It's probably a KX_SoundActuator.
|
||||||
|
raise ConversionError, "Not implemented: Can't convert arguments to matrix."
|
||||||
|
|
||||||
|
# It's probably a KX_GameObject.
|
||||||
|
replaceSimpleSetter(lines, row, colStart, colEnd, 'localOrientation')
|
||||||
|
|
||||||
|
def replaceSetPosition(lines, row, colStart, colEnd, closure):
|
||||||
|
'''setPosition is ambiguous: it could belong to KX_SoundActuator or
|
||||||
|
KX_GameObject. Try to resolve and then convert. If the type can't be
|
||||||
|
determined, it is assumed to be a KX_GameObject.
|
||||||
|
|
||||||
|
Raises a ConversionError if the parentheses can't be found.'''
|
||||||
|
# Get the name of the object this attribute is attached to.
|
||||||
|
obName = getObject(lines[row], colStart)
|
||||||
|
if obName:
|
||||||
|
# Try to find out whether the object is an actuator.
|
||||||
|
assn = findLastAssignment(lines, row, obName)
|
||||||
|
if assn:
|
||||||
|
match = re.search(r'([a-zA-Z_]\w*)' # Controller identifier
|
||||||
|
r'\s*\.\s*' # Dot
|
||||||
|
r'(actuators\s*\[|getActuator\s*\()', # Dictionary/getter identifier
|
||||||
|
assn)
|
||||||
|
if match:
|
||||||
|
# It's probably a KX_SoundActuator.
|
||||||
|
replaceSimpleSetter(lines, row, colStart, colEnd, 'position')
|
||||||
|
|
||||||
|
# It's probably a KX_GameObject.
|
||||||
|
replaceSimpleSetter(lines, row, colStart, colEnd, 'localPosition')
|
||||||
|
|
||||||
#
|
#
|
||||||
# Deprecated attribute information. The format is:
|
# Deprecated attribute information. The format is:
|
||||||
# deprecatedAttributeName: {(conversionFunction, closure): classList}
|
# deprecatedAttributeName: {(conversionFunction, closure): classList}
|
||||||
@@ -298,24 +416,31 @@ attributeRenameDict = {
|
|||||||
'getActuator': {(replaceGetActuator, None): ['SCA_IController', 'SCA_ActuatorSensor']},
|
'getActuator': {(replaceGetActuator, None): ['SCA_IController', 'SCA_ActuatorSensor']},
|
||||||
'getXPosition': {(replaceGetXYPosition, '0'): ['SCA_MouseSensor']},
|
'getXPosition': {(replaceGetXYPosition, '0'): ['SCA_MouseSensor']},
|
||||||
'getYPosition': {(replaceGetXYPosition, '1'): ['SCA_MouseSensor']},
|
'getYPosition': {(replaceGetXYPosition, '1'): ['SCA_MouseSensor']},
|
||||||
|
'setOrientation': {(replaceSetOrientation, None): ['KX_GameObject', 'KX_SoundActuator']},
|
||||||
|
'setPosition': {(replaceSetPosition, None): ['KX_GameObject', 'KX_SoundActuator']},
|
||||||
|
|
||||||
# Unimplemented! There are probably more of these below that would cause errors.
|
# Keyed getters/setters
|
||||||
#'getLinearVelocity': {(replaceSimpleGetter, 'linearVelocity'): ['KX_SCA_AddObjectActuator']},
|
'getSensor': {(replaceKeyedGetter, 'sensors'): ['SCA_IController']},
|
||||||
#'setLinearVelocity': {(replaceSimpleSetter, 'linearVelocity'): ['KX_SCA_AddObjectActuator']},
|
|
||||||
#'getAngularVelocity': {(replaceSimpleGetter, 'angularVelocity'): ['KX_SCA_AddObjectActuator']},
|
|
||||||
#'setAngularVelocity': {(replaceSimpleSetter, 'angularVelocity'): ['KX_SCA_AddObjectActuator']},
|
|
||||||
|
|
||||||
# Generic converters
|
# Multi-arg -> List setter
|
||||||
|
'setAxis': {(replaceArgsWithListSetter, 'axis'): ['SCA_JoystickSensor']},
|
||||||
|
'setHat': {(replaceArgsWithListSetter, 'hat'): ['SCA_JoystickSensor']},
|
||||||
|
'setVelocity': {(replaceArgsWithListSetter, 'velocity'): ['KX_SoundActuator']},
|
||||||
|
|
||||||
|
# Straight rename
|
||||||
|
'getButtonValue': {(replaceRename, 'getButtonActiveList'): ['SCA_JoystickSensor']},
|
||||||
|
|
||||||
|
# Simple getters/setters
|
||||||
|
'getSensors': {(replaceSimpleGetter, 'sensors'): ['SCA_IController']},
|
||||||
|
'getActuators': {(replaceSimpleGetter, 'actuators'): ['SCA_IController']},
|
||||||
'enableViewport': {(replaceSimpleSetter, 'useViewport'): ['KX_Camera']},
|
'enableViewport': {(replaceSimpleSetter, 'useViewport'): ['KX_Camera']},
|
||||||
'getAction': {(replaceSimpleGetter, 'action'): ['BL_ShapeActionActuator', 'BL_ActionActuator']},
|
'getAction': {(replaceSimpleGetter, 'action'): ['BL_ShapeActionActuator', 'BL_ActionActuator']},
|
||||||
'getActuators': {(replaceKeyedGetter, 'actuators'): ['SCA_IController']},
|
|
||||||
'getAxis': {(replaceSimpleGetter, 'axis'): ['SCA_JoystickSensor']},
|
'getAxis': {(replaceSimpleGetter, 'axis'): ['SCA_JoystickSensor']},
|
||||||
'getAxisValue': {(replaceSimpleGetter, 'axisSingle'): ['SCA_JoystickSensor']},
|
'getAxisValue': {(replaceSimpleGetter, 'axisValues'): ['SCA_JoystickSensor']},
|
||||||
'getBlendin': {(replaceSimpleGetter, 'blendIn'): ['BL_ShapeActionActuator',
|
'getBlendin': {(replaceSimpleGetter, 'blendIn'): ['BL_ShapeActionActuator',
|
||||||
'BL_ActionActuator']},
|
'BL_ActionActuator']},
|
||||||
'getBodies': {(replaceSimpleGetter, 'bodies'): ['KX_NetworkMessageSensor']},
|
'getBodies': {(replaceSimpleGetter, 'bodies'): ['KX_NetworkMessageSensor']},
|
||||||
'getButton': {(replaceSimpleGetter, 'button'): ['SCA_JoystickSensor']},
|
'getButton': {(replaceSimpleGetter, 'button'): ['SCA_JoystickSensor']},
|
||||||
'getButtonValue': {(replaceRename, 'getButtonActiveList'): ['SCA_JoystickSensor']},
|
|
||||||
'getCamera': {(replaceSimpleGetter, 'camera'): ['KX_SceneActuator']},
|
'getCamera': {(replaceSimpleGetter, 'camera'): ['KX_SceneActuator']},
|
||||||
'getConeOrigin': {(replaceSimpleGetter, 'coneOrigin'): ['KX_RadarSensor']},
|
'getConeOrigin': {(replaceSimpleGetter, 'coneOrigin'): ['KX_RadarSensor']},
|
||||||
'getConeTarget': {(replaceSimpleGetter, 'coneTarget'): ['KX_RadarSensor']},
|
'getConeTarget': {(replaceSimpleGetter, 'coneTarget'): ['KX_RadarSensor']},
|
||||||
@@ -325,8 +450,8 @@ attributeRenameDict = {
|
|||||||
'getDistribution': {(replaceSimpleGetter, 'distribution'): ['SCA_RandomActuator']},
|
'getDistribution': {(replaceSimpleGetter, 'distribution'): ['SCA_RandomActuator']},
|
||||||
'getDuration': {(replaceSimpleGetter, 'duration'): ['SCA_DelaySensor']},
|
'getDuration': {(replaceSimpleGetter, 'duration'): ['SCA_DelaySensor']},
|
||||||
'getEnd': {(replaceSimpleGetter, 'frameEnd'): ['BL_ShapeActionActuator',
|
'getEnd': {(replaceSimpleGetter, 'frameEnd'): ['BL_ShapeActionActuator',
|
||||||
'KX_IpoActuator',
|
'KX_IpoActuator',
|
||||||
'BL_ActionActuator']},
|
'BL_ActionActuator']},
|
||||||
'getExecutePriority': {(replaceSimpleGetter, 'executePriority'): ['SCA_ILogicBrick']},
|
'getExecutePriority': {(replaceSimpleGetter, 'executePriority'): ['SCA_ILogicBrick']},
|
||||||
'getFile': {(replaceSimpleGetter, 'fileName'): ['KX_GameActuator']},
|
'getFile': {(replaceSimpleGetter, 'fileName'): ['KX_GameActuator']},
|
||||||
'getFilename': {(replaceSimpleGetter, 'fileName'): ['KX_SoundActuator']},
|
'getFilename': {(replaceSimpleGetter, 'fileName'): ['KX_SoundActuator']},
|
||||||
@@ -334,21 +459,20 @@ attributeRenameDict = {
|
|||||||
'getFrame': {(replaceSimpleGetter, 'frame'): ['BL_ShapeActionActuator', 'BL_ActionActuator']},
|
'getFrame': {(replaceSimpleGetter, 'frame'): ['BL_ShapeActionActuator', 'BL_ActionActuator']},
|
||||||
'getFrameMessageCount': {(replaceSimpleGetter, 'frameMessageCount'): ['KX_NetworkMessageSensor']},
|
'getFrameMessageCount': {(replaceSimpleGetter, 'frameMessageCount'): ['KX_NetworkMessageSensor']},
|
||||||
'getFrameProperty': {(replaceSimpleGetter, 'framePropName'): ['BL_ShapeActionActuator',
|
'getFrameProperty': {(replaceSimpleGetter, 'framePropName'): ['BL_ShapeActionActuator',
|
||||||
'BL_ActionActuator']},
|
'BL_ActionActuator']},
|
||||||
'getFrequency': {(replaceSimpleGetter, 'frequency'): ['SCA_ISensor']},
|
'getFrequency': {(replaceSimpleGetter, 'frequency'): ['SCA_ISensor']},
|
||||||
'getGain': {(replaceSimpleGetter, 'volume'): ['KX_SoundActuator', 'KX_CDActuator']},
|
'getGain': {(replaceSimpleGetter, 'volume'): ['KX_SoundActuator', 'KX_CDActuator']},
|
||||||
'getHat': {(replaceSimpleGetter, 'hat'): ['SCA_JoystickSensor']},
|
'getHat': {(replaceSimpleGetter, 'hat'): ['SCA_JoystickSensor']},
|
||||||
'getHeight': {(replaceSimpleGetter, 'height'): ['KX_CameraActuator']},
|
'getHeight': {(replaceSimpleGetter, 'height'): ['KX_CameraActuator']},
|
||||||
'getHitNormal': {(replaceSimpleGetter, 'hitNormal'): ['KX_MouseFocusSensor', 'KX_RaySensor']},
|
'getHitNormal': {(replaceSimpleGetter, 'hitNormal'): ['KX_MouseFocusSensor', 'KX_RaySensor']},
|
||||||
'getHitObject': {(replaceSimpleGetter, 'hitObject'): ['KX_MouseFocusSensor',
|
'getHitObject': {(replaceSimpleGetter, 'hitObject'): ['KX_MouseFocusSensor',
|
||||||
'KX_RaySensor',
|
'KX_RaySensor',
|
||||||
'KX_TouchSensor']},
|
'KX_TouchSensor']},
|
||||||
'getHitObjectList': {(replaceSimpleGetter, 'hitObjectList'): ['KX_TouchSensor']},
|
'getHitObjectList': {(replaceSimpleGetter, 'hitObjectList'): ['KX_TouchSensor']},
|
||||||
'getHitPosition': {(replaceSimpleGetter, 'hitPosition'): ['KX_MouseFocusSensor',
|
'getHitPosition': {(replaceSimpleGetter, 'hitPosition'): ['KX_MouseFocusSensor',
|
||||||
'KX_RaySensor']},
|
'KX_RaySensor']},
|
||||||
'getHold1': {(replaceSimpleGetter, 'hold1'): ['SCA_KeyboardSensor']},
|
'getHold1': {(replaceSimpleGetter, 'hold1'): ['SCA_KeyboardSensor']},
|
||||||
'getHold2': {(replaceSimpleGetter, 'hold2'): ['SCA_KeyboardSensor']},
|
'getHold2': {(replaceSimpleGetter, 'hold2'): ['SCA_KeyboardSensor']},
|
||||||
'getIndex': {(replaceSimpleGetter, 'index'): ['SCA_JoystickSensor']},
|
|
||||||
'getInvert': {(replaceSimpleGetter, 'invert'): ['SCA_ISensor']},
|
'getInvert': {(replaceSimpleGetter, 'invert'): ['SCA_ISensor']},
|
||||||
'getIpoAdd': {(replaceSimpleGetter, 'useIpoAdd'): ['KX_IpoActuator']},
|
'getIpoAdd': {(replaceSimpleGetter, 'useIpoAdd'): ['KX_IpoActuator']},
|
||||||
'getIpoAsForce': {(replaceSimpleGetter, 'useIpoAsForce'): ['KX_IpoActuator']},
|
'getIpoAsForce': {(replaceSimpleGetter, 'useIpoAsForce'): ['KX_IpoActuator']},
|
||||||
@@ -359,16 +483,11 @@ attributeRenameDict = {
|
|||||||
'getLooping': {(replaceSimpleGetter, 'looping'): ['KX_SoundActuator']},
|
'getLooping': {(replaceSimpleGetter, 'looping'): ['KX_SoundActuator']},
|
||||||
'getMass': {(replaceSimpleGetter, 'mass'): ['KX_GameObject']},
|
'getMass': {(replaceSimpleGetter, 'mass'): ['KX_GameObject']},
|
||||||
'getMax': {(replaceSimpleGetter, 'max'): ['KX_CameraActuator']},
|
'getMax': {(replaceSimpleGetter, 'max'): ['KX_CameraActuator']},
|
||||||
'getMesh': {(replaceSimpleGetter, 'mesh'): ['KX_SCA_ReplaceMeshActuator']},
|
|
||||||
'getMin': {(replaceSimpleGetter, 'min'): ['KX_CameraActuator']},
|
'getMin': {(replaceSimpleGetter, 'min'): ['KX_CameraActuator']},
|
||||||
'getName': {(replaceSimpleGetter, 'name'): ['KX_Scene']},
|
'getName': {(replaceSimpleGetter, 'name'): ['KX_Scene']},
|
||||||
'getNumAxes': {(replaceSimpleGetter, 'numAxis'): ['SCA_JoystickSensor']},
|
'getNumAxes': {(replaceSimpleGetter, 'numAxis'): ['SCA_JoystickSensor']},
|
||||||
'getNumButtons': {(replaceSimpleGetter, 'numButtons'): ['SCA_JoystickSensor']},
|
'getNumButtons': {(replaceSimpleGetter, 'numButtons'): ['SCA_JoystickSensor']},
|
||||||
'getNumHats': {(replaceSimpleGetter, 'numHats'): ['SCA_JoystickSensor']},
|
'getNumHats': {(replaceSimpleGetter, 'numHats'): ['SCA_JoystickSensor']},
|
||||||
'getObject': {(replaceSimpleGetter, 'object'): ['KX_SCA_AddObjectActuator',
|
|
||||||
'KX_CameraActuator',
|
|
||||||
'KX_TrackToActuator',
|
|
||||||
'KX_ParentActuator']},
|
|
||||||
'getObjectList': {(replaceSimpleGetter, 'objects'): ['KX_Scene']},
|
'getObjectList': {(replaceSimpleGetter, 'objects'): ['KX_Scene']},
|
||||||
'getOperation': {(replaceSimpleGetter, 'mode'): ['KX_SCA_DynamicActuator']},
|
'getOperation': {(replaceSimpleGetter, 'mode'): ['KX_SCA_DynamicActuator']},
|
||||||
'getOrientation': {(replaceSimpleGetter, 'worldOrientation'): ['KX_GameObject']},
|
'getOrientation': {(replaceSimpleGetter, 'worldOrientation'): ['KX_GameObject']},
|
||||||
@@ -380,12 +499,13 @@ attributeRenameDict = {
|
|||||||
'getPosition': {(replaceSimpleGetter, 'worldPosition'): ['KX_GameObject']},
|
'getPosition': {(replaceSimpleGetter, 'worldPosition'): ['KX_GameObject']},
|
||||||
'getPressedKeys': {(replaceSimpleGetter, 'events'): ['SCA_KeyboardSensor']},
|
'getPressedKeys': {(replaceSimpleGetter, 'events'): ['SCA_KeyboardSensor']},
|
||||||
'getPriority': {(replaceSimpleGetter, 'priority'): ['BL_ShapeActionActuator',
|
'getPriority': {(replaceSimpleGetter, 'priority'): ['BL_ShapeActionActuator',
|
||||||
'BL_ActionActuator']},
|
'BL_ActionActuator']},
|
||||||
'getProjectionMatrix': {(replaceSimpleGetter, 'projection_matrix'): ['KX_Camera']},
|
'getProjectionMatrix': {(replaceSimpleGetter, 'projection_matrix'): ['KX_Camera']},
|
||||||
'getProperty': {(replaceSimpleGetter, 'propName'): ['SCA_PropertySensor',
|
'getProperty': {(replaceSimpleGetter, 'propName'): ['SCA_PropertySensor',
|
||||||
'SCA_RandomActuator']},
|
'SCA_RandomActuator',
|
||||||
|
'SCA_PropertyActuator']},
|
||||||
'getRayDirection': {(replaceSimpleGetter, 'rayDirection'): ['KX_MouseFocusSensor',
|
'getRayDirection': {(replaceSimpleGetter, 'rayDirection'): ['KX_MouseFocusSensor',
|
||||||
'KX_RaySensor']},
|
'KX_RaySensor']},
|
||||||
'getRaySource': {(replaceSimpleGetter, 'raySource'): ['KX_MouseFocusSensor']},
|
'getRaySource': {(replaceSimpleGetter, 'raySource'): ['KX_MouseFocusSensor']},
|
||||||
'getRayTarget': {(replaceSimpleGetter, 'rayTarget'): ['KX_MouseFocusSensor']},
|
'getRayTarget': {(replaceSimpleGetter, 'rayTarget'): ['KX_MouseFocusSensor']},
|
||||||
'getRepeat': {(replaceSimpleGetter, 'repeat'): ['SCA_DelaySensor']},
|
'getRepeat': {(replaceSimpleGetter, 'repeat'): ['SCA_DelaySensor']},
|
||||||
@@ -393,11 +513,9 @@ attributeRenameDict = {
|
|||||||
'getScene': {(replaceSimpleGetter, 'scene'): ['KX_SceneActuator']},
|
'getScene': {(replaceSimpleGetter, 'scene'): ['KX_SceneActuator']},
|
||||||
'getScript': {(replaceSimpleGetter, 'script'): ['SCA_PythonController']},
|
'getScript': {(replaceSimpleGetter, 'script'): ['SCA_PythonController']},
|
||||||
'getSeed': {(replaceSimpleGetter, 'seed'): ['SCA_RandomActuator']},
|
'getSeed': {(replaceSimpleGetter, 'seed'): ['SCA_RandomActuator']},
|
||||||
'getSensor': {(replaceKeyedGetter, 'sensors'): ['SCA_IController']},
|
|
||||||
'getSensors': {(replaceKeyedGetter, 'sensors'): ['SCA_IController']},
|
|
||||||
'getStart': {(replaceSimpleGetter, 'frameStart'): ['BL_ShapeActionActuator',
|
'getStart': {(replaceSimpleGetter, 'frameStart'): ['BL_ShapeActionActuator',
|
||||||
'KX_IpoActuator',
|
'KX_IpoActuator',
|
||||||
'BL_ActionActuator']},
|
'BL_ActionActuator']},
|
||||||
'getState': {(replaceSimpleGetter, 'state'): ['SCA_IController', 'KX_GameObject']},
|
'getState': {(replaceSimpleGetter, 'state'): ['SCA_IController', 'KX_GameObject']},
|
||||||
'getSubject': {(replaceSimpleGetter, 'subject'): ['KX_NetworkMessageSensor']},
|
'getSubject': {(replaceSimpleGetter, 'subject'): ['KX_NetworkMessageSensor']},
|
||||||
'getSubjects': {(replaceSimpleGetter, 'subjects'): ['KX_NetworkMessageSensor']},
|
'getSubjects': {(replaceSimpleGetter, 'subjects'): ['KX_NetworkMessageSensor']},
|
||||||
@@ -415,14 +533,11 @@ attributeRenameDict = {
|
|||||||
'isConnected': {(replaceSimpleGetter, 'connected'): ['SCA_JoystickSensor']},
|
'isConnected': {(replaceSimpleGetter, 'connected'): ['SCA_JoystickSensor']},
|
||||||
'isPositive': {(replaceSimpleGetter, 'positive'): ['SCA_ISensor']},
|
'isPositive': {(replaceSimpleGetter, 'positive'): ['SCA_ISensor']},
|
||||||
'isTriggered': {(replaceSimpleGetter, 'triggered'): ['SCA_ISensor']},
|
'isTriggered': {(replaceSimpleGetter, 'triggered'): ['SCA_ISensor']},
|
||||||
'set': {(replaceSimpleSetter, 'visibility'): ['KX_VisibilityActuator']},
|
|
||||||
'setAction': {(replaceSimpleSetter, 'action'): ['BL_ShapeActionActuator', 'BL_ActionActuator']},
|
|
||||||
'setActuator': {(replaceSimpleSetter, 'actuator'): ['SCA_ActuatorSensor']},
|
'setActuator': {(replaceSimpleSetter, 'actuator'): ['SCA_ActuatorSensor']},
|
||||||
'setAxis': {(replaceSimpleSetter, 'axis'): ['SCA_JoystickSensor']},
|
|
||||||
'setBlendin': {(replaceSimpleSetter, 'blendIn'): ['BL_ShapeActionActuator',
|
'setBlendin': {(replaceSimpleSetter, 'blendIn'): ['BL_ShapeActionActuator',
|
||||||
'BL_ActionActuator']},
|
'BL_ActionActuator']},
|
||||||
'setBlendtime': {(replaceSimpleSetter, 'blendTime'): ['BL_ShapeActionActuator',
|
'setBlendtime': {(replaceSimpleSetter, 'blendTime'): ['BL_ShapeActionActuator',
|
||||||
'BL_ActionActuator']},
|
'BL_ActionActuator']},
|
||||||
'setBodyType': {(replaceSimpleSetter, 'usePropBody'): ['KX_NetworkMessageActuator']},
|
'setBodyType': {(replaceSimpleSetter, 'usePropBody'): ['KX_NetworkMessageActuator']},
|
||||||
'setButton': {(replaceSimpleSetter, 'button'): ['SCA_JoystickSensor']},
|
'setButton': {(replaceSimpleSetter, 'button'): ['SCA_JoystickSensor']},
|
||||||
'setCamera': {(replaceSimpleSetter, 'camera'): ['KX_SceneActuator']},
|
'setCamera': {(replaceSimpleSetter, 'camera'): ['KX_SceneActuator']},
|
||||||
@@ -430,22 +545,20 @@ attributeRenameDict = {
|
|||||||
'setDelay': {(replaceSimpleSetter, 'delay'): ['SCA_DelaySensor']},
|
'setDelay': {(replaceSimpleSetter, 'delay'): ['SCA_DelaySensor']},
|
||||||
'setDuration': {(replaceSimpleSetter, 'duration'): ['SCA_DelaySensor']},
|
'setDuration': {(replaceSimpleSetter, 'duration'): ['SCA_DelaySensor']},
|
||||||
'setEnd': {(replaceSimpleSetter, 'frameEnd'): ['BL_ShapeActionActuator',
|
'setEnd': {(replaceSimpleSetter, 'frameEnd'): ['BL_ShapeActionActuator',
|
||||||
'KX_IpoActuator',
|
'KX_IpoActuator',
|
||||||
'BL_ActionActuator']},
|
'BL_ActionActuator']},
|
||||||
'setExecutePriority': {(replaceSimpleSetter, 'executePriority'): ['SCA_ILogicBrick']},
|
'setExecutePriority': {(replaceSimpleSetter, 'executePriority'): ['SCA_ILogicBrick']},
|
||||||
'setFile': {(replaceSimpleSetter, 'fileName'): ['KX_GameActuator']},
|
'setFile': {(replaceSimpleSetter, 'fileName'): ['KX_GameActuator']},
|
||||||
'setFilename': {(replaceSimpleSetter, 'fileName'): ['KX_SoundActuator']},
|
'setFilename': {(replaceSimpleSetter, 'fileName'): ['KX_SoundActuator']},
|
||||||
'setForceIpoActsLocal': {(replaceSimpleSetter, 'useIpoLocal'): ['KX_IpoActuator']},
|
'setForceIpoActsLocal': {(replaceSimpleSetter, 'useIpoLocal'): ['KX_IpoActuator']},
|
||||||
'setFrame': {(replaceSimpleSetter, 'frame'): ['BL_ShapeActionActuator', 'BL_ActionActuator']},
|
'setFrame': {(replaceSimpleSetter, 'frame'): ['BL_ShapeActionActuator', 'BL_ActionActuator']},
|
||||||
'setFrameProperty': {(replaceSimpleSetter, 'framePropName'): ['BL_ShapeActionActuator',
|
'setFrameProperty': {(replaceSimpleSetter, 'framePropName'): ['BL_ShapeActionActuator',
|
||||||
'BL_ActionActuator']},
|
'BL_ActionActuator']},
|
||||||
'setFrequency': {(replaceSimpleSetter, 'frequency'): ['SCA_ISensor']},
|
'setFrequency': {(replaceSimpleSetter, 'frequency'): ['SCA_ISensor']},
|
||||||
'setGain': {(replaceSimpleSetter, 'volume'): ['KX_SoundActuator', 'KX_CDActuator']},
|
'setGain': {(replaceSimpleSetter, 'volume'): ['KX_SoundActuator', 'KX_CDActuator']},
|
||||||
'setHat': {(replaceSimpleSetter, 'hat'): ['SCA_JoystickSensor']},
|
|
||||||
'setHeight': {(replaceSimpleSetter, 'height'): ['KX_CameraActuator']},
|
'setHeight': {(replaceSimpleSetter, 'height'): ['KX_CameraActuator']},
|
||||||
'setHold1': {(replaceSimpleSetter, 'hold1'): ['SCA_KeyboardSensor']},
|
'setHold1': {(replaceSimpleSetter, 'hold1'): ['SCA_KeyboardSensor']},
|
||||||
'setHold2': {(replaceSimpleSetter, 'hold2'): ['SCA_KeyboardSensor']},
|
'setHold2': {(replaceSimpleSetter, 'hold2'): ['SCA_KeyboardSensor']},
|
||||||
'setIndex': {(replaceSimpleSetter, 'index'): ['SCA_JoystickSensor']},
|
|
||||||
'setInvert': {(replaceSimpleSetter, 'invert'): ['SCA_ISensor']},
|
'setInvert': {(replaceSimpleSetter, 'invert'): ['SCA_ISensor']},
|
||||||
'setIpoAdd': {(replaceSimpleSetter, 'useIpoAdd'): ['KX_IpoActuator']},
|
'setIpoAdd': {(replaceSimpleSetter, 'useIpoAdd'): ['KX_IpoActuator']},
|
||||||
'setIpoAsForce': {(replaceSimpleSetter, 'useIpoAsForce'): ['KX_IpoActuator']},
|
'setIpoAsForce': {(replaceSimpleSetter, 'useIpoAsForce'): ['KX_IpoActuator']},
|
||||||
@@ -456,31 +569,22 @@ attributeRenameDict = {
|
|||||||
'setMax': {(replaceSimpleSetter, 'max'): ['KX_CameraActuator']},
|
'setMax': {(replaceSimpleSetter, 'max'): ['KX_CameraActuator']},
|
||||||
'setMesh': {(replaceSimpleSetter, 'mesh'): ['KX_SCA_ReplaceMeshActuator']},
|
'setMesh': {(replaceSimpleSetter, 'mesh'): ['KX_SCA_ReplaceMeshActuator']},
|
||||||
'setMin': {(replaceSimpleSetter, 'min'): ['KX_CameraActuator']},
|
'setMin': {(replaceSimpleSetter, 'min'): ['KX_CameraActuator']},
|
||||||
'setObject': {(replaceSimpleSetter, 'object'): ['KX_SCA_AddObjectActuator',
|
|
||||||
'KX_CameraActuator',
|
|
||||||
'KX_TrackToActuator',
|
|
||||||
'KX_ParentActuator']},
|
|
||||||
'setOperation': {(replaceSimpleSetter, 'mode'): ['KX_SCA_DynamicActuator'],
|
|
||||||
(replaceSimpleSetter, 'operation'): ['KX_StateActuator']},
|
|
||||||
'setOrientation': {(replaceSimpleSetter, 'localOrientation'): ['KX_GameObject'],
|
|
||||||
(replaceSimpleSetter, 'orientation'): ['KX_SoundActuator']},
|
|
||||||
'setPitch': {(replaceSimpleSetter, 'pitch'): ['KX_SoundActuator']},
|
'setPitch': {(replaceSimpleSetter, 'pitch'): ['KX_SoundActuator']},
|
||||||
'setPosition': {(replaceSimpleSetter, 'localPosition'): ['KX_GameObject'],
|
|
||||||
(replaceSimpleSetter, 'position'): ['KX_SoundActuator']},
|
|
||||||
'setPriority': {(replaceSimpleSetter, 'priority'): ['BL_ShapeActionActuator',
|
'setPriority': {(replaceSimpleSetter, 'priority'): ['BL_ShapeActionActuator',
|
||||||
'BL_ActionActuator']},
|
'BL_ActionActuator']},
|
||||||
'setProjectionMatrix': {(replaceSimpleSetter, 'projection_matrix'): ['KX_Camera']},
|
'setProjectionMatrix': {(replaceSimpleSetter, 'projection_matrix'): ['KX_Camera']},
|
||||||
'setProperty': {(replaceSimpleSetter, 'propName'): ['KX_IpoActuator',
|
'setProperty': {(replaceSimpleSetter, 'propName'): ['KX_IpoActuator',
|
||||||
'SCA_PropertySensor',
|
'SCA_PropertySensor',
|
||||||
'SCA_RandomActuator']},
|
'SCA_RandomActuator',
|
||||||
|
'SCA_PropertyActuator']},
|
||||||
'setRepeat': {(replaceSimpleSetter, 'repeat'): ['SCA_DelaySensor']},
|
'setRepeat': {(replaceSimpleSetter, 'repeat'): ['SCA_DelaySensor']},
|
||||||
'setRollOffFactor': {(replaceSimpleSetter, 'rollOffFactor'): ['KX_SoundActuator']},
|
'setRollOffFactor': {(replaceSimpleSetter, 'rollOffFactor'): ['KX_SoundActuator']},
|
||||||
'setScene': {(replaceSimpleSetter, 'scene'): ['KX_SceneActuator']},
|
'setScene': {(replaceSimpleSetter, 'scene'): ['KX_SceneActuator']},
|
||||||
'setScript': {(replaceSimpleSetter, 'script'): ['SCA_PythonController']},
|
'setScript': {(replaceSimpleSetter, 'script'): ['SCA_PythonController']},
|
||||||
'setSeed': {(replaceSimpleSetter, 'seed'): ['SCA_RandomActuator']},
|
'setSeed': {(replaceSimpleSetter, 'seed'): ['SCA_RandomActuator']},
|
||||||
'setStart': {(replaceSimpleSetter, 'frameStart'): ['BL_ShapeActionActuator',
|
'setStart': {(replaceSimpleSetter, 'frameStart'): ['BL_ShapeActionActuator',
|
||||||
'KX_IpoActuator',
|
'KX_IpoActuator',
|
||||||
'BL_ActionActuator']},
|
'BL_ActionActuator']},
|
||||||
'setState': {(replaceSimpleSetter, 'state'): ['KX_GameObject']},
|
'setState': {(replaceSimpleSetter, 'state'): ['KX_GameObject']},
|
||||||
'setSubject': {(replaceSimpleSetter, 'subject'): ['KX_NetworkMessageActuator']},
|
'setSubject': {(replaceSimpleSetter, 'subject'): ['KX_NetworkMessageActuator']},
|
||||||
'setSubjectFilterText': {(replaceSimpleSetter, 'subject'): ['KX_NetworkMessageSensor']},
|
'setSubjectFilterText': {(replaceSimpleSetter, 'subject'): ['KX_NetworkMessageSensor']},
|
||||||
@@ -493,8 +597,28 @@ attributeRenameDict = {
|
|||||||
'setUsePosPulseMode': {(replaceSimpleSetter, 'usePosPulseMode'): ['SCA_ISensor']},
|
'setUsePosPulseMode': {(replaceSimpleSetter, 'usePosPulseMode'): ['SCA_ISensor']},
|
||||||
'setUseRestart': {(replaceSimpleSetter, 'useRestart'): ['KX_SceneActuator']},
|
'setUseRestart': {(replaceSimpleSetter, 'useRestart'): ['KX_SceneActuator']},
|
||||||
'setValue': {(replaceSimpleSetter, 'value'): ['SCA_PropertySensor', 'SCA_PropertyActuator']},
|
'setValue': {(replaceSimpleSetter, 'value'): ['SCA_PropertySensor', 'SCA_PropertyActuator']},
|
||||||
'setVelocity': {(replaceSimpleSetter, 'velocity'): ['KX_SoundActuator']},
|
|
||||||
'setXY': {(replaceSimpleSetter, 'useXY'): ['KX_CameraActuator']}
|
'setXY': {(replaceSimpleSetter, 'useXY'): ['KX_CameraActuator']}
|
||||||
|
|
||||||
|
# Unimplemented!
|
||||||
|
#'getLinearVelocity': {(replaceSimpleGetter, 'linearVelocity'): ['KX_SCA_AddObjectActuator']},
|
||||||
|
#'setLinearVelocity': {(replaceSimpleSetter, 'linearVelocity'): ['KX_SCA_AddObjectActuator']},
|
||||||
|
#'getAngularVelocity': {(replaceSimpleGetter, 'angularVelocity'): ['KX_SCA_AddObjectActuator']},
|
||||||
|
#'setAngularVelocity': {(replaceSimpleSetter, 'angularVelocity'): ['KX_SCA_AddObjectActuator']},
|
||||||
|
#'setAction': {(replaceSimpleSetter, 'action'): ['BL_ShapeActionActuator', 'BL_ActionActuator']},
|
||||||
|
#'set': {(replaceSimpleSetter, 'visibility'): ['KX_VisibilityActuator']},
|
||||||
|
#'getIndex': {(replaceSimpleGetter, 'index'): ['SCA_JoystickSensor']},
|
||||||
|
#'getMesh': {(replaceSimpleGetter, 'mesh'): ['KX_SCA_ReplaceMeshActuator']},
|
||||||
|
#'getObject': {(replaceSimpleGetter, 'object'): ['KX_SCA_AddObjectActuator',
|
||||||
|
# 'KX_CameraActuator',
|
||||||
|
# 'KX_TrackToActuator',
|
||||||
|
# 'KX_ParentActuator']},
|
||||||
|
#'setIndex': {(replaceSimpleSetter, 'index'): ['SCA_JoystickSensor']},
|
||||||
|
#'setObject': {(replaceSimpleSetter, 'object'): ['KX_SCA_AddObjectActuator',
|
||||||
|
# 'KX_CameraActuator',
|
||||||
|
# 'KX_TrackToActuator',
|
||||||
|
# 'KX_ParentActuator']},
|
||||||
|
#'setOperation': {(replaceSimpleSetter, 'mode'): ['KX_SCA_DynamicActuator'],
|
||||||
|
# (replaceSimpleSetter, 'operation'): ['KX_StateActuator']},
|
||||||
}
|
}
|
||||||
|
|
||||||
def convert248to249(lines, log = True, logErrors = True):
|
def convert248to249(lines, log = True, logErrors = True):
|
||||||
@@ -629,26 +753,41 @@ def runAsTextPlugin():
|
|||||||
from Blender import Window, sys, Draw
|
from Blender import Window, sys, Draw
|
||||||
import BPyTextPlugin, bpy
|
import BPyTextPlugin, bpy
|
||||||
|
|
||||||
# Gets the active text object, there can be many in one blend file.
|
message = ("Convert Game Engine script from 4.48 API to 2.49 API%t|"
|
||||||
txt = bpy.data.texts.active
|
"Run on active script only%x1|"
|
||||||
|
"Run on ALL text buffers%x2")
|
||||||
# Silently return if the script has been run with no active text
|
convertAllBuffers = Draw.PupMenu(message) == 2
|
||||||
if not txt:
|
|
||||||
return
|
|
||||||
|
|
||||||
Window.WaitCursor(1)
|
Window.WaitCursor(1)
|
||||||
try:
|
try:
|
||||||
lines = txt.asLines()
|
nconverted = 0
|
||||||
for i in range(0, len(lines)):
|
nerrors = 0
|
||||||
if not lines[i].endswith('\n'):
|
|
||||||
lines[i] = lines[i] + '\n'
|
|
||||||
|
|
||||||
nconverted, nerrors = convert248to249(lines)
|
if convertAllBuffers:
|
||||||
|
texts = bpy.data.texts
|
||||||
|
else:
|
||||||
|
if not bpy.data.texts.active:
|
||||||
|
Draw.PupMenu("No active buffer.")
|
||||||
|
return
|
||||||
|
texts = [bpy.data.texts.active]
|
||||||
|
|
||||||
Blender.SaveUndoState('Convert GE 249')
|
Blender.SaveUndoState('Convert BGE 2.49')
|
||||||
txt.clear()
|
|
||||||
for line in lines:
|
for txt in texts:
|
||||||
txt.write(line)
|
lines = txt.asLines()
|
||||||
|
for i in range(0, len(lines)):
|
||||||
|
if not lines[i].endswith('\n'):
|
||||||
|
lines[i] = lines[i] + '\n'
|
||||||
|
|
||||||
|
nc, ne = convert248to249(lines)
|
||||||
|
nconverted = nconverted + nc
|
||||||
|
nerrors = nerrors + ne
|
||||||
|
txt.clear()
|
||||||
|
for line in lines:
|
||||||
|
txt.write(line)
|
||||||
|
|
||||||
|
finally:
|
||||||
|
Window.WaitCursor(0)
|
||||||
|
|
||||||
message = "Converted %d attributes." % nconverted
|
message = "Converted %d attributes." % nconverted
|
||||||
if nerrors == 1:
|
if nerrors == 1:
|
||||||
@@ -657,9 +796,6 @@ def runAsTextPlugin():
|
|||||||
message = message + " There were %d errors (see console)." % nerrors
|
message = message + " There were %d errors (see console)." % nerrors
|
||||||
message = message + "|Please review all the changes."
|
message = message + "|Please review all the changes."
|
||||||
Draw.PupMenu(message)
|
Draw.PupMenu(message)
|
||||||
|
|
||||||
finally:
|
|
||||||
Window.WaitCursor(0)
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -2561,6 +2561,7 @@ class KX_NetworkMessageActuator(SCA_IActuator):
|
|||||||
@ivar usePropBody: Send a property instead of a regular body message.
|
@ivar usePropBody: Send a property instead of a regular body message.
|
||||||
@type usePropBody: boolean
|
@type usePropBody: boolean
|
||||||
"""
|
"""
|
||||||
|
#{Deprecated
|
||||||
def setToPropName(name):
|
def setToPropName(name):
|
||||||
"""
|
"""
|
||||||
Messages will only be sent to objects with the given property name.
|
Messages will only be sent to objects with the given property name.
|
||||||
@@ -2592,6 +2593,7 @@ class KX_NetworkMessageActuator(SCA_IActuator):
|
|||||||
@param body: if the body type is True, this is the name of the property to send.
|
@param body: if the body type is True, this is the name of the property to send.
|
||||||
if the body type is False, this is the text to send.
|
if the body type is False, this is the text to send.
|
||||||
"""
|
"""
|
||||||
|
#}
|
||||||
|
|
||||||
class KX_NetworkMessageSensor(SCA_ISensor):
|
class KX_NetworkMessageSensor(SCA_ISensor):
|
||||||
"""
|
"""
|
||||||
@@ -2609,8 +2611,7 @@ class KX_NetworkMessageSensor(SCA_ISensor):
|
|||||||
@ivar bodies: The list of message bodies received. (Read-only)
|
@ivar bodies: The list of message bodies received. (Read-only)
|
||||||
@type bodies: list of strings
|
@type bodies: list of strings
|
||||||
"""
|
"""
|
||||||
|
#{ Deprecated
|
||||||
|
|
||||||
def setSubjectFilterText(subject):
|
def setSubjectFilterText(subject):
|
||||||
"""
|
"""
|
||||||
Change the message subject text that this sensor is listening to.
|
Change the message subject text that this sensor is listening to.
|
||||||
@@ -2648,6 +2649,7 @@ class KX_NetworkMessageSensor(SCA_ISensor):
|
|||||||
@deprecated: Use the L{subjects} attribute instead.
|
@deprecated: Use the L{subjects} attribute instead.
|
||||||
@rtype: list
|
@rtype: list
|
||||||
"""
|
"""
|
||||||
|
#}
|
||||||
|
|
||||||
class KX_ObjectActuator(SCA_IActuator):
|
class KX_ObjectActuator(SCA_IActuator):
|
||||||
"""
|
"""
|
||||||
@@ -3431,8 +3433,7 @@ class KX_RadarSensor(KX_NearSensor):
|
|||||||
KX_RADAR_AXIS_POS_X, KX_RADAR_AXIS_POS_Y, KX_RADAR_AXIS_POS_Z,
|
KX_RADAR_AXIS_POS_X, KX_RADAR_AXIS_POS_Y, KX_RADAR_AXIS_POS_Z,
|
||||||
KX_RADAR_AXIS_NEG_X, KX_RADAR_AXIS_NEG_Y, KX_RADAR_AXIS_NEG_Z
|
KX_RADAR_AXIS_NEG_X, KX_RADAR_AXIS_NEG_Y, KX_RADAR_AXIS_NEG_Z
|
||||||
"""
|
"""
|
||||||
|
#{Deprecated
|
||||||
|
|
||||||
#--The following methods are deprecated, please use properties instead.
|
#--The following methods are deprecated, please use properties instead.
|
||||||
def getConeOrigin():
|
def getConeOrigin():
|
||||||
"""
|
"""
|
||||||
@@ -3450,6 +3451,7 @@ class KX_RadarSensor(KX_NearSensor):
|
|||||||
@deprecated: Use the L{coneTarget} property.
|
@deprecated: Use the L{coneTarget} property.
|
||||||
@rtype: list [x, y, z]
|
@rtype: list [x, y, z]
|
||||||
"""
|
"""
|
||||||
|
#}
|
||||||
|
|
||||||
def getConeHeight():
|
def getConeHeight():
|
||||||
"""
|
"""
|
||||||
@@ -3521,7 +3523,7 @@ class KX_SCA_AddObjectActuator(SCA_IActuator):
|
|||||||
@type object: KX_GameObject or None
|
@type object: KX_GameObject or None
|
||||||
@ivar objectLastCreated: the last added object from this actuator (read-only).
|
@ivar objectLastCreated: the last added object from this actuator (read-only).
|
||||||
@type objectLastCreated: KX_GameObject or None
|
@type objectLastCreated: KX_GameObject or None
|
||||||
@ivar time: the lifetime of added objects, in frames.
|
@ivar time: the lifetime of added objects, in frames. Set to 0 to disable automatic deletion.
|
||||||
@type time: integer
|
@type time: integer
|
||||||
@ivar linearVelocity: the initial linear velocity of added objects.
|
@ivar linearVelocity: the initial linear velocity of added objects.
|
||||||
@type linearVelocity: list [vx, vy, vz]
|
@type linearVelocity: list [vx, vy, vz]
|
||||||
@@ -3535,6 +3537,7 @@ class KX_SCA_AddObjectActuator(SCA_IActuator):
|
|||||||
|
|
||||||
C{ERROR: GameObject I{OBName} has a AddObjectActuator I{ActuatorName} without object (in 'nonactive' layer)}
|
C{ERROR: GameObject I{OBName} has a AddObjectActuator I{ActuatorName} without object (in 'nonactive' layer)}
|
||||||
"""
|
"""
|
||||||
|
#{Deprecated
|
||||||
def setObject(object):
|
def setObject(object):
|
||||||
"""
|
"""
|
||||||
Sets the game object to add.
|
Sets the game object to add.
|
||||||
@@ -3622,6 +3625,7 @@ class KX_SCA_AddObjectActuator(SCA_IActuator):
|
|||||||
@rtype: L{KX_GameObject}
|
@rtype: L{KX_GameObject}
|
||||||
@return: A L{KX_GameObject} or None if no object has been created.
|
@return: A L{KX_GameObject} or None if no object has been created.
|
||||||
"""
|
"""
|
||||||
|
#}
|
||||||
def instantAddObject():
|
def instantAddObject():
|
||||||
"""
|
"""
|
||||||
Returns the last object created by this actuator. The object can then be accessed from L{objectLastCreated}.
|
Returns the last object created by this actuator. The object can then be accessed from L{objectLastCreated}.
|
||||||
@@ -3920,32 +3924,31 @@ class KX_SoundActuator(SCA_IActuator):
|
|||||||
the actuator to be activated - they act instantly provided that the actuator has
|
the actuator to be activated - they act instantly provided that the actuator has
|
||||||
been activated once at least.
|
been activated once at least.
|
||||||
|
|
||||||
@ivar fileName: Sets the filename of the sound this actuator plays.
|
@ivar fileName: The filename of the sound this actuator plays.
|
||||||
@type fileName: string
|
@type fileName: string
|
||||||
|
|
||||||
@ivar volume: Sets the volume (gain) of the sound.
|
@ivar volume: The volume (gain) of the sound.
|
||||||
@type volume: float
|
@type volume: float
|
||||||
|
|
||||||
@ivar pitch: Sets the pitch of the sound.
|
@ivar pitch: The pitch of the sound.
|
||||||
@type pitch: float
|
@type pitch: float
|
||||||
|
|
||||||
@ivar rollOffFactor: Sets the roll off factor. Rolloff defines the rate of attenuation as the sound gets further away.
|
@ivar rollOffFactor: The roll off factor. Rolloff defines the rate of attenuation as the sound gets further away.
|
||||||
@type rollOffFactor: float
|
@type rollOffFactor: float
|
||||||
|
|
||||||
@ivar looping: Sets the loop mode of the actuator.
|
@ivar looping: The loop mode of the actuator.
|
||||||
@type looping: integer
|
@type looping: integer
|
||||||
|
|
||||||
@ivar position: Sets the position of the sound.
|
@ivar position: The position of the sound as a list: [x, y, z].
|
||||||
@type position: float array
|
@type position: float array
|
||||||
|
|
||||||
@ivar velocity: Sets the speed of the sound; The speed of the sound alter the pitch.
|
@ivar velocity: The velocity of the emitter as a list: [x, y, z]. The relative velocity to the observer determines the pitch. List of 3 floats: [x, y, z].
|
||||||
@type velocity: float array
|
@type velocity: float array
|
||||||
|
|
||||||
@ivar orientation: Sets the orientation of the sound. When setting the orientation you can
|
@ivar orientation: The orientation of the sound. When setting the orientation you can also use quaternion [float,float,float,float] or euler angles [float,float,float]
|
||||||
also use quaternion [float,float,float,float] or euler angles [float,float,float]
|
|
||||||
@type orientation: 3x3 matrix [[float]]
|
@type orientation: 3x3 matrix [[float]]
|
||||||
|
|
||||||
@ivar mode: Sets the operation mode of the actuator. You can use one of the following constant:
|
@ivar mode: The operation mode of the actuator. You can use one of the following constants:
|
||||||
- KX_SOUNDACT_PLAYSTOP (1)
|
- KX_SOUNDACT_PLAYSTOP (1)
|
||||||
- KX_SOUNDACT_PLAYEND (2)
|
- KX_SOUNDACT_PLAYEND (2)
|
||||||
- KX_SOUNDACT_LOOPSTOP (3)
|
- KX_SOUNDACT_LOOPSTOP (3)
|
||||||
@@ -4057,7 +4060,7 @@ class KX_SoundActuator(SCA_IActuator):
|
|||||||
"""
|
"""
|
||||||
Sets the position this sound will come from.
|
Sets the position this sound will come from.
|
||||||
|
|
||||||
@deprecated: Use the L{localPosition} attribute instead.
|
@deprecated: Use the L{position} attribute instead.
|
||||||
@type x: float
|
@type x: float
|
||||||
@param x: The x coordinate of the sound.
|
@param x: The x coordinate of the sound.
|
||||||
@type y: float
|
@type y: float
|
||||||
@@ -4605,6 +4608,7 @@ class SCA_ActuatorSensor(SCA_ISensor):
|
|||||||
@ivar actuator: the name of the actuator that the sensor is monitoring.
|
@ivar actuator: the name of the actuator that the sensor is monitoring.
|
||||||
@type actuator: string
|
@type actuator: string
|
||||||
"""
|
"""
|
||||||
|
#{Deprecated
|
||||||
def getActuator():
|
def getActuator():
|
||||||
"""
|
"""
|
||||||
Return the Actuator with which the sensor operates.
|
Return the Actuator with which the sensor operates.
|
||||||
@@ -4621,6 +4625,7 @@ class SCA_ActuatorSensor(SCA_ISensor):
|
|||||||
@param name: actuator name
|
@param name: actuator name
|
||||||
@type name: string
|
@type name: string
|
||||||
"""
|
"""
|
||||||
|
#}
|
||||||
|
|
||||||
class SCA_AlwaysSensor(SCA_ISensor):
|
class SCA_AlwaysSensor(SCA_ISensor):
|
||||||
"""
|
"""
|
||||||
@@ -4649,6 +4654,7 @@ class SCA_DelaySensor(SCA_ISensor):
|
|||||||
@ivar repeat: 1 if the OFF-ON cycle should be repeated indefinately, 0 if it should run once.
|
@ivar repeat: 1 if the OFF-ON cycle should be repeated indefinately, 0 if it should run once.
|
||||||
@type repeat: integer
|
@type repeat: integer
|
||||||
"""
|
"""
|
||||||
|
#{Deprecated
|
||||||
def setDelay(delay):
|
def setDelay(delay):
|
||||||
"""
|
"""
|
||||||
Set the initial delay before the positive trigger.
|
Set the initial delay before the positive trigger.
|
||||||
@@ -4695,6 +4701,7 @@ class SCA_DelaySensor(SCA_ISensor):
|
|||||||
@deprecated: Use the L{repeat} attribute instead.
|
@deprecated: Use the L{repeat} attribute instead.
|
||||||
@rtype: KX_TRUE or KX_FALSE
|
@rtype: KX_TRUE or KX_FALSE
|
||||||
"""
|
"""
|
||||||
|
#}
|
||||||
|
|
||||||
class SCA_JoystickSensor(SCA_ISensor):
|
class SCA_JoystickSensor(SCA_ISensor):
|
||||||
"""
|
"""
|
||||||
@@ -4748,6 +4755,7 @@ class SCA_JoystickSensor(SCA_ISensor):
|
|||||||
@type buttonIndex: integer
|
@type buttonIndex: integer
|
||||||
@rtype: bool
|
@rtype: bool
|
||||||
"""
|
"""
|
||||||
|
#{Deprecated
|
||||||
def getIndex():
|
def getIndex():
|
||||||
"""
|
"""
|
||||||
Returns the joystick index to use (from 1 to 8).
|
Returns the joystick index to use (from 1 to 8).
|
||||||
@@ -4786,7 +4794,7 @@ class SCA_JoystickSensor(SCA_ISensor):
|
|||||||
"""
|
"""
|
||||||
Returns the state of the joysticks axis. See differs to L{getAxis()<SCA_JoystickSensor.getAxis>} returning the current state of the joystick.
|
Returns the state of the joysticks axis. See differs to L{getAxis()<SCA_JoystickSensor.getAxis>} returning the current state of the joystick.
|
||||||
|
|
||||||
@deprecated: Use the L{axisSingle} attribute instead.
|
@deprecated: Use the L{axisValues} attribute instead.
|
||||||
@rtype: list
|
@rtype: list
|
||||||
@return: 4 values, each spesifying the value of an axis between -32767 and 32767 depending on how far the axis is pushed, 0 for nothing.
|
@return: 4 values, each spesifying the value of an axis between -32767 and 32767 depending on how far the axis is pushed, 0 for nothing.
|
||||||
|
|
||||||
@@ -4876,6 +4884,7 @@ class SCA_JoystickSensor(SCA_ISensor):
|
|||||||
@deprecated: Use the L{connected} attribute instead.
|
@deprecated: Use the L{connected} attribute instead.
|
||||||
@rtype: bool
|
@rtype: bool
|
||||||
"""
|
"""
|
||||||
|
#}
|
||||||
|
|
||||||
class SCA_KeyboardSensor(SCA_ISensor):
|
class SCA_KeyboardSensor(SCA_ISensor):
|
||||||
"""
|
"""
|
||||||
@@ -4917,7 +4926,7 @@ class SCA_KeyboardSensor(SCA_ISensor):
|
|||||||
@param keycode: The code that represents the key you want to get the state of
|
@param keycode: The code that represents the key you want to get the state of
|
||||||
"""
|
"""
|
||||||
|
|
||||||
#--The following methods are DEPRECATED--
|
#{Deprecated
|
||||||
def getKey():
|
def getKey():
|
||||||
"""
|
"""
|
||||||
Returns the key code this sensor is looking for.
|
Returns the key code this sensor is looking for.
|
||||||
@@ -4981,6 +4990,7 @@ class SCA_KeyboardSensor(SCA_ISensor):
|
|||||||
@deprecated: Use the L{events} attribute instead.
|
@deprecated: Use the L{events} attribute instead.
|
||||||
@rtype: list of key status. [[keycode, status]]
|
@rtype: list of key status. [[keycode, status]]
|
||||||
"""
|
"""
|
||||||
|
#}
|
||||||
|
|
||||||
class SCA_NANDController(SCA_IController):
|
class SCA_NANDController(SCA_IController):
|
||||||
"""
|
"""
|
||||||
@@ -5023,7 +5033,7 @@ class SCA_PropertyActuator(SCA_IActuator):
|
|||||||
|
|
||||||
If there is no property of this name, the call is ignored.
|
If there is no property of this name, the call is ignored.
|
||||||
|
|
||||||
@deprecated: Use the L{property} attribute instead.
|
@deprecated: Use the L{propName} attribute instead.
|
||||||
@type prop: string
|
@type prop: string
|
||||||
@param prop: The name of the property to set.
|
@param prop: The name of the property to set.
|
||||||
"""
|
"""
|
||||||
@@ -5031,7 +5041,7 @@ class SCA_PropertyActuator(SCA_IActuator):
|
|||||||
"""
|
"""
|
||||||
Returns the name of the property on which to operate.
|
Returns the name of the property on which to operate.
|
||||||
|
|
||||||
@deprecated: Use the L{property} attribute instead.
|
@deprecated: Use the L{propName} attribute instead.
|
||||||
@rtype: string
|
@rtype: string
|
||||||
"""
|
"""
|
||||||
def setValue(value):
|
def setValue(value):
|
||||||
@@ -5132,7 +5142,7 @@ class SCA_PythonController(SCA_IController):
|
|||||||
Properties:
|
Properties:
|
||||||
|
|
||||||
@ivar script: the Python script this controller executes
|
@ivar script: the Python script this controller executes
|
||||||
@type script: string, read-only
|
@type script: string
|
||||||
|
|
||||||
@group Deprecated: getScript, setScript
|
@group Deprecated: getScript, setScript
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user