|
static const char * | GetVersion () |
| Get the version of the Python interpreter.
|
|
static const char * | GetPlatform () |
| Get the target platform of the Python interpreter.
|
|
static const char * | GetStdout (FBPythonContext *pPythonContext=NULL) |
| Get the value of stdout.
|
|
static const char * | GetStderr (FBPythonContext *pPythonContext=NULL) |
| Get the value of stderr.
|
|
static bool | ParseLine (const char *pLine, FBPythonContext *pPythonContext=NULL) |
| Submit a line of code for parsing.
|
|
static bool | EvalLine (FBPythonContext *pPythonContext=NULL) |
| Submit the last line (or last few lines) of code parsed for evaluation.
|
|
static bool | EvalLines (const char *pScript, FBPythonContext *pPythonContext=NULL) |
| Submit a script for parsing and execution.
|
|
static bool | EvalFile (const char *pFilename, FBPythonContext *pPythonContext=NULL) |
| Execute a python script file within the given context.
|
|
static bool | ExecuteScript (const char *pFilename, FBPythonContext *pPythonContext=nullptr) |
| Put a python script file in the execution queue to be executed on the next UI thread idle callback.
|
|
static bool | ClearContext (FBPythonContext *pPythonContext=NULL) |
| Clears the python context.
|
|
FBPython is for python users to run python script and communicate with MotionBuilder internal python facility.
A user FBPythonContext object should be created to make sure the stdout/stderr streams can be retrieved properly. If no user FBPythonContext object is passed to the various methods, the default Python Editor context will be used. Using the default context is not recommended with this class as the user might end up losing some stdout and stderr outputs.
Warning: When the user is calling the methods of FBPython in another thread other than MotionBuilder main thread, the user needs to create new thread state because Python internally prevents from illegal access to its internal Python objects if the current thread is not created by Python or has no thread state. In order to address this issue, the user could use the following workaround.
PyGILState_STATE gstate;
gstate = PyGILState_Ensure();
PyGILState_Release(gstate);
static bool EvalLine(FBPythonContext *pPythonContext=NULL)
Submit the last line (or last few lines) of code parsed for evaluation.
static bool ParseLine(const char *pLine, FBPythonContext *pPythonContext=NULL)
Submit a line of code for parsing.
PyGILState_Ensure will create a new thread state for current calling thread.
bool returnValue;
std::string str;
if( returnValue == false )
if( returnValue == false )
if( returnValue == false )
else
returnValue =
FBPython::EvalLines(
"def myPrintFunc2( pMyVar ):\n print( pMyVar )", &myContext );
if( returnValue == false )
if( returnValue == false )
else
if( returnValue == false )
else
if( returnValue == false )
else
static bool EvalFile(const char *pFilename, FBPythonContext *pPythonContext=NULL)
Execute a python script file within the given context.
static const char * GetStderr(FBPythonContext *pPythonContext=NULL)
Get the value of stderr.
static const char * GetStdout(FBPythonContext *pPythonContext=NULL)
Get the value of stdout.
static bool EvalLines(const char *pScript, FBPythonContext *pPythonContext=NULL)
Submit a script for parsing and execution.
Definition at line 150 of file fbpython.h.