Differential D222 Diff 820 source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
| Context not available. | |||||
| PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0; | PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0; | ||||
| if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &AdjacencyIterator_Type, &obj1)) { | if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &AdjacencyIterator_Type, &obj1)) { | ||||
| if (!obj1) | if (!obj1) { | ||||
| self->a_it = new AdjacencyIterator(); | self->a_it = new AdjacencyIterator(); | ||||
| else | self->at_start = true; | ||||
| } | |||||
| else { | |||||
| self->a_it = new AdjacencyIterator(*(((BPy_AdjacencyIterator *)obj1)->a_it)); | self->a_it = new AdjacencyIterator(*(((BPy_AdjacencyIterator *)obj1)->a_it)); | ||||
| self->at_start = ((BPy_AdjacencyIterator *)obj1)->at_start; | |||||
| } | |||||
| } | } | ||||
| else if (PyErr_Clear(), (obj2 = obj3 = 0), | else if (PyErr_Clear(), (obj2 = obj3 = 0), | ||||
| PyArg_ParseTupleAndKeywords(args, kwds, "O!|O!O!", (char **)kwlist_2, | PyArg_ParseTupleAndKeywords(args, kwds, "O!|O!O!", (char **)kwlist_2, | ||||
| Context not available. | |||||
| bool restrictToSelection = (!obj2) ? true : bool_from_PyBool(obj2); | bool restrictToSelection = (!obj2) ? true : bool_from_PyBool(obj2); | ||||
| bool restrictToUnvisited = (!obj3) ? true : bool_from_PyBool(obj3); | bool restrictToUnvisited = (!obj3) ? true : bool_from_PyBool(obj3); | ||||
| self->a_it = new AdjacencyIterator(((BPy_ViewVertex *)obj1)->vv, restrictToSelection, restrictToUnvisited); | self->a_it = new AdjacencyIterator(((BPy_ViewVertex *)obj1)->vv, restrictToSelection, restrictToUnvisited); | ||||
| self->at_start = ((BPy_AdjacencyIterator *)obj1)->at_start; | |||||
| } | } | ||||
| else { | else { | ||||
| PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); | PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); | ||||
| Context not available. | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| static PyObject *AdjacencyIterator_iter(BPy_AdjacencyIterator *self) | |||||
| { | |||||
| Py_INCREF(self); | |||||
| self->at_start = true; | |||||
| return (PyObject *) self; | |||||
| } | |||||
| static PyObject *AdjacencyIterator_iternext(BPy_AdjacencyIterator *self) | static PyObject *AdjacencyIterator_iternext(BPy_AdjacencyIterator *self) | ||||
| { | { | ||||
| if (self->a_it->isEnd()) { | if (self->a_it->isEnd()) { | ||||
| PyErr_SetNone(PyExc_StopIteration); | PyErr_SetNone(PyExc_StopIteration); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| ViewEdge *ve = self->a_it->operator*(); | |||||
| self->a_it->increment(); | if (self->at_start) | ||||
| self->at_start = false; | |||||
| else { | |||||
| self->a_it->increment(); | |||||
| if (self->a_it->isEnd()){ | |||||
| PyErr_SetNone(PyExc_StopIteration); | |||||
| return NULL; | |||||
| } | |||||
| } | |||||
| ViewEdge *ve = self->a_it->operator->(); | |||||
| return BPy_ViewEdge_from_ViewEdge(*ve); | return BPy_ViewEdge_from_ViewEdge(*ve); | ||||
| } | } | ||||
| /*----------------------AdjacencyIterator get/setters ----------------------------*/ | /*----------------------AdjacencyIterator get/setters ----------------------------*/ | ||||
| PyDoc_STRVAR(AdjacencyIterator_object_doc, | PyDoc_STRVAR(AdjacencyIterator_object_doc, | ||||
| "The ViewEdge object currently pointed by this iterator.\n" | "The ViewEdge object currently pointed to by this iterator.\n" | ||||
| "\n" | "\n" | ||||
| ":type: :class:`ViewEdge`"); | ":type: :class:`ViewEdge`"); | ||||
| 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)AdjacencyIterator_iter, /* tp_iter */ | ||||
| (iternextfunc)AdjacencyIterator_iternext, /* tp_iternext */ | (iternextfunc)AdjacencyIterator_iternext, /* tp_iternext */ | ||||
| 0, /* tp_methods */ | 0, /* tp_methods */ | ||||
| 0, /* tp_members */ | 0, /* tp_members */ | ||||
| Context not available. | |||||