Blender  V3.3
BPy_UnaryFunction0D.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include "BPy_UnaryFunction0D.h"
8 
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 using namespace Freestyle;
25 
27 
28 //-------------------MODULE INITIALIZATION--------------------------------
30 {
31  if (module == nullptr) {
32  return -1;
33  }
34 
35  if (PyType_Ready(&UnaryFunction0D_Type) < 0) {
36  return -1;
37  }
38  Py_INCREF(&UnaryFunction0D_Type);
39  PyModule_AddObject(module, "UnaryFunction0D", (PyObject *)&UnaryFunction0D_Type);
40 
51 
52  return 0;
53 }
54 
55 //------------------------INSTANCE METHODS ----------------------------------
56 
57 static char UnaryFunction0D___doc__[] =
58  "Base class for Unary Functions (functors) working on\n"
59  ":class:`Interface0DIterator`. A unary function will be used by\n"
60  "invoking __call__() on an Interface0DIterator. In Python, several\n"
61  "different subclasses of UnaryFunction0D are used depending on the\n"
62  "types of functors' return values. For example, you would inherit from\n"
63  "a :class:`UnaryFunction0DDouble` if you wish to define a function that\n"
64  "returns a double value. Available UnaryFunction0D subclasses are:\n"
65  "\n"
66  "* :class:`UnaryFunction0DDouble`\n"
67  "* :class:`UnaryFunction0DEdgeNature`\n"
68  "* :class:`UnaryFunction0DFloat`\n"
69  "* :class:`UnaryFunction0DId`\n"
70  "* :class:`UnaryFunction0DMaterial`\n"
71  "* :class:`UnaryFunction0DUnsigned`\n"
72  "* :class:`UnaryFunction0DVec2f`\n"
73  "* :class:`UnaryFunction0DVec3f`\n"
74  "* :class:`UnaryFunction0DVectorViewShape`\n"
75  "* :class:`UnaryFunction0DViewShape`\n";
76 
78 {
79  Py_TYPE(self)->tp_free((PyObject *)self);
80 }
81 
82 static PyObject *UnaryFunction0D___repr__(BPy_UnaryFunction0D * /*self*/)
83 {
84  return PyUnicode_FromString("UnaryFunction0D");
85 }
86 
87 /*----------------------UnaryFunction0D get/setters ----------------------------*/
88 
89 PyDoc_STRVAR(UnaryFunction0D_name_doc,
90  "The name of the unary 0D function.\n"
91  "\n"
92  ":type: str");
93 
94 static PyObject *UnaryFunction0D_name_get(BPy_UnaryFunction0D *self, void *UNUSED(closure))
95 {
96  return PyUnicode_FromString(Py_TYPE(self)->tp_name);
97 }
98 
99 static PyGetSetDef BPy_UnaryFunction0D_getseters[] = {
100  {"name",
101  (getter)UnaryFunction0D_name_get,
102  (setter) nullptr,
103  UnaryFunction0D_name_doc,
104  nullptr},
105  {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */
106 };
107 
108 /*-----------------------BPy_UnaryFunction0D type definition ------------------------------*/
109 
110 PyTypeObject UnaryFunction0D_Type = {
111  PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction0D", /* tp_name */
112  sizeof(BPy_UnaryFunction0D), /* tp_basicsize */
113  0, /* tp_itemsize */
114  (destructor)UnaryFunction0D___dealloc__, /* tp_dealloc */
115  0, /* tp_vectorcall_offset */
116  nullptr, /* tp_getattr */
117  nullptr, /* tp_setattr */
118  nullptr, /* tp_reserved */
119  (reprfunc)UnaryFunction0D___repr__, /* tp_repr */
120  nullptr, /* tp_as_number */
121  nullptr, /* tp_as_sequence */
122  nullptr, /* tp_as_mapping */
123  nullptr, /* tp_hash */
124  nullptr, /* tp_call */
125  nullptr, /* tp_str */
126  nullptr, /* tp_getattro */
127  nullptr, /* tp_setattro */
128  nullptr, /* tp_as_buffer */
129  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
130  UnaryFunction0D___doc__, /* tp_doc */
131  nullptr, /* tp_traverse */
132  nullptr, /* tp_clear */
133  nullptr, /* tp_richcompare */
134  0, /* tp_weaklistoffset */
135  nullptr, /* tp_iter */
136  nullptr, /* tp_iternext */
137  nullptr, /* tp_methods */
138  nullptr, /* tp_members */
139  BPy_UnaryFunction0D_getseters, /* tp_getset */
140  nullptr, /* tp_base */
141  nullptr, /* tp_dict */
142  nullptr, /* tp_descr_get */
143  nullptr, /* tp_descr_set */
144  0, /* tp_dictoffset */
145  nullptr, /* tp_init */
146  nullptr, /* tp_alloc */
147  PyType_GenericNew, /* tp_new */
148 };
149 
151 
152 #ifdef __cplusplus
153 }
154 #endif
#define UNUSED(x)
int UnaryFunction0DDouble_Init(PyObject *module)
int UnaryFunction0DEdgeNature_Init(PyObject *module)
int UnaryFunction0DFloat_Init(PyObject *module)
int UnaryFunction0DId_Init(PyObject *module)
int UnaryFunction0DMaterial_Init(PyObject *module)
int UnaryFunction0DUnsigned_Init(PyObject *module)
int UnaryFunction0DVec2f_Init(PyObject *module)
int UnaryFunction0DVec3f_Init(PyObject *module)
int UnaryFunction0DVectorViewShape_Init(PyObject *module)
int UnaryFunction0DViewShape_Init(PyObject *module)
PyDoc_STRVAR(UnaryFunction0D_name_doc, "The name of the unary 0D function.\n" "\n" ":type: str")
PyTypeObject UnaryFunction0D_Type
static PyObject * UnaryFunction0D___repr__(BPy_UnaryFunction0D *)
static PyGetSetDef BPy_UnaryFunction0D_getseters[]
static void UnaryFunction0D___dealloc__(BPy_UnaryFunction0D *self)
static PyObject * UnaryFunction0D_name_get(BPy_UnaryFunction0D *self, void *UNUSED(closure))
int UnaryFunction0D_Init(PyObject *module)
static char UnaryFunction0D___doc__[]
inherits from class Rep
Definition: AppCanvas.cpp:18
static struct PyModuleDef module
Definition: python.cpp:972