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-29 13:22:24 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-05-29 13:22:24 +0400
commitedcb9f88635a130dbf342ce5203b5357e306577c (patch)
tree1078bca08e2bbbfa072a3379b2c3420d0062fa31 /source/gameengine/PyDoc
parent39177018af16b208e41714d454a44c58a2eea0b7 (diff)
workaround for strange python problem in the BGE and BPy API where printing warnings mistook the blender binary for a script - argv[0], Binary lines were printed into the console sometimes causing console beeps and corrupting future console output.
Internal texts file on disk is not used it seems python warnings dont support this (even though exceptions do). The most common cause of this is passing a float as an argument to a method that took an int. get around this by setting __file__ in the namespace to the script name before executing the script, the file lines are not found but at least the output is not weird and confusing. Added read only 'mode' attribute to the python controller so there is a way to tell if its executing a module or a script. Updated docs to better explain execution methods.
Diffstat (limited to 'source/gameengine/PyDoc')
-rw-r--r--source/gameengine/PyDoc/GameTypes.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/source/gameengine/PyDoc/GameTypes.py b/source/gameengine/PyDoc/GameTypes.py
index 4f176c17af2..4ab175a8f6c 100644
--- a/source/gameengine/PyDoc/GameTypes.py
+++ b/source/gameengine/PyDoc/GameTypes.py
@@ -5205,8 +5205,15 @@ class SCA_PythonController(SCA_IController):
Properties:
- @ivar script: the Python script this controller executes
+ @ivar script: The value of this variable depends on the execution methid.
+ - When 'Script' execution mode is set this value contains the entire python script as a single string (not the script name as you might expect) which can be modified to run different scripts.
+ - When 'Module' execution mode is set this value will contain a single line string - module name and function "module.func" or "package.modile.func" where the module names are python textblocks or external scripts.
+ note: once this is set the script name given for warnings will remain unchanged.
@type script: string
+ @ivar mode: the execution mode for this controller (read-only).
+ - Script: 0, Execite the L{script} as a python code.
+ - Module: 1, Execite the L{script} as a module and function.
+ @type mode: int
@group Deprecated: getScript, setScript
"""
@@ -5222,17 +5229,17 @@ class SCA_PythonController(SCA_IController):
"""
def getScript():
"""
- Gets the Python script this controller executes.
+ Gets the Python script body this controller executes.
@deprecated: Use the L{script} attribute instead.
@rtype: string
"""
- def setScript(script):
+ def setScript(script_body):
"""
- Sets the Python script this controller executes.
+ Sets the Python script string this controller executes.
@deprecated: Use the L{script} attribute instead.
- @type script: string.
+ @type script_body: string.
"""
class SCA_RandomActuator(SCA_IActuator):