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.cpp128
1 files changed, 69 insertions, 59 deletions
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
index cda4031240b..ceb0d2a7546 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
@@ -48,12 +48,10 @@ PyDoc_STRVAR(StrokeVertexIterator_doc,
"by calling Interface0DIterator(it).\n"
"\n"
".. method:: __init__()\n"
+ " __init__(brother)\n"
"\n"
- " Default constructor.\n"
- "\n"
- ".. method:: __init__(brother)\n"
- "\n"
- " Copy constructor.\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`");
@@ -62,9 +60,9 @@ static int StrokeVertexIterator_init(BPy_StrokeVertexIterator *self,
PyObject *args,
PyObject *kwds)
{
- static const char *kwlist_1[] = {"brother", NULL};
- static const char *kwlist_2[] = {"stroke", NULL};
- PyObject *brother = 0, *stroke = 0;
+ static const char *kwlist_1[] = {"brother", nullptr};
+ static const char *kwlist_2[] = {"stroke", nullptr};
+ PyObject *brother = nullptr, *stroke = nullptr;
if (PyArg_ParseTupleAndKeywords(
args, kwds, "O!", (char **)kwlist_1, &StrokeVertexIterator_Type, &brother)) {
@@ -113,7 +111,7 @@ static PyObject *StrokeVertexIterator_iternext(BPy_StrokeVertexIterator *self)
if (self->reversed) {
if (self->sv_it->isBegin()) {
PyErr_SetNone(PyExc_StopIteration);
- return NULL;
+ return nullptr;
}
self->sv_it->decrement();
}
@@ -121,7 +119,7 @@ static PyObject *StrokeVertexIterator_iternext(BPy_StrokeVertexIterator *self)
/* If sv_it.isEnd() is true, the iterator can't be incremented. */
if (self->sv_it->isEnd()) {
PyErr_SetNone(PyExc_StopIteration);
- return NULL;
+ return nullptr;
}
/* If at the start of the iterator, only return the object
* and don't increment, to keep for-loops in sync */
@@ -132,7 +130,7 @@ static PyObject *StrokeVertexIterator_iternext(BPy_StrokeVertexIterator *self)
* Incrementing it further would lead to a state that the iterator can't be dereferenced. */
else if (self->sv_it->atLast()) {
PyErr_SetNone(PyExc_StopIteration);
- return NULL;
+ return nullptr;
}
else {
self->sv_it->increment();
@@ -156,7 +154,7 @@ static PyObject *StrokeVertexIterator_incremented(BPy_StrokeVertexIterator *self
{
if (self->sv_it->isEnd()) {
PyErr_SetString(PyExc_RuntimeError, "cannot increment any more");
- return NULL;
+ return nullptr;
}
StrokeInternal::StrokeVertexIterator copy(*self->sv_it);
copy.increment();
@@ -175,7 +173,7 @@ static PyObject *StrokeVertexIterator_decremented(BPy_StrokeVertexIterator *self
{
if (self->sv_it->isBegin()) {
PyErr_SetString(PyExc_RuntimeError, "cannot decrement any more");
- return NULL;
+ return nullptr;
}
StrokeInternal::StrokeVertexIterator copy(*self->sv_it);
copy.decrement();
@@ -209,7 +207,7 @@ static PyMethodDef BPy_StrokeVertexIterator_methods[] = {
(PyCFunction)StrokeVertexIterator_reversed,
METH_NOARGS,
StrokeVertexIterator_reversed_doc},
- {NULL, NULL, 0, NULL},
+ {nullptr, nullptr, 0, nullptr},
};
/*----------------------StrokeVertexIterator get/setters ----------------------------*/
@@ -224,7 +222,7 @@ static PyObject *StrokeVertexIterator_object_get(BPy_StrokeVertexIterator *self,
{
if (self->sv_it->isEnd()) {
PyErr_SetString(PyExc_RuntimeError, "iteration has stopped");
- return NULL;
+ return nullptr;
}
StrokeVertex *sv = self->sv_it->operator->();
if (sv) {
@@ -267,59 +265,71 @@ static PyObject *StrokeVertexIterator_at_last_get(BPy_StrokeVertexIterator *self
static PyGetSetDef BPy_StrokeVertexIterator_getseters[] = {
{"object",
(getter)StrokeVertexIterator_object_get,
- (setter)NULL,
+ (setter) nullptr,
StrokeVertexIterator_object_doc,
- NULL},
- {"t", (getter)StrokeVertexIterator_t_get, (setter)NULL, StrokeVertexIterator_t_doc, NULL},
- {"u", (getter)StrokeVertexIterator_u_get, (setter)NULL, StrokeVertexIterator_u_doc, NULL},
+ nullptr},
+ {"t",
+ (getter)StrokeVertexIterator_t_get,
+ (setter) nullptr,
+ StrokeVertexIterator_t_doc,
+ nullptr},
+ {"u",
+ (getter)StrokeVertexIterator_u_get,
+ (setter) nullptr,
+ StrokeVertexIterator_u_doc,
+ nullptr},
{"at_last",
(getter)StrokeVertexIterator_at_last_get,
- (setter)NULL,
+ (setter) nullptr,
StrokeVertexIterator_at_last_doc,
- NULL},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ nullptr},
+ {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */
};
/*-----------------------BPy_StrokeVertexIterator type definition ------------------------------*/
PyTypeObject StrokeVertexIterator_Type = {
- PyVarObject_HEAD_INIT(NULL, 0) "StrokeVertexIterator", /* tp_name */
- sizeof(BPy_StrokeVertexIterator), /* tp_basicsize */
- 0, /* tp_itemsize */
- 0, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- StrokeVertexIterator_doc, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- (getiterfunc)StrokeVertexIterator_iter, /* tp_iter */
- (iternextfunc)StrokeVertexIterator_iternext, /* tp_iternext */
- BPy_StrokeVertexIterator_methods, /* tp_methods */
- 0, /* tp_members */
- BPy_StrokeVertexIterator_getseters, /* tp_getset */
- &Iterator_Type, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- (initproc)StrokeVertexIterator_init, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
+ PyVarObject_HEAD_INIT(nullptr, 0) "StrokeVertexIterator", /* tp_name */
+ sizeof(BPy_StrokeVertexIterator), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ nullptr, /* tp_dealloc */
+#if PY_VERSION_HEX >= 0x03080000
+ 0, /* tp_vectorcall_offset */
+#else
+ nullptr, /* tp_print */
+#endif
+ nullptr, /* tp_getattr */
+ nullptr, /* tp_setattr */
+ nullptr, /* tp_reserved */
+ nullptr, /* tp_repr */
+ nullptr, /* tp_as_number */
+ nullptr, /* tp_as_sequence */
+ nullptr, /* tp_as_mapping */
+ nullptr, /* tp_hash */
+ nullptr, /* tp_call */
+ nullptr, /* tp_str */
+ nullptr, /* tp_getattro */
+ nullptr, /* tp_setattro */
+ nullptr, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ StrokeVertexIterator_doc, /* tp_doc */
+ nullptr, /* tp_traverse */
+ nullptr, /* tp_clear */
+ nullptr, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ (getiterfunc)StrokeVertexIterator_iter, /* tp_iter */
+ (iternextfunc)StrokeVertexIterator_iternext, /* tp_iternext */
+ BPy_StrokeVertexIterator_methods, /* tp_methods */
+ nullptr, /* tp_members */
+ BPy_StrokeVertexIterator_getseters, /* tp_getset */
+ &Iterator_Type, /* tp_base */
+ nullptr, /* tp_dict */
+ nullptr, /* tp_descr_get */
+ nullptr, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ (initproc)StrokeVertexIterator_init, /* tp_init */
+ nullptr, /* tp_alloc */
+ nullptr, /* tp_new */
};
///////////////////////////////////////////////////////////////////////////////////////////