Blender V4.3
BPy_UnaryFunction0DViewShape.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2008-2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10
11#include "../BPy_Convert.h"
13
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21using namespace Freestyle;
22
24
25//-------------------MODULE INITIALIZATION--------------------------------
26
28{
29 if (module == nullptr) {
30 return -1;
31 }
32
33 if (PyType_Ready(&UnaryFunction0DViewShape_Type) < 0) {
34 return -1;
35 }
36 PyModule_AddObjectRef(
37 module, "UnaryFunction0DViewShape", (PyObject *)&UnaryFunction0DViewShape_Type);
38
39 if (PyType_Ready(&GetOccludeeF0D_Type) < 0) {
40 return -1;
41 }
42 PyModule_AddObjectRef(module, "GetOccludeeF0D", (PyObject *)&GetOccludeeF0D_Type);
43
44 if (PyType_Ready(&GetShapeF0D_Type) < 0) {
45 return -1;
46 }
47 PyModule_AddObjectRef(module, "GetShapeF0D", (PyObject *)&GetShapeF0D_Type);
48
49 return 0;
50}
51
52//------------------------INSTANCE METHODS ----------------------------------
53
55 /* Wrap. */
56 UnaryFunction0DViewShape___doc__,
57 "Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DViewShape`\n"
58 "\n"
59 "Base class for unary functions (functors) that work on\n"
60 ":class:`Interface0DIterator` and return a :class:`ViewShape` object.\n"
61 "\n"
62 ".. method:: __init__()\n"
63 "\n"
64 " Default constructor.\n");
65
67 PyObject *args,
68 PyObject *kwds)
69{
70 static const char *kwlist[] = {nullptr};
71
72 if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
73 return -1;
74 }
75 self->uf0D_viewshape = new UnaryFunction0D<ViewShape *>();
76 self->uf0D_viewshape->py_uf0D = (PyObject *)self;
77 return 0;
78}
79
81{
82 delete self->uf0D_viewshape;
83 UnaryFunction0D_Type.tp_dealloc((PyObject *)self);
84}
85
87{
88 return PyUnicode_FromFormat(
89 "type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_viewshape);
90}
91
93 PyObject *args,
94 PyObject *kwds)
95{
96 static const char *kwlist[] = {"it", nullptr};
97 PyObject *obj;
98
99 if (!PyArg_ParseTupleAndKeywords(
100 args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
101 {
102 return nullptr;
103 }
104
105 if (typeid(*(self->uf0D_viewshape)) == typeid(UnaryFunction0D<ViewShape *>)) {
106 PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
107 return nullptr;
108 }
109 if (self->uf0D_viewshape->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) {
110 if (!PyErr_Occurred()) {
111 string class_name(Py_TYPE(self)->tp_name);
112 PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str());
113 }
114 return nullptr;
115 }
116 return BPy_ViewShape_from_ViewShape(*(self->uf0D_viewshape->result));
117}
118
119/*-----------------------BPy_UnaryFunction0DViewShape type definition ---------------------------*/
120
122 /*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0)
123 /*tp_name*/ "UnaryFunction0DViewShape",
124 /*tp_basicsize*/ sizeof(BPy_UnaryFunction0DViewShape),
125 /*tp_itemsize*/ 0,
126 /*tp_dealloc*/ (destructor)UnaryFunction0DViewShape___dealloc__,
127 /*tp_vectorcall_offset*/ 0,
128 /*tp_getattr*/ nullptr,
129 /*tp_setattr*/ nullptr,
130 /*tp_as_async*/ nullptr,
131 /*tp_repr*/ (reprfunc)UnaryFunction0DViewShape___repr__,
132 /*tp_as_number*/ nullptr,
133 /*tp_as_sequence*/ nullptr,
134 /*tp_as_mapping*/ nullptr,
135 /*tp_hash*/ nullptr,
136 /*tp_call*/ (ternaryfunc)UnaryFunction0DViewShape___call__,
137 /*tp_str*/ nullptr,
138 /*tp_getattro*/ nullptr,
139 /*tp_setattro*/ nullptr,
140 /*tp_as_buffer*/ nullptr,
141 /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
142 /*tp_doc*/ UnaryFunction0DViewShape___doc__,
143 /*tp_traverse*/ nullptr,
144 /*tp_clear*/ nullptr,
145 /*tp_richcompare*/ nullptr,
146 /*tp_weaklistoffset*/ 0,
147 /*tp_iter*/ nullptr,
148 /*tp_iternext*/ nullptr,
149 /*tp_methods*/ nullptr,
150 /*tp_members*/ nullptr,
151 /*tp_getset*/ nullptr,
152 /*tp_base*/ &UnaryFunction0D_Type,
153 /*tp_dict*/ nullptr,
154 /*tp_descr_get*/ nullptr,
155 /*tp_descr_set*/ nullptr,
156 /*tp_dictoffset*/ 0,
157 /*tp_init*/ (initproc)UnaryFunction0DViewShape___init__,
158 /*tp_alloc*/ nullptr,
159 /*tp_new*/ nullptr,
160};
161
163
164#ifdef __cplusplus
165}
166#endif
PyObject * BPy_ViewShape_from_ViewShape(ViewShape &vs)
PyTypeObject GetOccludeeF0D_Type
PyTypeObject GetShapeF0D_Type
PyTypeObject Interface0DIterator_Type
static int UnaryFunction0DViewShape___init__(BPy_UnaryFunction0DViewShape *self, PyObject *args, PyObject *kwds)
static void UnaryFunction0DViewShape___dealloc__(BPy_UnaryFunction0DViewShape *self)
int UnaryFunction0DViewShape_Init(PyObject *module)
static PyObject * UnaryFunction0DViewShape___repr__(BPy_UnaryFunction0DViewShape *self)
PyDoc_STRVAR(UnaryFunction0DViewShape___doc__, "Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DViewShape`\n" "\n" "Base class for unary functions (functors) that work on\n" ":class:`Interface0DIterator` and return a :class:`ViewShape` object.\n" "\n" ".. method:: __init__()\n" "\n" " Default constructor.\n")
static PyObject * UnaryFunction0DViewShape___call__(BPy_UnaryFunction0DViewShape *self, PyObject *args, PyObject *kwds)
PyTypeObject UnaryFunction0DViewShape_Type
PyTypeObject UnaryFunction0D_Type
PyObject * self
inherits from class Rep
Definition AppCanvas.cpp:20
static struct PyModuleDef module
Definition python.cpp:991