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/Interface1D | |
parent | 8987f7987d8160e1f6e79e8c85d6ce65b885ab25 (diff) |
Cleanup: style, use braces in source/
Automated using clang-tidy.
Diffstat (limited to 'source/blender/freestyle/intern/python/Interface1D')
7 files changed, 107 insertions, 53 deletions
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp index 7ca783d9aa4..070e54c9305 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp @@ -74,10 +74,12 @@ static int FEdge_init(BPy_FEdge *self, PyObject *args, PyObject *kwds) PyObject *obj1 = 0, *obj2 = 0; if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FEdge_Type, &obj1)) { - if (!obj1) + if (!obj1) { self->fe = new FEdge(); - else + } + else { self->fe = new FEdge(*(((BPy_FEdge *)obj1)->fe)); + } } else if (PyErr_Clear(), PyArg_ParseTupleAndKeywords(args, @@ -108,12 +110,14 @@ static Py_ssize_t FEdge_sq_length(BPy_FEdge * /*self*/) static PyObject *FEdge_sq_item(BPy_FEdge *self, int keynum) { - if (keynum < 0) + if (keynum < 0) { keynum += FEdge_sq_length(self); + } if (keynum == 0 || keynum == 1) { SVertex *v = self->fe->operator[](keynum); - if (v) + if (v) { return BPy_SVertex_from_SVertex(*v); + } Py_RETURN_NONE; } PyErr_Format(PyExc_IndexError, "FEdge[index]: index %d out of range", keynum); @@ -143,8 +147,9 @@ PyDoc_STRVAR(FEdge_first_svertex_doc, static PyObject *FEdge_first_svertex_get(BPy_FEdge *self, void *UNUSED(closure)) { SVertex *A = self->fe->vertexA(); - if (A) + if (A) { return BPy_SVertex_from_SVertex(*A); + } Py_RETURN_NONE; } @@ -166,8 +171,9 @@ PyDoc_STRVAR(FEdge_second_svertex_doc, static PyObject *FEdge_second_svertex_get(BPy_FEdge *self, void *UNUSED(closure)) { SVertex *B = self->fe->vertexB(); - if (B) + if (B) { return BPy_SVertex_from_SVertex(*B); + } Py_RETURN_NONE; } @@ -190,8 +196,9 @@ PyDoc_STRVAR(FEdge_next_fedge_doc, static PyObject *FEdge_next_fedge_get(BPy_FEdge *self, void *UNUSED(closure)) { FEdge *fe = self->fe->nextEdge(); - if (fe) + if (fe) { return Any_BPy_FEdge_from_FEdge(*fe); + } Py_RETURN_NONE; } @@ -214,8 +221,9 @@ PyDoc_STRVAR(FEdge_previous_fedge_doc, static PyObject *FEdge_previous_fedge_get(BPy_FEdge *self, void *UNUSED(closure)) { FEdge *fe = self->fe->previousEdge(); - if (fe) + if (fe) { return Any_BPy_FEdge_from_FEdge(*fe); + } Py_RETURN_NONE; } @@ -237,8 +245,9 @@ PyDoc_STRVAR(FEdge_viewedge_doc, static PyObject *FEdge_viewedge_get(BPy_FEdge *self, void *UNUSED(closure)) { ViewEdge *ve = self->fe->viewedge(); - if (ve) + if (ve) { return BPy_ViewEdge_from_ViewEdge(*ve); + } Py_RETURN_NONE; } diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp index 1d2d4f51028..932911fb6e6 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp @@ -65,10 +65,12 @@ static int FrsCurve_init(BPy_FrsCurve *self, PyObject *args, PyObject *kwds) PyObject *obj = 0; if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FrsCurve_Type, &obj)) { - if (!obj) + if (!obj) { self->c = new Curve(); - else + } + else { self->c = new Curve(*(((BPy_FrsCurve *)obj)->c)); + } } else if (PyErr_Clear(), PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_2, &Id_Type, &obj)) { @@ -96,8 +98,9 @@ static PyObject *FrsCurve_push_vertex_back(BPy_FrsCurve *self, PyObject *args, P static const char *kwlist[] = {"vertex", NULL}; PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj)) { return NULL; + } if (BPy_CurvePoint_Check(obj)) { self->c->push_vertex_back(((BPy_CurvePoint *)obj)->cp); @@ -125,8 +128,9 @@ static PyObject *FrsCurve_push_vertex_front(BPy_FrsCurve *self, PyObject *args, static const char *kwlist[] = {"vertex", NULL}; PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj)) { return NULL; + } if (BPy_CurvePoint_Check(obj)) { self->c->push_vertex_front(((BPy_CurvePoint *)obj)->cp); diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp index 423a61c7f1d..8ba22b0617a 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp @@ -62,12 +62,15 @@ static int Stroke_init(BPy_Stroke *self, PyObject *args, PyObject *kwds) static const char *kwlist[] = {"brother", NULL}; PyObject *brother = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &Stroke_Type, &brother)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &Stroke_Type, &brother)) { return -1; - if (!brother) + } + if (!brother) { self->s = new Stroke(); - else + } + else { self->s = new Stroke(*(((BPy_Stroke *)brother)->s)); + } self->py_if1D.if1D = self->s; self->py_if1D.borrowed = false; return 0; @@ -86,8 +89,9 @@ static Py_ssize_t Stroke_sq_length(BPy_Stroke *self) static PyObject *Stroke_sq_item(BPy_Stroke *self, int keynum) { - if (keynum < 0) + if (keynum < 0) { keynum += Stroke_sq_length(self); + } if (keynum < 0 || keynum >= Stroke_sq_length(self)) { PyErr_Format(PyExc_IndexError, "Stroke[index]: index %d out of range", keynum); return NULL; @@ -115,8 +119,9 @@ static PyObject *Stroke_compute_sampling(BPy_Stroke *self, PyObject *args, PyObj static const char *kwlist[] = {"n", NULL}; int i; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i)) { return NULL; + } return PyFloat_FromDouble(self->s->ComputeSampling(i)); } @@ -215,8 +220,10 @@ static PyObject *Stroke_remove_vertex(BPy_Stroke *self, PyObject *args, PyObject static const char *kwlist[] = {"vertex", NULL}; PyObject *py_sv = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &StrokeVertex_Type, &py_sv)) + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist, &StrokeVertex_Type, &py_sv)) { return NULL; + } if (((BPy_StrokeVertex *)py_sv)->sv) { self->s->RemoveVertex(((BPy_StrokeVertex *)py_sv)->sv); } @@ -267,8 +274,9 @@ static PyObject *Stroke_stroke_vertices_begin(BPy_Stroke *self, PyObject *args, static const char *kwlist[] = {"t", NULL}; float f = 0.0f; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f)) { return NULL; + } StrokeInternal::StrokeVertexIterator sv_it(self->s->strokeVerticesBegin(f)); return BPy_StrokeVertexIterator_from_StrokeVertexIterator(sv_it, false); } @@ -386,8 +394,9 @@ static PyObject *Stroke_texture_id_get(BPy_Stroke *self, void *UNUSED(closure)) static int Stroke_texture_id_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure)) { unsigned int i = PyLong_AsUnsignedLong(value); - if (PyErr_Occurred()) + if (PyErr_Occurred()) { return -1; + } self->s->setTextureId(i); return 0; } @@ -404,8 +413,9 @@ static PyObject *Stroke_tips_get(BPy_Stroke *self, void *UNUSED(closure)) static int Stroke_tips_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure)) { - if (!PyBool_Check(value)) + if (!PyBool_Check(value)) { return -1; + } self->s->setTips(bool_from_PyBool(value)); return 0; } diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp index 6331145974a..208d6cbfd6d 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp @@ -59,12 +59,15 @@ static int ViewEdge_init(BPy_ViewEdge *self, PyObject *args, PyObject *kwds) static const char *kwlist[] = {"brother", NULL}; PyObject *brother = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &ViewEdge_Type, &brother)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &ViewEdge_Type, &brother)) { return -1; - if (!brother) + } + if (!brother) { self->ve = new ViewEdge(); - else + } + else { self->ve = new ViewEdge(*(((BPy_ViewEdge *)brother)->ve)); + } self->py_if1D.if1D = self->ve; self->py_if1D.borrowed = false; return 0; @@ -99,8 +102,9 @@ PyDoc_STRVAR(ViewEdge_first_viewvertex_doc, static PyObject *ViewEdge_first_viewvertex_get(BPy_ViewEdge *self, void *UNUSED(closure)) { ViewVertex *v = self->ve->A(); - if (v) + if (v) { return Any_BPy_ViewVertex_from_ViewVertex(*v); + } Py_RETURN_NONE; } @@ -108,8 +112,9 @@ static int ViewEdge_first_viewvertex_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_ViewVertex_Check(value)) + if (!BPy_ViewVertex_Check(value)) { return -1; + } self->ve->setA(((BPy_ViewVertex *)value)->vv); return 0; } @@ -122,15 +127,17 @@ PyDoc_STRVAR(ViewEdge_last_viewvertex_doc, static PyObject *ViewEdge_last_viewvertex_get(BPy_ViewEdge *self, void *UNUSED(closure)) { ViewVertex *v = self->ve->B(); - if (v) + if (v) { return Any_BPy_ViewVertex_from_ViewVertex(*v); + } Py_RETURN_NONE; } static int ViewEdge_last_viewvertex_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_ViewVertex_Check(value)) + if (!BPy_ViewVertex_Check(value)) { return -1; + } self->ve->setB(((BPy_ViewVertex *)value)->vv); return 0; } @@ -143,15 +150,17 @@ PyDoc_STRVAR(ViewEdge_first_fedge_doc, static PyObject *ViewEdge_first_fedge_get(BPy_ViewEdge *self, void *UNUSED(closure)) { FEdge *fe = self->ve->fedgeA(); - if (fe) + if (fe) { return Any_BPy_FEdge_from_FEdge(*fe); + } Py_RETURN_NONE; } static int ViewEdge_first_fedge_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_FEdge_Check(value)) + if (!BPy_FEdge_Check(value)) { return -1; + } self->ve->setFEdgeA(((BPy_FEdge *)value)->fe); return 0; } @@ -164,15 +173,17 @@ PyDoc_STRVAR(ViewEdge_last_fedge_doc, static PyObject *ViewEdge_last_fedge_get(BPy_ViewEdge *self, void *UNUSED(closure)) { FEdge *fe = self->ve->fedgeB(); - if (fe) + if (fe) { return Any_BPy_FEdge_from_FEdge(*fe); + } Py_RETURN_NONE; } static int ViewEdge_last_fedge_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_FEdge_Check(value)) + if (!BPy_FEdge_Check(value)) { return -1; + } self->ve->setFEdgeB(((BPy_FEdge *)value)->fe); return 0; } @@ -185,15 +196,17 @@ PyDoc_STRVAR(ViewEdge_viewshape_doc, static PyObject *ViewEdge_viewshape_get(BPy_ViewEdge *self, void *UNUSED(closure)) { ViewShape *vs = self->ve->viewShape(); - if (vs) + if (vs) { return BPy_ViewShape_from_ViewShape(*vs); + } Py_RETURN_NONE; } static int ViewEdge_viewshape_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_ViewShape_Check(value)) + if (!BPy_ViewShape_Check(value)) { return -1; + } self->ve->setShape(((BPy_ViewShape *)value)->vs); return 0; } @@ -207,15 +220,17 @@ PyDoc_STRVAR(ViewEdge_occludee_doc, static PyObject *ViewEdge_occludee_get(BPy_ViewEdge *self, void *UNUSED(closure)) { ViewShape *vs = self->ve->aShape(); - if (vs) + if (vs) { return BPy_ViewShape_from_ViewShape(*vs); + } Py_RETURN_NONE; } static int ViewEdge_occludee_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_ViewShape_Check(value)) + if (!BPy_ViewShape_Check(value)) { return -1; + } self->ve->setaShape(((BPy_ViewShape *)value)->vs); return 0; } @@ -285,8 +300,9 @@ static int ViewEdge_qi_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(clo { int qi; - if ((qi = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) + if ((qi = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) { return -1; + } self->ve->setQI(qi); return 0; } @@ -307,8 +323,9 @@ static int ViewEdge_chaining_time_stamp_set(BPy_ViewEdge *self, { int timestamp; - if ((timestamp = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) + if ((timestamp = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) { return -1; + } self->ve->setChainingTimeStamp(timestamp); return 0; } diff --git a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp index 7a6b2a01728..285100193d3 100644 --- a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp @@ -64,10 +64,12 @@ static int Chain_init(BPy_Chain *self, PyObject *args, PyObject *kwds) PyObject *obj = 0; if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &Chain_Type, &obj)) { - if (!obj) + if (!obj) { self->c = new Chain(); - else + } + else { self->c = new Chain(*(((BPy_Chain *)obj)->c)); + } } else if (PyErr_Clear(), PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_2, &Id_Type, &obj)) { diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp index e91ae155929..018d0c77bb0 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp @@ -68,10 +68,12 @@ static int FEdgeSharp_init(BPy_FEdgeSharp *self, PyObject *args, PyObject *kwds) PyObject *obj1 = 0, *obj2 = 0; if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FEdgeSharp_Type, &obj1)) { - if (!obj1) + if (!obj1) { self->fes = new FEdgeSharp(); - else + } + else { self->fes = new FEdgeSharp(*(((BPy_FEdgeSharp *)obj1)->fes)); + } } else if (PyErr_Clear(), PyArg_ParseTupleAndKeywords(args, @@ -102,8 +104,9 @@ static int FEdgeSharp_init(BPy_FEdgeSharp *self, PyObject *args, PyObject *kwds) static int FEdgeSharp_mathutils_check(BaseMathObject *bmo) { - if (!BPy_FEdgeSharp_Check(bmo->cb_user)) + if (!BPy_FEdgeSharp_Check(bmo->cb_user)) { return -1; + } return 0; } @@ -266,8 +269,9 @@ static int FEdgeSharp_material_index_right_set(BPy_FEdgeSharp *self, void *UNUSED(closure)) { unsigned int i = PyLong_AsUnsignedLong(value); - if (PyErr_Occurred()) + if (PyErr_Occurred()) { return -1; + } self->fes->setaFrsMaterialIndex(i); return 0; } @@ -287,8 +291,9 @@ static int FEdgeSharp_material_index_left_set(BPy_FEdgeSharp *self, void *UNUSED(closure)) { unsigned int i = PyLong_AsUnsignedLong(value); - if (PyErr_Occurred()) + if (PyErr_Occurred()) { return -1; + } self->fes->setbFrsMaterialIndex(i); return 0; } @@ -330,8 +335,9 @@ static int FEdgeSharp_face_mark_right_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure)) { - if (!PyBool_Check(value)) + if (!PyBool_Check(value)) { return -1; + } self->fes->setaFaceMark(bool_from_PyBool(value)); return 0; } @@ -350,8 +356,9 @@ static int FEdgeSharp_face_mark_left_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure)) { - if (!PyBool_Check(value)) + if (!PyBool_Check(value)) { return -1; + } self->fes->setbFaceMark(bool_from_PyBool(value)); return 0; } diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp index 08d18123172..4c2785509f0 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp @@ -66,10 +66,12 @@ static int FEdgeSmooth_init(BPy_FEdgeSmooth *self, PyObject *args, PyObject *kwd if (PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist_1, &FEdgeSmooth_Type, &obj1)) { - if (!obj1) + if (!obj1) { self->fes = new FEdgeSmooth(); - else + } + else { self->fes = new FEdgeSmooth(*(((BPy_FEdgeSmooth *)obj1)->fes)); + } } else if (PyErr_Clear(), PyArg_ParseTupleAndKeywords(args, @@ -96,8 +98,9 @@ static int FEdgeSmooth_init(BPy_FEdgeSmooth *self, PyObject *args, PyObject *kwd static int FEdgeSmooth_mathutils_check(BaseMathObject *bmo) { - if (!BPy_FEdgeSmooth_Check(bmo->cb_user)) + if (!BPy_FEdgeSmooth_Check(bmo->cb_user)) { return -1; + } return 0; } @@ -189,8 +192,9 @@ static int FEdgeSmooth_material_index_set(BPy_FEdgeSmooth *self, void *UNUSED(closure)) { unsigned int i = PyLong_AsUnsignedLong(value); - if (PyErr_Occurred()) + if (PyErr_Occurred()) { return -1; + } self->fes->setFrsMaterialIndex(i); return 0; } @@ -217,8 +221,9 @@ static PyObject *FEdgeSmooth_face_mark_get(BPy_FEdgeSmooth *self, void *UNUSED(c static int FEdgeSmooth_face_mark_set(BPy_FEdgeSmooth *self, PyObject *value, void *UNUSED(closure)) { - if (!PyBool_Check(value)) + if (!PyBool_Check(value)) { return -1; + } self->fes->setFaceMark(bool_from_PyBool(value)); return 0; } |