27 StrokeVertexIterator_doc,
28 "Class hierarchy: :class:`Iterator` > :class:`StrokeVertexIterator`\n"
30 "Class defining an iterator designed to iterate over the\n"
31 ":class:`StrokeVertex` of a :class:`Stroke`. An instance of a\n"
32 "StrokeVertexIterator can be obtained from a Stroke by calling\n"
33 "iter(), stroke_vertices_begin() or stroke_vertices_begin(). It is iterating\n"
34 "over the same vertices as an :class:`Interface0DIterator`. The difference\n"
35 "resides in the object access: an Interface0DIterator only allows\n"
36 "access to an Interface0D while one might need to access the\n"
37 "specialized StrokeVertex type. In this case, one should use a\n"
38 "StrokeVertexIterator. To call functions of the UnaryFuntion0D type,\n"
39 "a StrokeVertexIterator can be converted to an Interface0DIterator by\n"
40 "by calling Interface0DIterator(it).\n"
42 ".. method:: __init__()\n"
43 " __init__(brother)\n"
45 " Creates a :class:`StrokeVertexIterator` using either the\n"
46 " default constructor or the copy constructor.\n"
48 " :arg brother: A StrokeVertexIterator object.\n"
49 " :type brother: :class:`StrokeVertexIterator`");
55 static const char *kwlist_1[] = {
"brother",
nullptr};
56 static const char *kwlist_2[] = {
"stroke",
nullptr};
57 PyObject *brother =
nullptr, *stroke =
nullptr;
59 if (PyArg_ParseTupleAndKeywords(
68 else if ((
void)PyErr_Clear(),
69 PyArg_ParseTupleAndKeywords(
70 args, kwds,
"|O!", (
char **)kwlist_2, &
Stroke_Type, &stroke))
77 ((
BPy_Stroke *)stroke)->s->strokeVerticesBegin());
79 self->reversed =
false;
80 self->at_start =
true;
83 PyErr_SetString(PyExc_TypeError,
"argument 1 must be StrokeVertexIterator or Stroke");
93 self->at_start =
true;
94 return (PyObject *)
self;
105 if (
self->reversed) {
106 if (
self->sv_it->isBegin()) {
107 PyErr_SetNone(PyExc_StopIteration);
110 self->sv_it->decrement();
114 if (
self->sv_it->isEnd()) {
115 PyErr_SetNone(PyExc_StopIteration);
120 if (
self->at_start) {
121 self->at_start =
false;
125 else if (
self->sv_it->atLast()) {
126 PyErr_SetNone(PyExc_StopIteration);
130 self->sv_it->increment();
141 StrokeVertexIterator_incremented_doc,
142 ".. method:: incremented()\n"
144 " Returns a copy of an incremented StrokeVertexIterator.\n"
146 " :return: A StrokeVertexIterator pointing the next StrokeVertex.\n"
147 " :rtype: :class:`StrokeVertexIterator`");
151 if (
self->sv_it->isEnd()) {
152 PyErr_SetString(PyExc_RuntimeError,
"cannot increment any more");
162 StrokeVertexIterator_decremented_doc,
163 ".. method:: decremented()\n"
165 " Returns a copy of a decremented StrokeVertexIterator.\n"
167 " :return: A StrokeVertexIterator pointing the previous StrokeVertex.\n"
168 " :rtype: :class:`StrokeVertexIterator`");
172 if (
self->sv_it->isBegin()) {
173 PyErr_SetString(PyExc_RuntimeError,
"cannot decrement any more");
183 StrokeVertexIterator_reversed_doc,
184 ".. method:: reversed()\n"
186 " Returns a StrokeVertexIterator that traverses stroke vertices in the\n"
189 " :return: A StrokeVertexIterator traversing stroke vertices backward.\n"
190 " :rtype: :class:`StrokeVertexIterator`");
201 StrokeVertexIterator_incremented_doc},
205 StrokeVertexIterator_decremented_doc},
209 StrokeVertexIterator_reversed_doc},
210 {
nullptr,
nullptr, 0,
nullptr},
217 StrokeVertexIterator_object_doc,
218 "The StrokeVertex object currently pointed to by this iterator.\n"
220 ":type: :class:`StrokeVertex`");
225 if (
self->sv_it->isEnd()) {
226 PyErr_SetString(PyExc_RuntimeError,
"iteration has stopped");
238 StrokeVertexIterator_t_doc,
239 "The curvilinear abscissa of the current point.\n"
245 return PyFloat_FromDouble(
self->sv_it->t());
250 StrokeVertexIterator_u_doc,
251 "The point parameter at the current point in the stroke (0 <= u <= 1).\n"
257 return PyFloat_FromDouble(
self->sv_it->u());
262 StrokeVertexIterator_at_last_doc,
263 "True if the iterator points to the last valid element.\n"
264 "For its counterpart (pointing to the first valid element), use it.is_begin.\n"
277 StrokeVertexIterator_object_doc,
282 StrokeVertexIterator_t_doc,
287 StrokeVertexIterator_u_doc,
292 StrokeVertexIterator_at_last_doc,
294 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
300 PyVarObject_HEAD_INIT(
nullptr, 0)
301 "StrokeVertexIterator",
319 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
320 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)