Differential D222 Diff 820 source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp
| Context not available. | |||||
| "Class representing an iterator over oriented ViewEdges around a\n" | "Class representing an iterator over oriented ViewEdges around a\n" | ||||
| ":class:`ViewVertex`. This iterator allows a CCW iteration (in the image\n" | ":class:`ViewVertex`. This iterator allows a CCW iteration (in the image\n" | ||||
| "plane). An instance of an orientedViewEdgeIterator can only be\n" | "plane). An instance of an orientedViewEdgeIterator can only be\n" | ||||
| "obtained from a ViewVertex by calling edgesBegin() or edgesEnd().\n" | "obtained from a ViewVertex by calling edges_begin() or edges_end().\n" | ||||
| "\n" | "\n" | ||||
| ".. method:: __init__()\n" | ".. method:: __init__()\n" | ||||
| "\n" | "\n" | ||||
| Context not available. | |||||
| if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &orientedViewEdgeIterator_Type, &brother)) | if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &orientedViewEdgeIterator_Type, &brother)) | ||||
| return -1; | return -1; | ||||
| if (!brother) | if (!brother) { | ||||
| self->ove_it = new ViewVertexInternal::orientedViewEdgeIterator(); | self->ove_it = new ViewVertexInternal::orientedViewEdgeIterator(); | ||||
| else | self->at_start = true; | ||||
| self->reversed = false; | |||||
| } | |||||
| else { | |||||
| self->ove_it = new ViewVertexInternal::orientedViewEdgeIterator(*(((BPy_orientedViewEdgeIterator *)brother)->ove_it)); | self->ove_it = new ViewVertexInternal::orientedViewEdgeIterator(*(((BPy_orientedViewEdgeIterator *)brother)->ove_it)); | ||||
| self->at_start = ((BPy_orientedViewEdgeIterator *)brother)->at_start; | |||||
| self->reversed = ((BPy_orientedViewEdgeIterator *)brother)->reversed; | |||||
| } | |||||
| self->py_it.it = self->ove_it; | self->py_it.it = self->ove_it; | ||||
| self->reversed = 0; | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| static PyObject *orientedViewEdgeIterator_iternext(BPy_orientedViewEdgeIterator *self) | static PyObject *orientedViewEdgeIterator_iter(BPy_orientedViewEdgeIterator *self) | ||||
| { | { | ||||
| ViewVertex::directedViewEdge *dve; | Py_INCREF(self); | ||||
| self->at_start = true; | |||||
| return (PyObject *) self; | |||||
| } | |||||
| static PyObject *orientedViewEdgeIterator_iternext(BPy_orientedViewEdgeIterator *self) | |||||
| { | |||||
| if (self->reversed) { | if (self->reversed) { | ||||
| if (self->ove_it->isBegin()) { | if (self->ove_it->isBegin()) { | ||||
| PyErr_SetNone(PyExc_StopIteration); | PyErr_SetNone(PyExc_StopIteration); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| self->ove_it->decrement(); | if (self->at_start) | ||||
| dve = self->ove_it->operator->(); | self->at_start = false; | ||||
| else { | |||||
| self->ove_it->decrement(); | |||||
| if (self->ove_it->isBegin()) { | |||||
| PyErr_SetNone(PyExc_StopIteration); | |||||
| return NULL; | |||||
| } | |||||
| } | |||||
| } | } | ||||
| else { | else { | ||||
| if (self->ove_it->isEnd()) { | if (self->ove_it->isEnd()) { | ||||
| PyErr_SetNone(PyExc_StopIteration); | PyErr_SetNone(PyExc_StopIteration); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| dve = self->ove_it->operator->(); | if (self->at_start) | ||||
| self->ove_it->increment(); | self->at_start = false; | ||||
| else { | |||||
| self->ove_it->increment(); | |||||
| if (self->ove_it->isEnd()) { | |||||
| PyErr_SetNone(PyExc_StopIteration); | |||||
| return NULL; | |||||
| } | |||||
| } | |||||
| } | } | ||||
| ViewVertex::directedViewEdge *dve = self->ove_it->operator->(); | |||||
| return BPy_directedViewEdge_from_directedViewEdge(*dve); | return BPy_directedViewEdge_from_directedViewEdge(*dve); | ||||
| } | } | ||||
| Context not available. | |||||
| PyDoc_STRVAR(orientedViewEdgeIterator_object_doc, | PyDoc_STRVAR(orientedViewEdgeIterator_object_doc, | ||||
| "The oriented ViewEdge (i.e., a tuple of the pointed ViewEdge and a boolean\n" | "The oriented ViewEdge (i.e., a tuple of the pointed ViewEdge and a boolean\n" | ||||
| "value) currently pointed by this iterator. If the boolean value is true,\n" | "value) currently pointed to by this iterator. If the boolean value is true,\n" | ||||
| "the ViewEdge is incoming.\n" | "the ViewEdge is incoming.\n" | ||||
| "\n" | "\n" | ||||
| ":type: (:class:`directedViewEdge`, bool)"); | ":type: (:class:`directedViewEdge`, bool)"); | ||||
| Context not available. | |||||
| 0, /* tp_clear */ | 0, /* tp_clear */ | ||||
| 0, /* tp_richcompare */ | 0, /* tp_richcompare */ | ||||
| 0, /* tp_weaklistoffset */ | 0, /* tp_weaklistoffset */ | ||||
| PyObject_SelfIter, /* tp_iter */ | (getiterfunc)orientedViewEdgeIterator_iter, /* tp_iter */ | ||||
| (iternextfunc)orientedViewEdgeIterator_iternext, /* tp_iternext */ | (iternextfunc)orientedViewEdgeIterator_iternext, /* tp_iternext */ | ||||
| 0, /* tp_methods */ | 0, /* tp_methods */ | ||||
| 0, /* tp_members */ | 0, /* tp_members */ | ||||
| Context not available. | |||||