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;
}
{
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;
}
}
Definition: c4d_basedocument.h:497
Definition: c4d_baseobject.h:248
Definition: c4d_string.h:39
Definition: datatypebase.h:1204
Definition: string.h:1235
Bool IsEmpty() const
Definition: string.h:1440
return OK
Definition: apibase.h:2747
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67
#define iferr(...)
Definition: errorbase.h:388
@ PRINT
Any thrown exception will be handled internally.
const char * doc
Definition: pyerrors.h:226
#define iferr_scope
Definition: resultbase.h:1386
#define iferr_return
Definition: resultbase.h:1521
PyObject * op
Definition: object.h:520
Definition: cpython.h:2914
Definition: cpython_raw.h:244
#define MAXON_CPYTHON3VM()
Definition: vm.h:471