Blender V5.0
BPy_UnaryFunction1D.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2004-2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
10
19
20using namespace Freestyle;
21
23
24//-------------------MODULE INITIALIZATION--------------------------------
26{
27 if (module == nullptr) {
28 return -1;
29 }
30
31 if (PyType_Ready(&UnaryFunction1D_Type) < 0) {
32 return -1;
33 }
34 PyModule_AddObjectRef(module, "UnaryFunction1D", (PyObject *)&UnaryFunction1D_Type);
35
44
45 return 0;
46}
47
48//------------------------INSTANCE METHODS ----------------------------------
49
51 /* Wrap. */
52 UnaryFunction1D___doc__,
53 "Base class for Unary Functions (functors) working on\n"
54 ":class:`Interface1D`. A unary function will be used by invoking\n"
55 "__call__() on an Interface1D. In Python, several different subclasses\n"
56 "of UnaryFunction1D are used depending on the types of functors' return\n"
57 "values. For example, you would inherit from a\n"
58 ":class:`UnaryFunction1DDouble` if you wish to define a function that\n"
59 "returns a double value. Available UnaryFunction1D subclasses are:\n"
60 "\n"
61 "* :class:`UnaryFunction1DDouble`\n"
62 "* :class:`UnaryFunction1DEdgeNature`\n"
63 "* :class:`UnaryFunction1DFloat`\n"
64 "* :class:`UnaryFunction1DUnsigned`\n"
65 "* :class:`UnaryFunction1DVec2f`\n"
66 "* :class:`UnaryFunction1DVec3f`\n"
67 "* :class:`UnaryFunction1DVectorViewShape`\n"
68 "* :class:`UnaryFunction1DVoid`\n");
70{
71 Py_TYPE(self)->tp_free((PyObject *)self);
72}
73
75{
76 return PyUnicode_FromString("UnaryFunction1D");
77}
78
79/*----------------------UnaryFunction1D get/setters ----------------------------*/
80
82 /* Wrap. */
83 UnaryFunction1D_name_doc,
84 "The name of the unary 1D function.\n"
85 "\n"
86 ":type: str\n");
87static PyObject *UnaryFunction1D_name_get(BPy_UnaryFunction1D *self, void * /*closure*/)
88{
89 return PyUnicode_FromString(Py_TYPE(self)->tp_name);
90}
91
92static PyGetSetDef BPy_UnaryFunction1D_getseters[] = {
93 {"name",
95 (setter) nullptr,
96 UnaryFunction1D_name_doc,
97 nullptr},
98 {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */
99};
100
101/*-----------------------BPy_UnaryFunction1D type definition ------------------------------*/
102
103PyTypeObject UnaryFunction1D_Type = {
104 /*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0)
105 /*tp_name*/ "UnaryFunction1D",
106 /*tp_basicsize*/ sizeof(BPy_UnaryFunction1D),
107 /*tp_itemsize*/ 0,
108 /*tp_dealloc*/ (destructor)UnaryFunction1D___dealloc__,
109 /*tp_vectorcall_offset*/ 0,
110 /*tp_getattr*/ nullptr,
111 /*tp_setattr*/ nullptr,
112 /*tp_as_async*/ nullptr,
113 /*tp_repr*/ (reprfunc)UnaryFunction1D___repr__,
114 /*tp_as_number*/ nullptr,
115 /*tp_as_sequence*/ nullptr,
116 /*tp_as_mapping*/ nullptr,
117 /*tp_hash*/ nullptr,
118 /*tp_call*/ nullptr,
119 /*tp_str*/ nullptr,
120 /*tp_getattro*/ nullptr,
121 /*tp_setattro*/ nullptr,
122 /*tp_as_buffer*/ nullptr,
123 /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
124 /*tp_doc*/ UnaryFunction1D___doc__,
125 /*tp_traverse*/ nullptr,
126 /*tp_clear*/ nullptr,
127 /*tp_richcompare*/ nullptr,
128 /*tp_weaklistoffset*/ 0,
129 /*tp_iter*/ nullptr,
130 /*tp_iternext*/ nullptr,
131 /*tp_methods*/ nullptr,
132 /*tp_members*/ nullptr,
133 /*tp_getset*/ BPy_UnaryFunction1D_getseters,
134 /*tp_base*/ nullptr,
135 /*tp_dict*/ nullptr,
136 /*tp_descr_get*/ nullptr,
137 /*tp_descr_set*/ nullptr,
138 /*tp_dictoffset*/ 0,
139 /*tp_init*/ nullptr,
140 /*tp_alloc*/ nullptr,
141 /*tp_new*/ PyType_GenericNew,
142};
143
int UnaryFunction1DDouble_Init(PyObject *module)
int UnaryFunction1DEdgeNature_Init(PyObject *module)
int UnaryFunction1DFloat_Init(PyObject *module)
int UnaryFunction1DUnsigned_Init(PyObject *module)
int UnaryFunction1DVec2f_Init(PyObject *module)
int UnaryFunction1DVec3f_Init(PyObject *module)
int UnaryFunction1DVectorViewShape_Init(PyObject *module)
int UnaryFunction1DVoid_Init(PyObject *module)
static PyObject * UnaryFunction1D_name_get(BPy_UnaryFunction1D *self, void *)
static PyObject * UnaryFunction1D___repr__(BPy_UnaryFunction1D *)
static void UnaryFunction1D___dealloc__(BPy_UnaryFunction1D *self)
PyDoc_STRVAR(UnaryFunction1D___doc__, "Base class for Unary Functions (functors) working on\n" ":class:`Interface1D`. A unary function will be used by invoking\n" "__call__() on an Interface1D. In Python, several different subclasses\n" "of UnaryFunction1D are used depending on the types of functors' return\n" "values. For example, you would inherit from a\n" ":class:`UnaryFunction1DDouble` if you wish to define a function that\n" "returns a double value. Available UnaryFunction1D subclasses are:\n" "\n" "* :class:`UnaryFunction1DDouble`\n" "* :class:`UnaryFunction1DEdgeNature`\n" "* :class:`UnaryFunction1DFloat`\n" "* :class:`UnaryFunction1DUnsigned`\n" "* :class:`UnaryFunction1DVec2f`\n" "* :class:`UnaryFunction1DVec3f`\n" "* :class:`UnaryFunction1DVectorViewShape`\n" "* :class:`UnaryFunction1DVoid`\n")
PyTypeObject UnaryFunction1D_Type
int UnaryFunction1D_Init(PyObject *module)
static PyGetSetDef BPy_UnaryFunction1D_getseters[]
PyObject * self
inherits from class Rep
Definition AppCanvas.cpp:20
static struct PyModuleDef module
Definition python.cpp:796