Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp')
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
index 1994cb9ce6d..14356970c93 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
@@ -11,6 +11,7 @@ extern "C" {
/*--------------- Python API function prototypes for StrokeVertexIterator instance -----------*/
static int StrokeVertexIterator___init__(BPy_StrokeVertexIterator *self, PyObject *args);
+static PyObject * StrokeVertexIterator_iternext( PyObject *obj );
static PyObject * StrokeVertexIterator_t( BPy_StrokeVertexIterator *self );
static PyObject * StrokeVertexIterator_u( BPy_StrokeVertexIterator *self );
static PyObject * StrokeVertexIterator_castToInterface0DIterator( BPy_StrokeVertexIterator *self );
@@ -81,8 +82,8 @@ PyTypeObject StrokeVertexIterator_Type = {
/*** Added in release 2.2 ***/
/* Iterators */
- NULL, /* getiterfunc tp_iter; */
- NULL, /* iternextfunc tp_iternext; */
+ PyObject_SelfIter, /* getiterfunc tp_iter; */
+ (iternextfunc)StrokeVertexIterator_iternext, /* iternextfunc tp_iternext; */
/*** Attribute descriptor and subclassing stuff ***/
BPy_StrokeVertexIterator_methods, /* struct PyMethodDef *tp_methods; */
@@ -139,6 +140,23 @@ int StrokeVertexIterator___init__(BPy_StrokeVertexIterator *self, PyObject *args
return 0;
}
+PyObject * StrokeVertexIterator_iternext( PyObject *obj ) {
+ BPy_StrokeVertexIterator *self = (BPy_StrokeVertexIterator *)obj;
+ StrokeVertex *sv;
+ if (self->reversed) {
+ if (self->sv_it->isBegin())
+ return NULL;
+ self->sv_it->decrement();
+ sv = self->sv_it->operator->();
+ } else {
+ if (self->sv_it->isEnd())
+ return NULL;
+ sv = self->sv_it->operator->();
+ self->sv_it->increment();
+ }
+ return BPy_StrokeVertex_from_StrokeVertex_ptr( sv );
+}
+
PyObject * StrokeVertexIterator_t( BPy_StrokeVertexIterator *self ) {
return PyFloat_FromDouble( self->sv_it->t() );
}