Changeset View
Changeset View
Standalone View
Standalone View
source/blender/python/gpu/gpu_py_element.c
| Show All 30 Lines | |||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "../generic/py_capi_utils.h" | #include "../generic/py_capi_utils.h" | ||||
| #include "../generic/python_utildefines.h" | #include "../generic/python_utildefines.h" | ||||
| #include "gpu_py_primitive.h" | #include "gpu_py.h" | ||||
| #include "gpu_py_element.h" /* own include */ | #include "gpu_py_element.h" /* own include */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name IndexBuf Type | /** \name IndexBuf Type | ||||
| * \{ */ | * \{ */ | ||||
| static PyObject *bpygpu_IndexBuf_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds) | static PyObject *bpygpu_IndexBuf_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds) | ||||
| { | { | ||||
| const char *error_prefix = "IndexBuf.__new__"; | const char *error_prefix = "IndexBuf.__new__"; | ||||
| bool ok = true; | bool ok = true; | ||||
| struct { | struct { | ||||
| GPUPrimType type_id; | GPUPrimType type_id; | ||||
| PyObject *seq; | PyObject *seq; | ||||
| } params; | } params; | ||||
| uint verts_per_prim; | uint verts_per_prim; | ||||
| uint index_len; | uint index_len; | ||||
| GPUIndexBufBuilder builder; | GPUIndexBufBuilder builder; | ||||
| static const char *_keywords[] = {"type", "seq", NULL}; | static const char *_keywords[] = {"type", "seq", NULL}; | ||||
| static _PyArg_Parser _parser = {"$O&O:IndexBuf.__new__", _keywords, 0}; | static _PyArg_Parser _parser = {"$O&O:IndexBuf.__new__", _keywords, 0}; | ||||
| if (!_PyArg_ParseTupleAndKeywordsFast( | if (!bpygpu_is_initialized() || | ||||
| !_PyArg_ParseTupleAndKeywordsFast( | |||||
| args, kwds, &_parser, | args, kwds, &_parser, | ||||
| bpygpu_ParsePrimType, ¶ms.type_id, | bpygpu_ParsePrimType, ¶ms.type_id, | ||||
| ¶ms.seq)) | ¶ms.seq)) | ||||
| { | { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| verts_per_prim = GPU_indexbuf_primitive_len(params.type_id); | verts_per_prim = GPU_indexbuf_primitive_len(params.type_id); | ||||
| ▲ Show 20 Lines • Show All 170 Lines • Show Last 20 Lines | |||||