Blender  V2.93
gpu_py_select.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
29 #include <Python.h>
30 
31 #include "BLI_utildefines.h"
32 
33 #include "../generic/py_capi_utils.h"
34 
35 #include "GPU_select.h"
36 
37 #include "gpu_py_select.h" /* own include */
38 
39 /* -------------------------------------------------------------------- */
43 PyDoc_STRVAR(pygpu_select_load_id_doc,
44  ".. function:: load_id(id)\n"
45  "\n"
46  " Set the selection ID.\n"
47  "\n"
48  " :param id: Number (32-bit uint).\n"
49  " :type select: int\n");
50 static PyObject *pygpu_select_load_id(PyObject *UNUSED(self), PyObject *value)
51 {
52  uint id;
53  if ((id = PyC_Long_AsU32(value)) == (uint)-1) {
54  return NULL;
55  }
57  Py_RETURN_NONE;
58 }
61 /* -------------------------------------------------------------------- */
65 static struct PyMethodDef pygpu_select__tp_methods[] = {
66  /* Manage Stack */
67  {"load_id", (PyCFunction)pygpu_select_load_id, METH_O, pygpu_select_load_id_doc},
68  {NULL, NULL, 0, NULL},
69 };
70 
71 PyDoc_STRVAR(pygpu_select__tp_doc, "This module provides access to selection.");
72 static PyModuleDef pygpu_select_module_def = {
73  PyModuleDef_HEAD_INIT,
74  .m_name = "gpu.select",
75  .m_doc = pygpu_select__tp_doc,
76  .m_methods = pygpu_select__tp_methods,
77 };
78 
79 PyObject *bpygpu_select_init(void)
80 {
81  PyObject *submodule;
82 
83  submodule = PyModule_Create(&pygpu_select_module_def);
84 
85  return submodule;
86 }
87 
unsigned int uint
Definition: BLI_sys_types.h:83
#define UNUSED(x)
bool GPU_select_load_id(unsigned int id)
Definition: gpu_select.c:108
static PyObject * pygpu_select_load_id(PyObject *UNUSED(self), PyObject *value)
Definition: gpu_py_select.c:50
static PyModuleDef pygpu_select_module_def
Definition: gpu_py_select.c:72
static struct PyMethodDef pygpu_select__tp_methods[]
Definition: gpu_py_select.c:65
PyObject * bpygpu_select_init(void)
Definition: gpu_py_select.c:79
PyDoc_STRVAR(pygpu_select_load_id_doc, ".. function:: load_id(id)\n" "\n" " Set the selection ID.\n" "\n" " :param id: Number (32-bit uint).\n" " :type select: int\n")
uint32_t PyC_Long_AsU32(PyObject *value)