diff options
Diffstat (limited to 'intern/cycles/blender/blender_python.cpp')
-rw-r--r-- | intern/cycles/blender/blender_python.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp index 8b04a869a85..658fccaf12e 100644 --- a/intern/cycles/blender/blender_python.cpp +++ b/intern/cycles/blender/blender_python.cpp @@ -147,6 +147,38 @@ static PyObject *render_func(PyObject *self, PyObject *value) Py_RETURN_NONE; } +/* pixel_array and result passed as pointers */ +static PyObject *bake_func(PyObject *self, PyObject *args) +{ + PyObject *pysession, *pyobject; + PyObject *pypixel_array, *pyresult; + const char *pass_type; + int num_pixels, depth; + + if(!PyArg_ParseTuple(args, "OOsOiiO", &pysession, &pyobject, &pass_type, &pypixel_array, &num_pixels, &depth, &pyresult)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + + BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession); + + PointerRNA objectptr; + RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pyobject), &objectptr); + BL::Object b_object(objectptr); + + void *b_result = PyLong_AsVoidPtr(pyresult); + + PointerRNA bakepixelptr; + RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pypixel_array), &bakepixelptr); + BL::BakePixel b_bake_pixel(bakepixelptr); + + session->bake(b_object, pass_type, b_bake_pixel, num_pixels, depth, (float *)b_result); + + Py_END_ALLOW_THREADS + + Py_RETURN_NONE; +} + static PyObject *draw_func(PyObject *self, PyObject *args) { PyObject *pysession, *pyv3d, *pyrv3d; @@ -418,6 +450,7 @@ static PyMethodDef methods[] = { {"create", create_func, METH_VARARGS, ""}, {"free", free_func, METH_O, ""}, {"render", render_func, METH_O, ""}, + {"bake", bake_func, METH_VARARGS, ""}, {"draw", draw_func, METH_VARARGS, ""}, {"sync", sync_func, METH_O, ""}, {"reset", reset_func, METH_VARARGS, ""}, |