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);
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:1513
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.
#define iferr_scope
Definition: resultbase.h:1396
#define iferr_return
Definition: resultbase.h:1531
Definition: cpython.h:2920
Definition: cpython_raw.h:244
#define MAXON_CPYTHON3VM()
Definition: vm.h:471