Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/blender/blender_python.cpp
| Show First 20 Lines • Show All 182 Lines • ▼ Show 20 Lines | static PyObject *render_func(PyObject * /*self*/, PyObject *value) | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| /* pixel_array and result passed as pointers */ | /* pixel_array and result passed as pointers */ | ||||
| static PyObject *bake_func(PyObject * /*self*/, PyObject *args) | static PyObject *bake_func(PyObject * /*self*/, PyObject *args) | ||||
| { | { | ||||
| PyObject *pysession, *pyobject; | PyObject *pysession, *pyobject; | ||||
| PyObject *pypixel_array, *pyresult; | PyObject *pypixel_array, *pyresult; | ||||
| PyObject *pymatrix; | |||||
| const char *pass_type; | const char *pass_type; | ||||
| int num_pixels, depth, object_id; | int num_pixels, depth, object_id; | ||||
| if(!PyArg_ParseTuple(args, "OOsiOiiO", &pysession, &pyobject, &pass_type, &object_id, &pypixel_array, &num_pixels, &depth, &pyresult)) | if(!PyArg_ParseTuple(args, "OOsiOiiOO", &pysession, &pyobject, &pass_type, &object_id, &pypixel_array, | ||||
| &num_pixels, &depth, &pymatrix, &pyresult)) | |||||
| return NULL; | return NULL; | ||||
| BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession); | BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession); | ||||
| PointerRNA objectptr; | PointerRNA objectptr; | ||||
| RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pyobject), &objectptr); | RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pyobject), &objectptr); | ||||
| BL::Object b_object(objectptr); | BL::Object b_object(objectptr); | ||||
| void *b_matrix = PyLong_AsVoidPtr(pymatrix); | |||||
| void *b_result = PyLong_AsVoidPtr(pyresult); | void *b_result = PyLong_AsVoidPtr(pyresult); | ||||
| PointerRNA bakepixelptr; | PointerRNA bakepixelptr; | ||||
| RNA_pointer_create(NULL, &RNA_BakePixel, PyLong_AsVoidPtr(pypixel_array), &bakepixelptr); | RNA_pointer_create(NULL, &RNA_BakePixel, PyLong_AsVoidPtr(pypixel_array), &bakepixelptr); | ||||
| BL::BakePixel b_bake_pixel(bakepixelptr); | BL::BakePixel b_bake_pixel(bakepixelptr); | ||||
| python_thread_state_save(&session->python_thread_state); | python_thread_state_save(&session->python_thread_state); | ||||
| session->bake(b_object, pass_type, object_id, b_bake_pixel, (size_t)num_pixels, depth, (float *)b_result); | session->bake(b_object, pass_type, object_id, b_bake_pixel, (size_t)num_pixels, depth, b_matrix ? (BL::Array<float, 16>*)b_matrix : NULL, (float *)b_result); | ||||
| python_thread_state_restore(&session->python_thread_state); | python_thread_state_restore(&session->python_thread_state); | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| static PyObject *draw_func(PyObject * /*self*/, PyObject *args) | static PyObject *draw_func(PyObject * /*self*/, PyObject *args) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 400 Lines • Show Last 20 Lines | |||||