13#include "../generic/py_capi_utils.hh"
18#include "RNA_prototypes.hh"
27 return (
ptr) ?
static_cast<T *
>(
ptr->data) :
nullptr;
33 char *engine_type, *render_delegate_id;
34 if (!PyArg_ParseTuple(args,
"Oss", &pyengine, &engine_type, &render_delegate_id)) {
43 if (
STREQ(engine_type,
"VIEWPORT")) {
46 else if (
STREQ(engine_type,
"PREVIEW")) {
50 engine =
new FinalEngine(bl_engine, render_delegate_id);
53 catch (std::runtime_error &
e) {
58 return PyLong_FromVoidPtr(engine);
64 if (!PyArg_ParseTuple(args,
"O", &pyengine)) {
68 Engine *engine =
static_cast<Engine *
>(PyLong_AsVoidPtr(pyengine));
77 PyObject *pyengine, *pydepsgraph, *pycontext;
78 if (!PyArg_ParseTuple(args,
"OOO", &pyengine, &pydepsgraph, &pycontext)) {
82 Engine *engine =
static_cast<Engine *
>(PyLong_AsVoidPtr(pyengine));
95 if (!PyArg_ParseTuple(args,
"O", &pyengine)) {
99 Engine *engine =
static_cast<Engine *
>(PyLong_AsVoidPtr(pyengine));
104 Py_BEGIN_ALLOW_THREADS;
106 Py_END_ALLOW_THREADS;
113 PyObject *pyengine, *pycontext;
114 if (!PyArg_ParseTuple(args,
"OO", &pyengine, &pycontext)) {
124 Py_BEGIN_ALLOW_THREADS;
126 Py_END_ALLOW_THREADS;
134 if (PyBool_Check(pyval)) {
135 val = Py_IsTrue(pyval);
137 else if (PyLong_Check(pyval)) {
138 val = PyLong_AsLong(pyval);
140 else if (PyFloat_Check(pyval)) {
141 val = PyFloat_AsDouble(pyval);
143 else if (PyUnicode_Check(pyval)) {
144 val = std::string(PyUnicode_AsUTF8(pyval));
151 PyObject *pyengine, *pyval;
153 if (!PyArg_ParseTuple(args,
"OsO", &pyengine, &key, &pyval)) {
157 Engine *engine =
static_cast<Engine *
>(PyLong_AsVoidPtr(pyengine));
167 PyObject *pycontext, *pyimage;
168 if (!PyArg_ParseTuple(args,
"OO", &pycontext, &pyimage)) {
173 Image *image =
static_cast<Image *
>(PyLong_AsVoidPtr(pyimage));
190 {
nullptr,
nullptr, 0,
nullptr},
193static PyModuleDef
module = {
211 PyObject *
mod = PyModule_Create(&blender::render::hydra::module);
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
#define CLOG_ERROR(clg_ref,...)
#define CLOG_DEBUG(clg_ref,...)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
BPy_StructRNA * depsgraph
const PointerRNA * pyrna_struct_as_ptr_or_null(PyObject *py_obj, const StructRNA *srna)
void sync(Depsgraph *depsgraph, bContext *context)
virtual void set_render_setting(const std::string &key, const pxr::VtValue &val)
VecBase< float, D > constexpr mod(VecOp< float, D >, VecOp< float, D >) RET
std::string cache_or_get_image_file(Main *bmain, Scene *scene, Image *image, ImageUser *iuser)
static pxr::VtValue get_setting_val(PyObject *pyval)
static PyObject * engine_view_draw_func(PyObject *, PyObject *args)
static PyObject * engine_set_render_setting_func(PyObject *, PyObject *args)
static PyObject * engine_free_func(PyObject *, PyObject *args)
static PyObject * engine_render_func(PyObject *, PyObject *args)
static PyObject * engine_update_func(PyObject *, PyObject *args)
static PyObject * cache_or_get_image_file_func(PyObject *, PyObject *args)
static PyObject * engine_create_func(PyObject *, PyObject *args)
struct CLG_LogRef * LOG_HYDRA_RENDER
T * pyrna_to_pointer(PyObject *pyobject, const StructRNA *rnatype)
static PyMethodDef methods[]
PyObject * PyC_UnicodeFromStdStr(const std::string &str)
PyObject * BPyInit_hydra()
static struct PyModuleDef module
static PyMethodDef methods[]