Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/blender/blender_python.cpp
| Show First 20 Lines • Show All 256 Lines • ▼ Show 20 Lines | static PyObject *render_func(PyObject * /*self*/, PyObject *args) | ||||
| session->render(b_depsgraph); | session->render(b_depsgraph); | ||||
| 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) | |||||
| { | |||||
| PyObject *pysession, *pygraph, *sima; | |||||
| if (!PyArg_ParseTuple(args, "OOO", &pysession, &pygraph, &sima)) { | |||||
| return nullptr; | |||||
| } | |||||
| BlenderSession *session = (BlenderSession *)PyLong_AsVoidPtr(pysession); | |||||
| if (PyLong_AsVoidPtr(sima)) { | |||||
| /* 3d view drawing */ | |||||
| int viewport[4]; | |||||
| glGetIntegerv(GL_VIEWPORT, viewport); | |||||
| session->draw(viewport[2], viewport[3]); | |||||
| } | |||||
| 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; | ||||
| const char *pass_type; | const char *pass_type; | ||||
| int pass_filter, width, height; | int pass_filter, width, height; | ||||
| if (!PyArg_ParseTuple(args, | if (!PyArg_ParseTuple(args, | ||||
| ▲ Show 20 Lines • Show All 662 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static PyMethodDef methods[] = { | static PyMethodDef methods[] = { | ||||
| {"init", init_func, METH_VARARGS, ""}, | {"init", init_func, METH_VARARGS, ""}, | ||||
| {"exit", exit_func, METH_VARARGS, ""}, | {"exit", exit_func, METH_VARARGS, ""}, | ||||
| {"create", create_func, METH_VARARGS, ""}, | {"create", create_func, METH_VARARGS, ""}, | ||||
| {"free", free_func, METH_O, ""}, | {"free", free_func, METH_O, ""}, | ||||
| {"render", render_func, METH_VARARGS, ""}, | {"render", render_func, METH_VARARGS, ""}, | ||||
| {"draw", draw_func, METH_VARARGS, ""}, | |||||
| {"bake", bake_func, METH_VARARGS, ""}, | {"bake", bake_func, METH_VARARGS, ""}, | ||||
| {"view_draw", view_draw_func, METH_VARARGS, ""}, | {"view_draw", view_draw_func, METH_VARARGS, ""}, | ||||
| {"sync", sync_func, METH_VARARGS, ""}, | {"sync", sync_func, METH_VARARGS, ""}, | ||||
| {"reset", reset_func, METH_VARARGS, ""}, | {"reset", reset_func, METH_VARARGS, ""}, | ||||
| #ifdef WITH_OSL | #ifdef WITH_OSL | ||||
| {"osl_update_node", osl_update_node_func, METH_VARARGS, ""}, | {"osl_update_node", osl_update_node_func, METH_VARARGS, ""}, | ||||
| {"osl_compile", osl_compile_func, METH_VARARGS, ""}, | {"osl_compile", osl_compile_func, METH_VARARGS, ""}, | ||||
| #endif | #endif | ||||
| ▲ Show 20 Lines • Show All 88 Lines • Show Last 20 Lines | |||||