[Bf-blender-cvs] [e2d8b6dc063] master: gpu.types.GPUBatch: warn about deprecated primitive types

Germano Cavalcante noreply at git.blender.org
Thu Apr 21 17:53:12 CEST 2022


Commit: e2d8b6dc0633807b0f6864d6d0972e702813c33e
Author: Germano Cavalcante
Date:   Thu Apr 21 12:40:30 2022 -0300
Branches: master
https://developer.blender.org/rBe2d8b6dc0633807b0f6864d6d0972e702813c33e

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

===================================================================

M	source/blender/python/gpu/gpu_py_batch.c

===================================================================

diff --git a/source/blender/python/gpu/gpu_py_batch.c b/source/blender/python/gpu/gpu_py_batch.c
index 232d4775746..02bcf80aa5d 100644
--- a/source/blender/python/gpu/gpu_py_batch.c
+++ b/source/blender/python/gpu/gpu_py_batch.c
@@ -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);



More information about the Bf-blender-cvs mailing list