Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-10-29 03:08:55 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-10-29 03:08:55 +0300
commitc750ebe113e70c6b7e9efad2219e12546519d44b (patch)
tree3204e8a0d519759c204e4941a2dfc8464ba856c5 /source/blender/python/gpu/gpu_py_vertex_buffer.c
parent02035c34b735990f3685950621eff24c25d0e91c (diff)
PyAPI: remove GPUVertFormat() creation from a list
We already have `attr_add` method, best not have two ways to do the same thing. See: D3830
Diffstat (limited to 'source/blender/python/gpu/gpu_py_vertex_buffer.c')
-rw-r--r--source/blender/python/gpu/gpu_py_vertex_buffer.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/source/blender/python/gpu/gpu_py_vertex_buffer.c b/source/blender/python/gpu/gpu_py_vertex_buffer.c
index 440cefe553e..1f888597b34 100644
--- a/source/blender/python/gpu/gpu_py_vertex_buffer.c
+++ b/source/blender/python/gpu/gpu_py_vertex_buffer.c
@@ -222,43 +222,23 @@ static int bpygpu_attr_fill(GPUVertBuf *buf, int id, PyObject *py_seq_data, cons
static PyObject *bpygpu_VertBuf_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
{
- const char *error_prefix = "GPUVertBuf.__new__";
-
struct {
PyObject *py_fmt;
uint len;
} params;
static const char *_keywords[] = {"format", "len", NULL};
- static _PyArg_Parser _parser = {"OI:GPUVertBuf.__new__", _keywords, 0};
+ static _PyArg_Parser _parser = {"O!I:GPUVertBuf.__new__", _keywords, 0};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kwds, &_parser,
- &params.py_fmt,
+ &BPyGPUVertFormat_Type, &params.py_fmt,
&params.len))
{
return NULL;
}
- GPUVertFormat *fmt, fmt_stack;
-
- if (BPyGPUVertFormat_Check(params.py_fmt)) {
- fmt = &((BPyGPUVertFormat *)params.py_fmt)->fmt;
- }
- else if (PyList_Check(params.py_fmt)) {
- fmt = &fmt_stack;
- GPU_vertformat_clear(fmt);
- if (!bpygpu_vertformat_from_PyList(
- (PyListObject *)params.py_fmt, error_prefix, fmt))
- {
- return NULL;
- }
- }
- else {
- PyErr_SetString(PyExc_TypeError, "format not understood");
- return NULL;
- }
-
- struct GPUVertBuf *vbo = GPU_vertbuf_create_with_format(fmt);
+ const GPUVertFormat *fmt = &((BPyGPUVertFormat *)params.py_fmt)->fmt;
+ GPUVertBuf *vbo = GPU_vertbuf_create_with_format(fmt);
GPU_vertbuf_data_alloc(vbo, params.len);