Blender V4.3
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
10
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24using namespace Freestyle;
25
27
28//-------------------MODULE INITIALIZATION--------------------------------
30{
31 if (module == nullptr) {
32 return -1;
33 }
34
35 if (PyType_Ready(&UnaryFunction1D_Type) < 0) {
36 return -1;
37 }
38 PyModule_AddObjectRef(module, "UnaryFunction1D", (PyObject *)&UnaryFunction1D_Type);
39
48
49 return 0;
50}
51
52//------------------------INSTANCE METHODS ----------------------------------
53
55 /* Wrap. */
56 UnaryFunction1D___doc__,
57 "Base class for Unary Functions (functors) working on\n"
58 ":class:`Interface1D`. A unary function will be used by invoking\n"
59 "__call__() on an Interface1D. In Python, several different subclasses\n"
60 "of UnaryFunction1D are used depending on the types of functors' return\n"
61 "values. For example, you would inherit from a\n"
62 ":class:`UnaryFunction1DDouble` if you wish to define a function that\n"
63 "returns a double value. Available UnaryFunction1D subclasses are:\n"
64 "\n"
65 "* :class:`UnaryFunction1DDouble`\n"
66 "* :class:`UnaryFunction1DEdgeNature`\n"
67 "* :class:`UnaryFunction1DFloat`\n"
68 "* :class:`UnaryFunction1DUnsigned`\n"
69 "* :class:`UnaryFunction1DVec2f`\n"
70 "* :class:`UnaryFunction1DVec3f`\n"
71 "* :class:`UnaryFunction1DVectorViewShape`\n"
72 "* :class:`UnaryFunction1DVoid`\n");
73
75{
76 Py_TYPE(self)->tp_free((PyObject *)self);
77}
78
80{
81 return PyUnicode_FromString("UnaryFunction1D");
82}
83
84/*----------------------UnaryFunction1D get/setters ----------------------------*/
85
87 /* Wrap. */
88 UnaryFunction1D_name_doc,
89 "The name of the unary 1D function.\n"
90 "\n"
91 ":type: str");
92
93static PyObject *UnaryFunction1D_name_get(BPy_UnaryFunction1D *self, void * /*closure*/)
94{
95 return PyUnicode_FromString(Py_TYPE(self)->tp_name);
96}
97
98static PyGetSetDef BPy_UnaryFunction1D_getseters[] = {
99 {"name",
101 (setter) nullptr,
102 UnaryFunction1D_name_doc,
103 nullptr},
104 {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */
105};
106
107/*-----------------------BPy_UnaryFunction1D type definition ------------------------------*/
108
109PyTypeObject UnaryFunction1D_Type = {
110 /*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0)
111 /*tp_name*/ "UnaryFunction1D",
112 /*tp_basicsize*/ sizeof(BPy_UnaryFunction1D),
113 /*tp_itemsize*/ 0,
114 /*tp_dealloc*/ (destructor)UnaryFunction1D___dealloc__,
115 /*tp_vectorcall_offset*/ 0,
116 /*tp_getattr*/ nullptr,
117 /*tp_setattr*/ nullptr,
118 /*tp_as_async*/ nullptr,
119 /*tp_repr*/ (reprfunc)UnaryFunction1D___repr__,
120 /*tp_as_number*/ nullptr,
121 /*tp_as_sequence*/ nullptr,
122 /*tp_as_mapping*/ nullptr,
123 /*tp_hash*/ nullptr,
124 /*tp_call*/ nullptr,
125 /*tp_str*/ nullptr,
126 /*tp_getattro*/ nullptr,
127 /*tp_setattro*/ nullptr,
128 /*tp_as_buffer*/ nullptr,
129 /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
130 /*tp_doc*/ UnaryFunction1D___doc__,
131 /*tp_traverse*/ nullptr,
132 /*tp_clear*/ nullptr,
133 /*tp_richcompare*/ nullptr,
134 /*tp_weaklistoffset*/ 0,
135 /*tp_iter*/ nullptr,
136 /*tp_iternext*/ nullptr,
137 /*tp_methods*/ nullptr,
138 /*tp_members*/ nullptr,
139 /*tp_getset*/ BPy_UnaryFunction1D_getseters,
140 /*tp_base*/ nullptr,
141 /*tp_dict*/ nullptr,
142 /*tp_descr_get*/ nullptr,
143 /*tp_descr_set*/ nullptr,
144 /*tp_dictoffset*/ 0,
145 /*tp_init*/ nullptr,
146 /*tp_alloc*/ nullptr,
147 /*tp_new*/ PyType_GenericNew,
148};
149
151
152#ifdef __cplusplus
153}
154#endif
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:991