diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-05-31 15:51:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-05-31 15:55:15 +0300 |
commit | d8dbd49a2f23b7637f05fc058f39bdf6ab706624 (patch) | |
tree | 0805b9372c82ae6505d87e879824efe1d3e32f8e /source/blender/freestyle/intern/python/Interface0D | |
parent | 8987f7987d8160e1f6e79e8c85d6ce65b885ab25 (diff) |
Cleanup: style, use braces in source/
Automated using clang-tidy.
Diffstat (limited to 'source/blender/freestyle/intern/python/Interface0D')
6 files changed, 56 insertions, 28 deletions
diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp index 8a5bb0b17ff..8e619ec95a4 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp @@ -88,10 +88,12 @@ static int CurvePoint_init(BPy_CurvePoint *self, PyObject *args, PyObject *kwds) float t2d; if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &CurvePoint_Type, &obj1)) { - if (!obj1) + if (!obj1) { self->cp = new CurvePoint(); - else + } + else { self->cp = new CurvePoint(*(((BPy_CurvePoint *)obj1)->cp)); + } } else if (PyErr_Clear(), PyArg_ParseTupleAndKeywords(args, @@ -148,8 +150,9 @@ PyDoc_STRVAR(CurvePoint_first_svertex_doc, static PyObject *CurvePoint_first_svertex_get(BPy_CurvePoint *self, void *UNUSED(closure)) { SVertex *A = self->cp->A(); - if (A) + if (A) { return BPy_SVertex_from_SVertex(*A); + } Py_RETURN_NONE; } @@ -173,8 +176,9 @@ PyDoc_STRVAR(CurvePoint_second_svertex_doc, static PyObject *CurvePoint_second_svertex_get(BPy_CurvePoint *self, void *UNUSED(closure)) { SVertex *B = self->cp->B(); - if (B) + if (B) { return BPy_SVertex_from_SVertex(*B); + } Py_RETURN_NONE; } @@ -201,8 +205,9 @@ static PyObject *CurvePoint_fedge_get(BPy_CurvePoint *self, void *UNUSED(closure SVertex *A = self->cp->A(); Interface0D *B = (Interface0D *)self->cp->B(); // B can be NULL under certain circumstances - if (B) + if (B) { return Any_BPy_Interface1D_from_Interface1D(*(A->getFEdge(*B))); + } Py_RETURN_NONE; } diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp index f4b8ca07d3f..08ad378ab75 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp @@ -65,10 +65,12 @@ static int SVertex_init(BPy_SVertex *self, PyObject *args, PyObject *kwds) float v[3]; if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &SVertex_Type, &obj)) { - if (!obj) + if (!obj) { self->sv = new SVertex(); - else + } + else { self->sv = new SVertex(*(((BPy_SVertex *)obj)->sv)); + } } else if (PyErr_Clear(), PyArg_ParseTupleAndKeywords( @@ -100,8 +102,9 @@ static PyObject *SVertex_add_normal(BPy_SVertex *self, PyObject *args, PyObject PyObject *py_normal; Vec3r n; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &py_normal)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &py_normal)) { return NULL; + } if (!Vec3r_ptr_from_PyObject(py_normal, n)) { PyErr_SetString(PyExc_TypeError, "argument 1 must be a 3D vector (either a list of 3 elements or Vector)"); @@ -124,8 +127,9 @@ static PyObject *SVertex_add_fedge(BPy_SVertex *self, PyObject *args, PyObject * static const char *kwlist[] = {"fedge", NULL}; PyObject *py_fe; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &FEdge_Type, &py_fe)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &FEdge_Type, &py_fe)) { return NULL; + } self->sv->AddFEdge(((BPy_FEdge *)py_fe)->fe); Py_RETURN_NONE; } @@ -152,8 +156,9 @@ static PyMethodDef BPy_SVertex_methods[] = { static int SVertex_mathutils_check(BaseMathObject *bmo) { - if (!BPy_SVertex_Check(bmo->cb_user)) + if (!BPy_SVertex_Check(bmo->cb_user)) { return -1; + } return 0; } @@ -378,8 +383,9 @@ PyDoc_STRVAR(SVertex_viewvertex_doc, static PyObject *SVertex_viewvertex_get(BPy_SVertex *self, void *UNUSED(closure)) { ViewVertex *vv = self->sv->viewvertex(); - if (vv) + if (vv) { return Any_BPy_ViewVertex_from_ViewVertex(*vv); + } Py_RETURN_NONE; } @@ -399,8 +405,9 @@ PyDoc_STRVAR(SVertex_curvatures_doc, static PyObject *SVertex_curvatures_get(BPy_SVertex *self, void *UNUSED(closure)) { const CurvatureInfo *info = self->sv->getCurvatureInfo(); - if (!info) + if (!info) { Py_RETURN_NONE; + } Vec3r e1(info->e1.x(), info->e1.y(), info->e1.z()); Vec3r e2(info->e2.x(), info->e2.y(), info->e2.z()); Vec3r er(info->er.x(), info->er.y(), info->er.z()); diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp index 1ff46482911..29bba040316 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp @@ -105,8 +105,9 @@ static PyObject *ViewVertex_edges_iterator(BPy_ViewVertex *self, PyObject *args, static const char *kwlist[] = {"edge", NULL}; PyObject *py_ve; - if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewEdge_Type, &py_ve)) + if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewEdge_Type, &py_ve)) { return NULL; + } ViewEdge *ve = ((BPy_ViewEdge *)py_ve)->ve; ViewVertexInternal::orientedViewEdgeIterator ove_it(self->vv->edgesIterator(ve)); return BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator(ove_it, false); @@ -132,8 +133,9 @@ PyDoc_STRVAR(ViewVertex_nature_doc, static PyObject *ViewVertex_nature_get(BPy_ViewVertex *self, void *UNUSED(closure)) { Nature::VertexNature nature = self->vv->getNature(); - if (PyErr_Occurred()) + if (PyErr_Occurred()) { return NULL; + } return BPy_Nature_from_Nature(nature); // return a copy } diff --git a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp index 3637899fbc2..503dd3bf044 100644 --- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp @@ -149,10 +149,12 @@ static int StrokeVertex_init(BPy_StrokeVertex *self, PyObject *args, PyObject *k &obj1, &StrokeAttribute_Type, &obj2)) { - if (!obj2) + if (!obj2) { self->sv = new StrokeVertex(((BPy_SVertex *)obj1)->sv); - else + } + else { self->sv = new StrokeVertex(((BPy_SVertex *)obj1)->sv, *(((BPy_StrokeAttribute *)obj2)->sa)); + } } else { PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); @@ -171,8 +173,9 @@ static int StrokeVertex_init(BPy_StrokeVertex *self, PyObject *args, PyObject *k static int StrokeVertex_mathutils_check(BaseMathObject *bmo) { - if (!BPy_StrokeVertex_Check(bmo->cb_user)) + if (!BPy_StrokeVertex_Check(bmo->cb_user)) { return -1; + } return 0; } diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp index 87873677189..315c0b16061 100644 --- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp @@ -55,12 +55,15 @@ static int NonTVertex_init(BPy_NonTVertex *self, PyObject *args, PyObject *kwds) static const char *kwlist[] = {"svertex", NULL}; PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &SVertex_Type, &obj)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &SVertex_Type, &obj)) { return -1; - if (!obj) + } + if (!obj) { self->ntv = new NonTVertex(); - else + } + else { self->ntv = new NonTVertex(((BPy_SVertex *)obj)->sv); + } self->py_vv.vv = self->ntv; self->py_vv.py_if0D.if0D = self->ntv; self->py_vv.py_if0D.borrowed = false; @@ -77,8 +80,9 @@ PyDoc_STRVAR(NonTVertex_svertex_doc, static PyObject *NonTVertex_svertex_get(BPy_NonTVertex *self, void *UNUSED(closure)) { SVertex *v = self->ntv->svertex(); - if (v) + if (v) { return BPy_SVertex_from_SVertex(*v); + } Py_RETURN_NONE; } diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp index 9a8592aaea5..7b23fdb04f1 100644 --- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp @@ -53,8 +53,9 @@ static int TVertex_init(BPy_TVertex *self, PyObject *args, PyObject *kwds) { static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; + } self->tv = new TVertex(); self->py_vv.vv = self->tv; self->py_vv.py_if0D.if0D = self->tv; @@ -77,11 +78,13 @@ static PyObject *TVertex_get_svertex(BPy_TVertex *self, PyObject *args, PyObject static const char *kwlist[] = {"fedge", NULL}; PyObject *py_fe; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &FEdge_Type, &py_fe)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &FEdge_Type, &py_fe)) { return NULL; + } SVertex *sv = self->tv->getSVertex(((BPy_FEdge *)py_fe)->fe); - if (sv) + if (sv) { return BPy_SVertex_from_SVertex(*sv); + } Py_RETURN_NONE; } @@ -102,11 +105,13 @@ static PyObject *TVertex_get_mate(BPy_TVertex *self, PyObject *args, PyObject *k static const char *kwlist[] = {"viewedge", NULL}; PyObject *py_ve; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewEdge_Type, &py_ve)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewEdge_Type, &py_ve)) { return NULL; + } ViewEdge *ve = self->tv->mate(((BPy_ViewEdge *)py_ve)->ve); - if (ve) + if (ve) { return BPy_ViewEdge_from_ViewEdge(*ve); + } Py_RETURN_NONE; } @@ -132,8 +137,9 @@ PyDoc_STRVAR(TVertex_front_svertex_doc, static PyObject *TVertex_front_svertex_get(BPy_TVertex *self, void *UNUSED(closure)) { SVertex *v = self->tv->frontSVertex(); - if (v) + if (v) { return BPy_SVertex_from_SVertex(*v); + } Py_RETURN_NONE; } @@ -155,8 +161,9 @@ PyDoc_STRVAR(TVertex_back_svertex_doc, static PyObject *TVertex_back_svertex_get(BPy_TVertex *self, void *UNUSED(closure)) { SVertex *v = self->tv->backSVertex(); - if (v) + if (v) { return BPy_SVertex_from_SVertex(*v); + } Py_RETURN_NONE; } |