diff options
Diffstat (limited to 'source/blender/python/gpu/gpu_py_batch.c')
-rw-r--r-- | source/blender/python/gpu/gpu_py_batch.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/python/gpu/gpu_py_batch.c b/source/blender/python/gpu/gpu_py_batch.c index 533e5154d83..a36b1dfd1b5 100644 --- a/source/blender/python/gpu/gpu_py_batch.c +++ b/source/blender/python/gpu/gpu_py_batch.c @@ -111,6 +111,7 @@ static PyObject *pygpu_batch__tp_new(PyTypeObject *UNUSED(type), PyObject *args, Py_INCREF(py_indexbuf); } + BLI_assert(!PyObject_GC_IsTracked((PyObject *)ret)); PyObject_GC_Track(ret); #endif @@ -127,7 +128,7 @@ PyDoc_STRVAR(pygpu_batch_vertbuf_add_doc, " vertex buffer for vertex positions and vertex normals.\n" " Current a batch can have at most " STRINGIFY(GPU_BATCH_VBO_MAX_LEN) " vertex buffers.\n" "\n" -" :param buf: The vertex buffer that will be added to the batch.\n" +" :arg buf: The vertex buffer that will be added to the batch.\n" " :type buf: :class:`gpu.types.GPUVertBuf`\n" ); static PyObject *pygpu_batch_vertbuf_add(BPyGPUBatch *self, BPyGPUVertBuf *py_buf) @@ -171,7 +172,7 @@ PyDoc_STRVAR( " This function does not need to be called when you always\n" " set the shader when calling :meth:`gpu.types.GPUBatch.draw`.\n" "\n" - " :param program: The program/shader the batch will use in future draw calls.\n" + " :arg program: The program/shader the batch will use in future draw calls.\n" " :type program: :class:`gpu.types.GPUShader`\n"); static PyObject *pygpu_batch_program_set(BPyGPUBatch *self, BPyGPUShader *py_shader) { @@ -209,7 +210,7 @@ PyDoc_STRVAR(pygpu_batch_draw_doc, "\n" " Run the drawing program with the parameters assigned to the batch.\n" "\n" - " :param program: Program that performs the drawing operations.\n" + " :arg program: Program that performs the drawing operations.\n" " If ``None`` is passed, the last program set to this batch will run.\n" " :type program: :class:`gpu.types.GPUShader`\n"); static PyObject *pygpu_batch_draw(BPyGPUBatch *self, PyObject *args) @@ -273,6 +274,11 @@ static int pygpu_batch__tp_clear(BPyGPUBatch *self) return 0; } +static int pygpu_batch__tp_is_gc(BPyGPUBatch *self) +{ + return self->references != NULL; +} + #endif static void pygpu_batch__tp_dealloc(BPyGPUBatch *self) @@ -313,6 +319,7 @@ PyTypeObject BPyGPUBatch_Type = { .tp_doc = pygpu_batch__tp_doc, .tp_traverse = (traverseproc)pygpu_batch__tp_traverse, .tp_clear = (inquiry)pygpu_batch__tp_clear, + .tp_is_gc = (inquiry)pygpu_batch__tp_is_gc, #else .tp_flags = Py_TPFLAGS_DEFAULT, #endif |