23 StrokeVertexIterator_doc,
24 "Class hierarchy: :class:`Iterator` > :class:`StrokeVertexIterator`\n"
26 "Class defining an iterator designed to iterate over the\n"
27 ":class:`StrokeVertex` of a :class:`Stroke`. An instance of a\n"
28 "StrokeVertexIterator can be obtained from a Stroke by calling\n"
29 "iter(), stroke_vertices_begin() or stroke_vertices_begin(). It is iterating\n"
30 "over the same vertices as an :class:`Interface0DIterator`. The difference\n"
31 "resides in the object access: an Interface0DIterator only allows\n"
32 "access to an Interface0D while one might need to access the\n"
33 "specialized StrokeVertex type. In this case, one should use a\n"
34 "StrokeVertexIterator. To call functions of the UnaryFuntion0D type,\n"
35 "a StrokeVertexIterator can be converted to an Interface0DIterator by\n"
36 "by calling Interface0DIterator(it).\n"
38 ".. method:: __init__()\n"
39 " __init__(brother)\n"
41 " Creates a :class:`StrokeVertexIterator` using either the\n"
42 " default constructor or the copy constructor.\n"
44 " :arg brother: A StrokeVertexIterator object.\n"
45 " :type brother: :class:`StrokeVertexIterator`");
51 static const char *kwlist_1[] = {
"brother",
nullptr};
52 static const char *kwlist_2[] = {
"stroke",
nullptr};
53 PyObject *brother =
nullptr, *stroke =
nullptr;
55 if (PyArg_ParseTupleAndKeywords(
64 else if ((
void)PyErr_Clear(),
65 PyArg_ParseTupleAndKeywords(
66 args, kwds,
"|O!", (
char **)kwlist_2, &
Stroke_Type, &stroke))
73 ((
BPy_Stroke *)stroke)->s->strokeVerticesBegin());
75 self->reversed =
false;
76 self->at_start =
true;
79 PyErr_SetString(PyExc_TypeError,
"argument 1 must be StrokeVertexIterator or Stroke");
89 self->at_start =
true;
90 return (PyObject *)
self;
101 if (
self->reversed) {
102 if (
self->sv_it->isBegin()) {
103 PyErr_SetNone(PyExc_StopIteration);
106 self->sv_it->decrement();
110 if (
self->sv_it->isEnd()) {
111 PyErr_SetNone(PyExc_StopIteration);
116 if (
self->at_start) {
117 self->at_start =
false;
121 else if (
self->sv_it->atLast()) {
122 PyErr_SetNone(PyExc_StopIteration);
126 self->sv_it->increment();
137 StrokeVertexIterator_incremented_doc,
138 ".. method:: incremented()\n"
140 " Returns a copy of an incremented StrokeVertexIterator.\n"
142 " :return: A StrokeVertexIterator pointing the next StrokeVertex.\n"
143 " :rtype: :class:`StrokeVertexIterator`");
147 if (
self->sv_it->isEnd()) {
148 PyErr_SetString(PyExc_RuntimeError,
"cannot increment any more");
158 StrokeVertexIterator_decremented_doc,
159 ".. method:: decremented()\n"
161 " Returns a copy of a decremented StrokeVertexIterator.\n"
163 " :return: A StrokeVertexIterator pointing the previous StrokeVertex.\n"
164 " :rtype: :class:`StrokeVertexIterator`");
168 if (
self->sv_it->isBegin()) {
169 PyErr_SetString(PyExc_RuntimeError,
"cannot decrement any more");
179 StrokeVertexIterator_reversed_doc,
180 ".. method:: reversed()\n"
182 " Returns a StrokeVertexIterator that traverses stroke vertices in the\n"
185 " :return: A StrokeVertexIterator traversing stroke vertices backward.\n"
186 " :rtype: :class:`StrokeVertexIterator`");
195# pragma clang diagnostic push
196# pragma clang diagnostic ignored "-Wcast-function-type"
198# pragma GCC diagnostic push
199# pragma GCC diagnostic ignored "-Wcast-function-type"
207 StrokeVertexIterator_incremented_doc},
211 StrokeVertexIterator_decremented_doc},
215 StrokeVertexIterator_reversed_doc},
216 {
nullptr,
nullptr, 0,
nullptr},
221# pragma clang diagnostic pop
223# pragma GCC diagnostic pop
231 StrokeVertexIterator_object_doc,
232 "The StrokeVertex object currently pointed to by this iterator.\n"
234 ":type: :class:`StrokeVertex`");
239 if (
self->sv_it->isEnd()) {
240 PyErr_SetString(PyExc_RuntimeError,
"iteration has stopped");
252 StrokeVertexIterator_t_doc,
253 "The curvilinear abscissa of the current point.\n"
259 return PyFloat_FromDouble(
self->sv_it->t());
264 StrokeVertexIterator_u_doc,
265 "The point parameter at the current point in the stroke (0 <= u <= 1).\n"
271 return PyFloat_FromDouble(
self->sv_it->u());
276 StrokeVertexIterator_at_last_doc,
277 "True if the iterator points to the last valid element.\n"
278 "For its counterpart (pointing to the first valid element), use it.is_begin.\n"
289# pragma clang diagnostic push
290# pragma clang diagnostic ignored "-Wcast-function-type"
292# pragma GCC diagnostic push
293# pragma GCC diagnostic ignored "-Wcast-function-type"
301 StrokeVertexIterator_object_doc,
306 StrokeVertexIterator_t_doc,
311 StrokeVertexIterator_u_doc,
316 StrokeVertexIterator_at_last_doc,
318 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
323# pragma clang diagnostic pop
325# pragma GCC diagnostic pop
332 PyVarObject_HEAD_INIT(
nullptr, 0)
333 "StrokeVertexIterator",
351 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
352 StrokeVertexIterator_doc,
PyObject * BPy_StrokeVertexIterator_from_StrokeVertexIterator(StrokeInternal::StrokeVertexIterator &sv_it, bool reversed)
PyObject * BPy_StrokeVertex_from_StrokeVertex(StrokeVertex &sv)
PyObject * PyBool_from_bool(bool b)
PyTypeObject Iterator_Type
static int StrokeVertexIterator_init(BPy_StrokeVertexIterator *self, PyObject *args, PyObject *kwds)
static PyObject * StrokeVertexIterator_at_last_get(BPy_StrokeVertexIterator *self)
static PyObject * StrokeVertexIterator_reversed(BPy_StrokeVertexIterator *self)
PyDoc_STRVAR(StrokeVertexIterator_doc, "Class hierarchy: :class:`Iterator` > :class:`StrokeVertexIterator`\n" "\n" "Class defining an iterator designed to iterate over the\n" ":class:`StrokeVertex` of a :class:`Stroke`. An instance of a\n" "StrokeVertexIterator can be obtained from a Stroke by calling\n" "iter(), stroke_vertices_begin() or stroke_vertices_begin(). It is iterating\n" "over the same vertices as an :class:`Interface0DIterator`. The difference\n" "resides in the object access: an Interface0DIterator only allows\n" "access to an Interface0D while one might need to access the\n" "specialized StrokeVertex type. In this case, one should use a\n" "StrokeVertexIterator. To call functions of the UnaryFuntion0D type,\n" "a StrokeVertexIterator can be converted to an Interface0DIterator by\n" "by calling Interface0DIterator(it).\n" "\n" ".. method:: __init__()\n" " __init__(brother)\n" "\n" " Creates a :class:`StrokeVertexIterator` using either the\n" " default constructor or the copy constructor.\n" "\n" " :arg brother: A StrokeVertexIterator object.\n" " :type brother: :class:`StrokeVertexIterator`")
static PyObject * StrokeVertexIterator_t_get(BPy_StrokeVertexIterator *self, void *)
static PyObject * StrokeVertexIterator_decremented(BPy_StrokeVertexIterator *self)
static PyObject * StrokeVertexIterator_object_get(BPy_StrokeVertexIterator *self, void *)
static PyObject * StrokeVertexIterator_u_get(BPy_StrokeVertexIterator *self, void *)
PyTypeObject StrokeVertexIterator_Type
static PyObject * StrokeVertexIterator_iternext(BPy_StrokeVertexIterator *self)
static PyGetSetDef BPy_StrokeVertexIterator_getseters[]
static PyObject * StrokeVertexIterator_incremented(BPy_StrokeVertexIterator *self)
static PyMethodDef BPy_StrokeVertexIterator_methods[]
static PyObject * StrokeVertexIterator_iter(BPy_StrokeVertexIterator *self)
static void copy(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node)