About
The Python module allows to execute Python source code. This can be standard Python as well as the classes included in the "c4d" and "maxon" module.
The module's API is defined in the python.framework as well as lib_py.h.
Classes and Functions
Example Code
#include "lib_py.h"
{
const maxon::VirtualMachineScopeRef scope = vm.CreateScope()
iferr_return;
{
const String errorMessage =
"Error on Init()"_s;
}
if (doc != nullptr)
{
auto python = maxon::Cast<maxon::py::CPythonLibraryRef>(vm.GetLibraryRef());
PythonLibrary pyLib;
auto* pyObjectDoc = pyLib.ReturnGeListNode(doc, false);
if (pyObjectDoc == nullptr)
python.CPy_Decref(pyDoc);
auto* pyObjectOp = op ? pyLib.ReturnGeListNode(op, false) : pyLib.ReturnPyNone();
if (pyObjectOp == nullptr)
python.CPy_Decref(pyOp);
}
{
const String errorMessage =
"Error on Execute()"_s;
}
}
void StopAllThreads(void)
Definition: c4d_basedocument.h:498
BaseObject * GetActiveObject(void)
Definition: c4d_baseobject.h:225
Definition: c4d_string.h:39
Definition: datatypebase.h:1179
Definition: string.h:1226
Bool IsEmpty() const
Definition: string.h:1431
return OK
Definition: apibase.h:2620
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67
#define iferr(...)
Definition: errorbase.h:388
@ PRINT
Any thrown exception will be handled internally.
#define iferr_scope
Definition: resultbase.h:1374
#define iferr_return
Definition: resultbase.h:1465
Definition: cpython.h:2856
Definition: cpython_raw.h:239
#define MAXON_CPYTHON3VM()
Definition: vm.h:472