diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-08-07 13:39:05 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-08-07 14:38:06 +0300 |
commit | 326e137a8cfaac6587a83d4c61d2889832926827 (patch) | |
tree | 07f7e924eec6372fe9e9b24481f420b20777fa13 /source/blender/freestyle/intern/python | |
parent | 94eaaf097c3af408cdf84bb38aa295d01a84a741 (diff) |
Cleanup: Freestyle, Clang-Tidy else-after-return fixes
This addresses warnings from Clang-Tidy's `readability-else-after-return`
rule in the `source/blender/freestyle` module.
No functional changes.
Diffstat (limited to 'source/blender/freestyle/intern/python')
5 files changed, 31 insertions, 34 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_Convert.cpp b/source/blender/freestyle/intern/python/BPy_Convert.cpp index 427e4198e5c..03f9760344b 100644 --- a/source/blender/freestyle/intern/python/BPy_Convert.cpp +++ b/source/blender/freestyle/intern/python/BPy_Convert.cpp @@ -110,22 +110,22 @@ PyObject *Any_BPy_Interface0D_from_Interface0D(Interface0D &if0D) if (typeid(if0D) == typeid(CurvePoint)) { return BPy_CurvePoint_from_CurvePoint(dynamic_cast<CurvePoint &>(if0D)); } - else if (typeid(if0D) == typeid(StrokeVertex)) { + if (typeid(if0D) == typeid(StrokeVertex)) { return BPy_StrokeVertex_from_StrokeVertex(dynamic_cast<StrokeVertex &>(if0D)); } - else if (typeid(if0D) == typeid(SVertex)) { + if (typeid(if0D) == typeid(SVertex)) { return BPy_SVertex_from_SVertex(dynamic_cast<SVertex &>(if0D)); } - else if (typeid(if0D) == typeid(ViewVertex)) { + if (typeid(if0D) == typeid(ViewVertex)) { return BPy_ViewVertex_from_ViewVertex(dynamic_cast<ViewVertex &>(if0D)); } - else if (typeid(if0D) == typeid(NonTVertex)) { + if (typeid(if0D) == typeid(NonTVertex)) { return BPy_NonTVertex_from_NonTVertex(dynamic_cast<NonTVertex &>(if0D)); } - else if (typeid(if0D) == typeid(TVertex)) { + if (typeid(if0D) == typeid(TVertex)) { return BPy_TVertex_from_TVertex(dynamic_cast<TVertex &>(if0D)); } - else if (typeid(if0D) == typeid(Interface0D)) { + if (typeid(if0D) == typeid(Interface0D)) { return BPy_Interface0D_from_Interface0D(if0D); } string msg("unexpected type: " + if0D.getExactTypeName()); @@ -138,22 +138,22 @@ PyObject *Any_BPy_Interface1D_from_Interface1D(Interface1D &if1D) if (typeid(if1D) == typeid(ViewEdge)) { return BPy_ViewEdge_from_ViewEdge(dynamic_cast<ViewEdge &>(if1D)); } - else if (typeid(if1D) == typeid(Chain)) { + if (typeid(if1D) == typeid(Chain)) { return BPy_Chain_from_Chain(dynamic_cast<Chain &>(if1D)); } - else if (typeid(if1D) == typeid(Stroke)) { + if (typeid(if1D) == typeid(Stroke)) { return BPy_Stroke_from_Stroke(dynamic_cast<Stroke &>(if1D)); } - else if (typeid(if1D) == typeid(FEdgeSharp)) { + if (typeid(if1D) == typeid(FEdgeSharp)) { return BPy_FEdgeSharp_from_FEdgeSharp(dynamic_cast<FEdgeSharp &>(if1D)); } - else if (typeid(if1D) == typeid(FEdgeSmooth)) { + if (typeid(if1D) == typeid(FEdgeSmooth)) { return BPy_FEdgeSmooth_from_FEdgeSmooth(dynamic_cast<FEdgeSmooth &>(if1D)); } - else if (typeid(if1D) == typeid(FEdge)) { + if (typeid(if1D) == typeid(FEdge)) { return BPy_FEdge_from_FEdge(dynamic_cast<FEdge &>(if1D)); } - else if (typeid(if1D) == typeid(Interface1D)) { + if (typeid(if1D) == typeid(Interface1D)) { return BPy_Interface1D_from_Interface1D(if1D); } string msg("unexpected type: " + if1D.getExactTypeName()); @@ -166,10 +166,10 @@ PyObject *Any_BPy_FEdge_from_FEdge(FEdge &fe) if (typeid(fe) == typeid(FEdgeSharp)) { return BPy_FEdgeSharp_from_FEdgeSharp(dynamic_cast<FEdgeSharp &>(fe)); } - else if (typeid(fe) == typeid(FEdgeSmooth)) { + if (typeid(fe) == typeid(FEdgeSmooth)) { return BPy_FEdgeSmooth_from_FEdgeSmooth(dynamic_cast<FEdgeSmooth &>(fe)); } - else if (typeid(fe) == typeid(FEdge)) { + if (typeid(fe) == typeid(FEdge)) { return BPy_FEdge_from_FEdge(fe); } string msg("unexpected type: " + fe.getExactTypeName()); @@ -182,10 +182,10 @@ PyObject *Any_BPy_ViewVertex_from_ViewVertex(ViewVertex &vv) if (typeid(vv) == typeid(NonTVertex)) { return BPy_NonTVertex_from_NonTVertex(dynamic_cast<NonTVertex &>(vv)); } - else if (typeid(vv) == typeid(TVertex)) { + if (typeid(vv) == typeid(TVertex)) { return BPy_TVertex_from_TVertex(dynamic_cast<TVertex &>(vv)); } - else if (typeid(vv) == typeid(ViewVertex)) { + if (typeid(vv) == typeid(ViewVertex)) { return BPy_ViewVertex_from_ViewVertex(vv); } string msg("unexpected type: " + vv.getExactTypeName()); @@ -773,7 +773,7 @@ bool float_array_from_PyObject(PyObject *obj, float *v, int n) } return 1; } - else if (ColorObject_Check(obj) && n == 3) { + if (ColorObject_Check(obj) && n == 3) { if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1) { return 0; } @@ -782,10 +782,10 @@ bool float_array_from_PyObject(PyObject *obj, float *v, int n) } return 1; } - else if (PyList_Check(obj) && PyList_GET_SIZE(obj) == n) { + if (PyList_Check(obj) && PyList_GET_SIZE(obj) == n) { return float_array_from_PyList(obj, v, n); } - else if (PyTuple_Check(obj) && PyTuple_GET_SIZE(obj) == n) { + if (PyTuple_Check(obj) && PyTuple_GET_SIZE(obj) == n) { return float_array_from_PyTuple(obj, v, n); } return 0; diff --git a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp index 3c2f022adb6..dbf1c12fb01 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp @@ -508,9 +508,8 @@ static PyObject *BPy_FrsMaterial_richcmpr(PyObject *objectA, if (comparison_type == Py_NE) { Py_RETURN_TRUE; } - else { - Py_RETURN_FALSE; - } + + Py_RETURN_FALSE; } matA = (BPy_FrsMaterial *)objectA; @@ -531,9 +530,8 @@ static PyObject *BPy_FrsMaterial_richcmpr(PyObject *objectA, if (result == true) { Py_RETURN_TRUE; } - else { - Py_RETURN_FALSE; - } + + Py_RETURN_FALSE; } static Py_hash_t FrsMaterial_hash(PyObject *self) diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp index 98b0099bcad..9c155db913c 100644 --- a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp +++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp @@ -88,21 +88,20 @@ static PyObject *Integrator_integrate(PyObject * /*self*/, PyObject *args, PyObj double res = integrate(*fun, it, it_end, t); return PyFloat_FromDouble(res); } - else if (BPy_UnaryFunction0DFloat_Check(obj1)) { + if (BPy_UnaryFunction0DFloat_Check(obj1)) { UnaryFunction0D<float> *fun = ((BPy_UnaryFunction0DFloat *)obj1)->uf0D_float; float res = integrate(*fun, it, it_end, t); return PyFloat_FromDouble(res); } - else if (BPy_UnaryFunction0DUnsigned_Check(obj1)) { + if (BPy_UnaryFunction0DUnsigned_Check(obj1)) { UnaryFunction0D<unsigned int> *fun = ((BPy_UnaryFunction0DUnsigned *)obj1)->uf0D_unsigned; unsigned int res = integrate(*fun, it, it_end, t); return PyLong_FromLong(res); } - else { - string class_name(Py_TYPE(obj1)->tp_name); - PyErr_SetString(PyExc_TypeError, ("unsupported function type: " + class_name).c_str()); - return NULL; - } + + string class_name(Py_TYPE(obj1)->tp_name); + PyErr_SetString(PyExc_TypeError, ("unsupported function type: " + class_name).c_str()); + return NULL; } /*-----------------------Integrator module docstring---------------------------------------*/ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp index f0d6acf461b..734ed0117f4 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp @@ -124,7 +124,7 @@ static PyObject *Interface0DIterator_iternext(BPy_Interface0DIterator *self) PyErr_SetNone(PyExc_StopIteration); return NULL; } - else if (self->at_start) { + if (self->at_start) { self->at_start = false; } else if (self->if0D_it->atLast()) { diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp index df03ecba96f..cda4031240b 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp @@ -125,7 +125,7 @@ static PyObject *StrokeVertexIterator_iternext(BPy_StrokeVertexIterator *self) } /* If at the start of the iterator, only return the object * and don't increment, to keep for-loops in sync */ - else if (self->at_start) { + if (self->at_start) { self->at_start = false; } /* If sv_it.atLast() is true, the iterator is currently pointing to the final valid element. |