Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/blender/blender_python.cpp
| Show First 20 Lines • Show All 292 Lines • ▼ Show 20 Lines | static PyObject *render_func(PyObject * /*self*/, PyObject *args) | ||||
| 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, *pydepsgraph, *pyobject; | PyObject *pysession, *pydepsgraph, *pyobject; | ||||
| PyObject *pypixel_array, *pyresult; | |||||
| const char *pass_type; | const char *pass_type; | ||||
| int num_pixels, depth, object_id, pass_filter; | int pass_filter, width, height; | ||||
| if (!PyArg_ParseTuple(args, | if (!PyArg_ParseTuple(args, | ||||
| "OOOsiiOiiO", | "OOOsiii", | ||||
| &pysession, | &pysession, | ||||
| &pydepsgraph, | &pydepsgraph, | ||||
| &pyobject, | &pyobject, | ||||
| &pass_type, | &pass_type, | ||||
| &pass_filter, | &pass_filter, | ||||
| &object_id, | &width, | ||||
| &pypixel_array, | &height)) | ||||
| &num_pixels, | |||||
| &depth, | |||||
| &pyresult)) | |||||
| return NULL; | return NULL; | ||||
| BlenderSession *session = (BlenderSession *)PyLong_AsVoidPtr(pysession); | BlenderSession *session = (BlenderSession *)PyLong_AsVoidPtr(pysession); | ||||
| PointerRNA depsgraphptr; | PointerRNA depsgraphptr; | ||||
| RNA_pointer_create(NULL, &RNA_Depsgraph, PyLong_AsVoidPtr(pydepsgraph), &depsgraphptr); | RNA_pointer_create(NULL, &RNA_Depsgraph, PyLong_AsVoidPtr(pydepsgraph), &depsgraphptr); | ||||
| BL::Depsgraph b_depsgraph(depsgraphptr); | BL::Depsgraph b_depsgraph(depsgraphptr); | ||||
| 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_result = PyLong_AsVoidPtr(pyresult); | |||||
| PointerRNA bakepixelptr; | |||||
| RNA_pointer_create(NULL, &RNA_BakePixel, PyLong_AsVoidPtr(pypixel_array), &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_depsgraph, | session->bake(b_depsgraph, b_object, pass_type, pass_filter, width, height); | ||||
| b_object, | |||||
| pass_type, | |||||
| pass_filter, | |||||
| object_id, | |||||
| b_bake_pixel, | |||||
| (size_t)num_pixels, | |||||
| depth, | |||||
| (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 743 Lines • Show Last 20 Lines | |||||