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);
BaseObject*
op =
doc->GetActiveObject();
auto* pyObjectOp =
op ? pyLib.ReturnGeListNode(
op,
false) : pyLib.ReturnPyNone();
if (pyObjectOp == nullptr)
python.CPy_Decref(pyOp);
}
{
const String errorMessage = "Error on Execute()"_s;
}
}
Definition: datatypebase.h:1235
Definition: string.h:1287
Bool IsEmpty() const
Definition: string.h:1492
return OK
Definition: apibase.h:2771
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:69
#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:1396
#define iferr_return
Definition: resultbase.h:1531
PyObject * op
Definition: object.h:520
Definition: cpython.h:2920
Definition: cpython_raw.h:244
#define MAXON_CPYTHON3VM()
Definition: vm.h:471