Fix hydra API, incorrect Python API handling of invalid arguments
Exceptions must return nullptr, not None.
This commit is contained in:
parent
b086bd411e
commit
0f120b6364
|
@ -33,7 +33,7 @@ static PyObject *engine_create_func(PyObject * /*self*/, PyObject *args)
|
||||||
PyObject *pyengine;
|
PyObject *pyengine;
|
||||||
char *engine_type, *render_delegate_id;
|
char *engine_type, *render_delegate_id;
|
||||||
if (!PyArg_ParseTuple(args, "Oss", &pyengine, &engine_type, &render_delegate_id)) {
|
if (!PyArg_ParseTuple(args, "Oss", &pyengine, &engine_type, &render_delegate_id)) {
|
||||||
Py_RETURN_NONE;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderEngine *bl_engine = pyrna_to_pointer<RenderEngine>(pyengine, &RNA_RenderEngine);
|
RenderEngine *bl_engine = pyrna_to_pointer<RenderEngine>(pyengine, &RNA_RenderEngine);
|
||||||
|
@ -63,7 +63,7 @@ static PyObject *engine_free_func(PyObject * /*self*/, PyObject *args)
|
||||||
{
|
{
|
||||||
PyObject *pyengine;
|
PyObject *pyengine;
|
||||||
if (!PyArg_ParseTuple(args, "O", &pyengine)) {
|
if (!PyArg_ParseTuple(args, "O", &pyengine)) {
|
||||||
Py_RETURN_NONE;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Engine *engine = static_cast<Engine *>(PyLong_AsVoidPtr(pyengine));
|
Engine *engine = static_cast<Engine *>(PyLong_AsVoidPtr(pyengine));
|
||||||
|
@ -77,7 +77,7 @@ static PyObject *engine_update_func(PyObject * /*self*/, PyObject *args)
|
||||||
{
|
{
|
||||||
PyObject *pyengine, *pydepsgraph, *pycontext;
|
PyObject *pyengine, *pydepsgraph, *pycontext;
|
||||||
if (!PyArg_ParseTuple(args, "OOO", &pyengine, &pydepsgraph, &pycontext)) {
|
if (!PyArg_ParseTuple(args, "OOO", &pyengine, &pydepsgraph, &pycontext)) {
|
||||||
Py_RETURN_NONE;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Engine *engine = static_cast<Engine *>(PyLong_AsVoidPtr(pyengine));
|
Engine *engine = static_cast<Engine *>(PyLong_AsVoidPtr(pyengine));
|
||||||
|
@ -94,7 +94,7 @@ static PyObject *engine_render_func(PyObject * /*self*/, PyObject *args)
|
||||||
{
|
{
|
||||||
PyObject *pyengine;
|
PyObject *pyengine;
|
||||||
if (!PyArg_ParseTuple(args, "O", &pyengine)) {
|
if (!PyArg_ParseTuple(args, "O", &pyengine)) {
|
||||||
Py_RETURN_NONE;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Engine *engine = static_cast<Engine *>(PyLong_AsVoidPtr(pyengine));
|
Engine *engine = static_cast<Engine *>(PyLong_AsVoidPtr(pyengine));
|
||||||
|
@ -113,7 +113,7 @@ static PyObject *engine_view_draw_func(PyObject * /*self*/, PyObject *args)
|
||||||
{
|
{
|
||||||
PyObject *pyengine, *pycontext;
|
PyObject *pyengine, *pycontext;
|
||||||
if (!PyArg_ParseTuple(args, "OO", &pyengine, &pycontext)) {
|
if (!PyArg_ParseTuple(args, "OO", &pyengine, &pycontext)) {
|
||||||
Py_RETURN_NONE;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewportEngine *engine = static_cast<ViewportEngine *>(PyLong_AsVoidPtr(pyengine));
|
ViewportEngine *engine = static_cast<ViewportEngine *>(PyLong_AsVoidPtr(pyengine));
|
||||||
|
@ -152,7 +152,7 @@ static PyObject *engine_set_render_setting_func(PyObject * /*self*/, PyObject *a
|
||||||
PyObject *pyengine, *pyval;
|
PyObject *pyengine, *pyval;
|
||||||
char *key;
|
char *key;
|
||||||
if (!PyArg_ParseTuple(args, "OsO", &pyengine, &key, &pyval)) {
|
if (!PyArg_ParseTuple(args, "OsO", &pyengine, &key, &pyval)) {
|
||||||
Py_RETURN_NONE;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Engine *engine = static_cast<Engine *>(PyLong_AsVoidPtr(pyengine));
|
Engine *engine = static_cast<Engine *>(PyLong_AsVoidPtr(pyengine));
|
||||||
|
@ -167,7 +167,7 @@ static PyObject *cache_or_get_image_file_func(PyObject * /*self*/, PyObject *arg
|
||||||
{
|
{
|
||||||
PyObject *pycontext, *pyimage;
|
PyObject *pycontext, *pyimage;
|
||||||
if (!PyArg_ParseTuple(args, "OO", &pycontext, &pyimage)) {
|
if (!PyArg_ParseTuple(args, "OO", &pycontext, &pyimage)) {
|
||||||
Py_RETURN_NONE;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bContext *context = static_cast<bContext *>(PyLong_AsVoidPtr(pycontext));
|
bContext *context = static_cast<bContext *>(PyLong_AsVoidPtr(pycontext));
|
||||||
|
|
Loading…
Reference in New Issue