gpu.types.GPUBatch: warn about deprecated primitive types

As `GPU_PRIM_LINE_LOOP` is not supported on Vulkan or Metal and
`GPU_PRIM_TRI_FAN` is not supported on Metal, they will be removed in
future releases.

So it is important to inform users that they are obsolete and may not
be supported for a long time.

Release Notes: https://wiki.blender.org/wiki/Reference/Release_Notes/3.2/Python_API

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D14679
This commit is contained in:
Germano Cavalcante 2022-04-21 12:40:30 -03:00 committed by Germano Cavalcante
parent f807e6effe
commit e2d8b6dc06
1 changed files with 12 additions and 0 deletions

View File

@ -82,6 +82,18 @@ static PyObject *pygpu_batch__tp_new(PyTypeObject *UNUSED(type), PyObject *args,
}
BLI_assert(prim_type.value_found != GPU_PRIM_NONE);
if (prim_type.value_found == GPU_PRIM_LINE_LOOP) {
PyErr_WarnEx(PyExc_DeprecationWarning,
"'LINE_LOOP' is deprecated. Please use 'LINE_STRIP' and close the segment.",
1);
}
else if (prim_type.value_found == GPU_PRIM_TRI_FAN) {
PyErr_WarnEx(
PyExc_DeprecationWarning,
"'TRI_FAN' is deprecated. Please use 'TRI_STRIP' or 'TRIS' and try modifying your "
"vertices or indices to match the topology.",
1);
}
if (py_vertbuf == NULL) {
PyErr_Format(PyExc_TypeError, exc_str_missing_arg, _keywords[1], 2);