From 8d44c4735ec29984f93dcbf4cdc792ab08831e83 Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Thu, 14 Feb 2013 23:50:30 +0000 Subject: Minor coding style clean-up. --- .../blender/freestyle/intern/python/BPy_BBox.cpp | 31 ++++----- .../freestyle/intern/python/BPy_FrsMaterial.cpp | 44 ++++++------ .../intern/python/BPy_IntegrationType.cpp | 79 +++++++++++----------- .../freestyle/intern/python/BPy_MediumType.cpp | 7 +- .../blender/freestyle/intern/python/BPy_Nature.cpp | 74 ++++++++++---------- .../Interface0D/CurvePoint/BPy_StrokeVertex.cpp | 30 ++++---- .../intern/python/Interface1D/Curve/BPy_Chain.cpp | 45 ++++++------ 7 files changed, 150 insertions(+), 160 deletions(-) (limited to 'source/blender/freestyle/intern') diff --git a/source/blender/freestyle/intern/python/BPy_BBox.cpp b/source/blender/freestyle/intern/python/BPy_BBox.cpp index 0acd32bad58..3f2218110aa 100644 --- a/source/blender/freestyle/intern/python/BPy_BBox.cpp +++ b/source/blender/freestyle/intern/python/BPy_BBox.cpp @@ -9,40 +9,39 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int BBox_Init( PyObject *module ) { - if( module == NULL ) + if (module == NULL) return -1; - if( PyType_Ready( &BBox_Type ) < 0 ) + if (PyType_Ready( &BBox_Type ) < 0) return -1; - Py_INCREF( &BBox_Type ); PyModule_AddObject(module, "BBox", (PyObject *)&BBox_Type); + return 0; } //------------------------INSTANCE METHODS ---------------------------------- -static char BBox___doc__[] = -"Class for representing a bounding box.\n"; +PyDoc_STRVAR(BBox_doc, +"Class for representing a bounding box.\n"); -static int BBox___init__(BPy_BBox *self, PyObject *args, PyObject *kwds) +static int BBox_init(BPy_BBox *self, PyObject *args, PyObject *kwds) { - if(!( PyArg_ParseTuple(args, "") )) + if (!PyArg_ParseTuple(args, "")) return -1; self->bb = new BBox< Vec3r>(); return 0; } -static void BBox___dealloc__(BPy_BBox* self) +static void BBox_dealloc(BPy_BBox* self) { delete self->bb; - Py_TYPE(self)->tp_free((PyObject*)self); + Py_TYPE(self)->tp_free((PyObject*)self); } - -static PyObject * BBox___repr__(BPy_BBox* self) +static PyObject * BBox_repr(BPy_BBox* self) { - return PyUnicode_FromFormat("BBox - address: %p", self->bb ); + return PyUnicode_FromFormat("BBox - address: %p", self->bb); } /*----------------------BBox instance definitions ----------------------------*/ @@ -57,12 +56,12 @@ PyTypeObject BBox_Type = { "BBox", /* tp_name */ sizeof(BPy_BBox), /* tp_basicsize */ 0, /* tp_itemsize */ - (destructor)BBox___dealloc__, /* tp_dealloc */ + (destructor)BBox_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ - (reprfunc)BBox___repr__, /* tp_repr */ + (reprfunc)BBox_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ @@ -73,7 +72,7 @@ PyTypeObject BBox_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - BBox___doc__, /* tp_doc */ + BBox_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -88,7 +87,7 @@ PyTypeObject BBox_Type = { 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ - (initproc)BBox___init__, /* tp_init */ + (initproc)BBox_init, /* tp_init */ 0, /* tp_alloc */ PyType_GenericNew, /* tp_new */ }; diff --git a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp index 4222a44ff1c..153d454a720 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp @@ -13,22 +13,22 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int FrsMaterial_Init( PyObject *module ) { - if( module == NULL ) + if (module == NULL) return -1; - if( PyType_Ready( &FrsMaterial_Type ) < 0 ) + if (PyType_Ready( &FrsMaterial_Type ) < 0) return -1; - Py_INCREF( &FrsMaterial_Type ); PyModule_AddObject(module, "Material", (PyObject *)&FrsMaterial_Type); FrsMaterial_mathutils_register_callback(); + return 0; } //------------------------INSTANCE METHODS ---------------------------------- -static char FrsMaterial___doc__[] = +PyDoc_STRVAR(FrsMaterial_doc, "Class defining a material.\n" "\n" ".. method:: __init__()\n" @@ -56,31 +56,31 @@ static char FrsMaterial___doc__[] = " :arg iEmission: The emissive color.\n" " :type iEmission: :class:`mathutils.Vector`, list or tuple of 4 float values\n" " :arg iShininess: The shininess coefficient.\n" -" :type iShininess: :class:float\n"; +" :type iShininess: :class:float"); -static int FrsMaterial___init__(BPy_FrsMaterial *self, PyObject *args, PyObject *kwds) +static int FrsMaterial_init(BPy_FrsMaterial *self, PyObject *args, PyObject *kwds) { PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0, *obj4 = 0; float f1[4], f2[4], f3[4], f4[4], f5 = 0.; - if (! PyArg_ParseTuple(args, "|OOOOf", &obj1, &obj2, &obj3, &obj4, &f5) ) - return -1; + if (!PyArg_ParseTuple(args, "|OOOOf", &obj1, &obj2, &obj3, &obj4, &f5)) + return -1; - if( !obj1 ){ + if (!obj1) { self->m = new FrsMaterial(); - } else if( BPy_FrsMaterial_Check(obj1) && !obj2 ) { + } else if (BPy_FrsMaterial_Check(obj1) && !obj2) { FrsMaterial *m = ((BPy_FrsMaterial *) obj1)->m; - if( !m ) { + if (!m) { PyErr_SetString(PyExc_RuntimeError, "invalid FrsMaterial object"); return -1; } self->m = new FrsMaterial( *m ); - } else if( float_array_from_PyObject(obj1, f1, 4) && obj2 && + } else if (float_array_from_PyObject(obj1, f1, 4) && obj2 && float_array_from_PyObject(obj2, f2, 4) && obj3 && float_array_from_PyObject(obj3, f3, 4) && obj4 && - float_array_from_PyObject(obj4, f4, 4) ) { + float_array_from_PyObject(obj4, f4, 4)) { self->m = new FrsMaterial(f1, f2, f3, f4, f5); } else { @@ -92,17 +92,17 @@ static int FrsMaterial___init__(BPy_FrsMaterial *self, PyObject *args, PyObject return 0; } -static void FrsMaterial___dealloc__( BPy_FrsMaterial* self) +static void FrsMaterial_dealloc(BPy_FrsMaterial* self) { - if( self->m && !self->borrowed ) + if (self->m && !self->borrowed) delete self->m; - Py_TYPE(self)->tp_free((PyObject*)self); + Py_TYPE(self)->tp_free((PyObject*)self); } -static PyObject * FrsMaterial___repr__( BPy_FrsMaterial* self) +static PyObject * FrsMaterial_repr(BPy_FrsMaterial* self) { - return PyUnicode_FromFormat("Material - address: %p", self->m ); + return PyUnicode_FromFormat("Material - address: %p", self->m); } /*----------------------FrsMaterial instance definitions ----------------------------*/ @@ -384,12 +384,12 @@ PyTypeObject FrsMaterial_Type = { "Material", /* tp_name */ sizeof(BPy_FrsMaterial), /* tp_basicsize */ 0, /* tp_itemsize */ - (destructor)FrsMaterial___dealloc__, /* tp_dealloc */ + (destructor)FrsMaterial_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ - (reprfunc)FrsMaterial___repr__, /* tp_repr */ + (reprfunc)FrsMaterial_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ @@ -400,7 +400,7 @@ PyTypeObject FrsMaterial_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - FrsMaterial___doc__, /* tp_doc */ + FrsMaterial_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -415,7 +415,7 @@ PyTypeObject FrsMaterial_Type = { 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ - (initproc)FrsMaterial___init__, /* tp_init */ + (initproc)FrsMaterial_init, /* tp_init */ 0, /* tp_alloc */ PyType_GenericNew, /* tp_new */ }; diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp index 9ce20632a25..7ed915f5469 100644 --- a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp +++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp @@ -14,7 +14,7 @@ extern "C" { //------------------------ MODULE FUNCTIONS ---------------------------------- -static char Integrator_integrate___doc__[] = +PyDoc_STRVAR(Integrator_integrate_doc, ".. function:: integrate(fun, it, it_end, integration_type)\n" "\n" " Returns a single value from a set of values evaluated at each 0D\n" @@ -37,56 +37,56 @@ static char Integrator_integrate___doc__[] = " value type is float if fun is of the :class:`UnaryFunction0DDouble`\n" " or :class:`UnaryFunction0DFloat` type, and int if fun is of the\n" " :class:`UnaryFunction0DUnsigned` type.\n" -" :rtype: int or float\n"; +" :rtype: int or float"); -static PyObject * Integrator_integrate( PyObject *self, PyObject *args ) +static PyObject * Integrator_integrate(PyObject *self, PyObject *args) { PyObject *obj1, *obj4 = 0; BPy_Interface0DIterator *obj2, *obj3; #if 1 - if(!( PyArg_ParseTuple(args, "O!O!O!|O!", &UnaryFunction0D_Type, &obj1, + if (!PyArg_ParseTuple(args, "O!O!O!|O!", &UnaryFunction0D_Type, &obj1, &Interface0DIterator_Type, &obj2, &Interface0DIterator_Type, &obj3, - &IntegrationType_Type, &obj4) )) + &IntegrationType_Type, &obj4)) return NULL; #else - if(!( PyArg_ParseTuple(args, "OOO|O", &obj1, &obj2, &obj3, &obj4) )) + if (!PyArg_ParseTuple(args, "OOO|O", &obj1, &obj2, &obj3, &obj4)) return NULL; - if(!BPy_UnaryFunction0D_Check(obj1)) { + if (!BPy_UnaryFunction0D_Check(obj1)) { PyErr_SetString(PyExc_TypeError, "argument 1 must be a UnaryFunction0D object"); return NULL; } - if(!BPy_Interface0DIterator_Check(obj2)) { + if (!BPy_Interface0DIterator_Check(obj2)) { PyErr_SetString(PyExc_TypeError, "argument 2 must be a Interface0DIterator object"); return NULL; } - if(!BPy_Interface0DIterator_Check(obj3)) { + if (!BPy_Interface0DIterator_Check(obj3)) { PyErr_SetString(PyExc_TypeError, "argument 3 must be a Interface0DIterator object"); return NULL; } - if(obj4 && !BPy_IntegrationType_Check(obj4)) { + if (obj4 && !BPy_IntegrationType_Check(obj4)) { PyErr_SetString(PyExc_TypeError, "argument 4 must be a IntegrationType object"); return NULL; } #endif Interface0DIterator it(*(obj2->if0D_it)), it_end(*(obj3->if0D_it)); - IntegrationType t = ( obj4 ) ? IntegrationType_from_BPy_IntegrationType( obj4 ) : MEAN; + IntegrationType t = (obj4) ? IntegrationType_from_BPy_IntegrationType(obj4) : MEAN; - if( BPy_UnaryFunction0DDouble_Check(obj1) ) { + if (BPy_UnaryFunction0DDouble_Check(obj1)) { UnaryFunction0D *fun = ((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double; - double res = integrate( *fun, it, it_end, t ); - return PyFloat_FromDouble( res ); + double res = integrate(*fun, it, it_end, t); + return PyFloat_FromDouble(res); - } else if( BPy_UnaryFunction0DFloat_Check(obj1) ) { + } else if (BPy_UnaryFunction0DFloat_Check(obj1)) { UnaryFunction0D *fun = ((BPy_UnaryFunction0DFloat *)obj1)->uf0D_float; - float res = integrate( *fun, it, it_end, t ); - return PyFloat_FromDouble( res ); + float res = integrate(*fun, it, it_end, t); + return PyFloat_FromDouble(res); - } else if( BPy_UnaryFunction0DUnsigned_Check(obj1) ) { + } else if (BPy_UnaryFunction0DUnsigned_Check(obj1)) { UnaryFunction0D *fun = ((BPy_UnaryFunction0DUnsigned *)obj1)->uf0D_unsigned; - unsigned int res = integrate( *fun, it, it_end, t ); - return PyLong_FromLong( res ); + unsigned int res = integrate(*fun, it, it_end, t); + return PyLong_FromLong(res); } else { string msg("unsupported function type: " + string(obj1->ob_type->tp_name)); @@ -97,13 +97,13 @@ static PyObject * Integrator_integrate( PyObject *self, PyObject *args ) /*-----------------------Integrator module docstring---------------------------------------*/ -static char module_docstring[] = "The Blender Freestyle.Integrator submodule\n\n"; +PyDoc_STRVAR(module_docstring, "The Blender Freestyle.Integrator submodule\n\n"); /*-----------------------Integrator module functions definitions---------------------------*/ static PyMethodDef module_functions[] = { - {"integrate", (PyCFunction) Integrator_integrate, METH_VARARGS, Integrator_integrate___doc__}, - {NULL, NULL, 0, NULL} + {"integrate", (PyCFunction) Integrator_integrate, METH_VARARGS, Integrator_integrate_doc}, + {NULL, NULL, 0, NULL} }; /*-----------------------Integrator module definition--------------------------------------*/ @@ -118,7 +118,7 @@ static PyModuleDef module_definition = { /*-----------------------BPy_IntegrationType type definition ------------------------------*/ -static char IntegrationType___doc__[] = +PyDoc_STRVAR(IntegrationType_doc, "Class hierarchy: int > :class:`IntegrationType`\n" "\n" "Different integration methods that can be invoked to integrate into a\n" @@ -134,7 +134,7 @@ static char IntegrationType___doc__[] = "* IntegrationType.FIRST: The value computed for the 1D element is the\n" " first of the values obtained for the 0D elements.\n" "* IntegrationType.LAST: The value computed for the 1D element is the\n" -" last of the values obtained for the 0D elements.\n"; +" last of the values obtained for the 0D elements."); PyTypeObject IntegrationType_Type = { PyVarObject_HEAD_INIT(NULL, 0) @@ -157,7 +157,7 @@ PyTypeObject IntegrationType_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - IntegrationType___doc__, /* tp_doc */ + IntegrationType_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -207,27 +207,27 @@ static PyLongObject _IntegrationType_LAST = { #define BPy_IntegrationType_LAST ((PyObject *)&_IntegrationType_LAST) //-------------------MODULE INITIALIZATION-------------------------------- -int IntegrationType_Init( PyObject *module ) -{ +int IntegrationType_Init(PyObject *module) +{ PyObject *m, *d, *f; - if( module == NULL ) + if (module == NULL) return -1; - if( PyType_Ready( &IntegrationType_Type ) < 0 ) + if (PyType_Ready(&IntegrationType_Type) < 0) return -1; - Py_INCREF( &IntegrationType_Type ); + Py_INCREF(&IntegrationType_Type); PyModule_AddObject(module, "IntegrationType", (PyObject *)&IntegrationType_Type); - PyDict_SetItemString( IntegrationType_Type.tp_dict, "MEAN", BPy_IntegrationType_MEAN); - PyDict_SetItemString( IntegrationType_Type.tp_dict, "MIN", BPy_IntegrationType_MIN); - PyDict_SetItemString( IntegrationType_Type.tp_dict, "MAX", BPy_IntegrationType_MAX); - PyDict_SetItemString( IntegrationType_Type.tp_dict, "FIRST", BPy_IntegrationType_FIRST); - PyDict_SetItemString( IntegrationType_Type.tp_dict, "LAST", BPy_IntegrationType_LAST); + PyDict_SetItemString(IntegrationType_Type.tp_dict, "MEAN", BPy_IntegrationType_MEAN); + PyDict_SetItemString(IntegrationType_Type.tp_dict, "MIN", BPy_IntegrationType_MIN); + PyDict_SetItemString(IntegrationType_Type.tp_dict, "MAX", BPy_IntegrationType_MAX); + PyDict_SetItemString(IntegrationType_Type.tp_dict, "FIRST", BPy_IntegrationType_FIRST); + PyDict_SetItemString(IntegrationType_Type.tp_dict, "LAST", BPy_IntegrationType_LAST); - m = PyModule_Create(&module_definition); - if (m == NULL) - return -1; + m = PyModule_Create(&module_definition); + if (m == NULL) + return -1; Py_INCREF(m); PyModule_AddObject(module, "Integrator", m); @@ -247,4 +247,3 @@ int IntegrationType_Init( PyObject *module ) #ifdef __cplusplus } #endif - diff --git a/source/blender/freestyle/intern/python/BPy_MediumType.cpp b/source/blender/freestyle/intern/python/BPy_MediumType.cpp index 111fb756ba2..1802dae094b 100644 --- a/source/blender/freestyle/intern/python/BPy_MediumType.cpp +++ b/source/blender/freestyle/intern/python/BPy_MediumType.cpp @@ -10,7 +10,7 @@ extern "C" { /*-----------------------BPy_MediumType type definition ------------------------------*/ -static char MediumType___doc__[] = +PyDoc_STRVAR(MediumType_doc, "Class hierarchy: int > :class:`MediumType`\n" "\n" "The different blending modes available to similate the interaction\n" @@ -18,7 +18,7 @@ static char MediumType___doc__[] = "\n" "* Stroke.DRY_MEDIUM: To simulate a dry medium such as Pencil or Charcoal.\n" "* Stroke.HUMID_MEDIUM: To simulate ink painting (color substraction blending).\n" -"* Stroke.OPAQUE_MEDIUM: To simulate an opaque medium (oil, spray...).\n"; +"* Stroke.OPAQUE_MEDIUM: To simulate an opaque medium (oil, spray...)."); PyTypeObject MediumType_Type = { PyVarObject_HEAD_INIT(NULL, 0) @@ -41,7 +41,7 @@ PyTypeObject MediumType_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - MediumType___doc__, /* tp_doc */ + MediumType_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -96,4 +96,3 @@ int MediumType_Init( PyObject *module ) #ifdef __cplusplus } #endif - diff --git a/source/blender/freestyle/intern/python/BPy_Nature.cpp b/source/blender/freestyle/intern/python/BPy_Nature.cpp index 149baa9a7f3..2b6dbfd05e6 100644 --- a/source/blender/freestyle/intern/python/BPy_Nature.cpp +++ b/source/blender/freestyle/intern/python/BPy_Nature.cpp @@ -8,9 +8,9 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -static PyObject *BPy_Nature___and__(PyObject *a, PyObject *b); -static PyObject *BPy_Nature___xor__(PyObject *a, PyObject *b); -static PyObject *BPy_Nature___or__(PyObject *a, PyObject *b); +static PyObject *BPy_Nature_and(PyObject *a, PyObject *b); +static PyObject *BPy_Nature_xor(PyObject *a, PyObject *b); +static PyObject *BPy_Nature_or(PyObject *a, PyObject *b); static int BPy_Nature_bool(PyObject *v); /*-----------------------BPy_Nature number method definitions --------------------*/ @@ -29,9 +29,9 @@ PyNumberMethods nature_as_number = { 0, /* unaryfunc nb_invert */ 0, /* binaryfunc nb_lshift */ 0, /* binaryfunc nb_rshift */ - (binaryfunc)BPy_Nature___and__, /* binaryfunc nb_and */ - (binaryfunc)BPy_Nature___xor__, /* binaryfunc nb_xor */ - (binaryfunc)BPy_Nature___or__, /* binaryfunc nb_or */ + (binaryfunc)BPy_Nature_and, /* binaryfunc nb_and */ + (binaryfunc)BPy_Nature_xor, /* binaryfunc nb_xor */ + (binaryfunc)BPy_Nature_or, /* binaryfunc nb_or */ 0, /* unaryfunc nb_int */ 0, /* void *nb_reserved */ 0, /* unaryfunc nb_float */ @@ -54,7 +54,7 @@ PyNumberMethods nature_as_number = { /*-----------------------BPy_Nature docstring ------------------------------------*/ -static char Nature___doc__[] = +PyDoc_STRVAR(Nature_doc, "Class hierarchy: int > :class:`Nature`\n" "\n" "Different possible natures of 0D and 1D elements of the ViewMap.\n" @@ -79,7 +79,7 @@ static char Nature___doc__[] = "* Nature.VALLEY: True for valleys.\n" "* Nature.SUGGESTIVE_CONTOUR: True for suggestive contours.\n" "* Nature.MATERIAL_BOUNDARY: True for edges at material boundaries.\n" -"* Nature.EDGE_MARK: True for edges having user-defined edge marks.\n"; +"* Nature.EDGE_MARK: True for edges having user-defined edge marks."); /*-----------------------BPy_Nature type definition ------------------------------*/ @@ -104,7 +104,7 @@ PyTypeObject Nature_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - Nature___doc__, /* tp_doc */ + Nature_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -204,40 +204,39 @@ static PyLongObject _Nature_EDGE_MARK = { #define BPy_Nature_EDGE_MARK ((PyObject *)&_Nature_EDGE_MARK) //-------------------MODULE INITIALIZATION-------------------------------- -int Nature_Init( PyObject *module ) -{ - if( module == NULL ) +int Nature_Init(PyObject *module) +{ + if (module == NULL) return -1; - if( PyType_Ready( &Nature_Type ) < 0 ) + if (PyType_Ready(&Nature_Type) < 0) return -1; - Py_INCREF( &Nature_Type ); + Py_INCREF(&Nature_Type); PyModule_AddObject(module, "Nature", (PyObject *)&Nature_Type); // VertexNature - PyDict_SetItemString( Nature_Type.tp_dict, "POINT", BPy_Nature_POINT); - PyDict_SetItemString( Nature_Type.tp_dict, "S_VERTEX", BPy_Nature_S_VERTEX); - PyDict_SetItemString( Nature_Type.tp_dict, "VIEW_VERTEX", BPy_Nature_VIEW_VERTEX ); - PyDict_SetItemString( Nature_Type.tp_dict, "NON_T_VERTEX", BPy_Nature_NON_T_VERTEX ); - PyDict_SetItemString( Nature_Type.tp_dict, "T_VERTEX", BPy_Nature_T_VERTEX ); - PyDict_SetItemString( Nature_Type.tp_dict, "CUSP", BPy_Nature_CUSP ); + PyDict_SetItemString(Nature_Type.tp_dict, "POINT", BPy_Nature_POINT); + PyDict_SetItemString(Nature_Type.tp_dict, "S_VERTEX", BPy_Nature_S_VERTEX); + PyDict_SetItemString(Nature_Type.tp_dict, "VIEW_VERTEX", BPy_Nature_VIEW_VERTEX); + PyDict_SetItemString(Nature_Type.tp_dict, "NON_T_VERTEX", BPy_Nature_NON_T_VERTEX); + PyDict_SetItemString(Nature_Type.tp_dict, "T_VERTEX", BPy_Nature_T_VERTEX); + PyDict_SetItemString(Nature_Type.tp_dict, "CUSP", BPy_Nature_CUSP); // EdgeNature - PyDict_SetItemString( Nature_Type.tp_dict, "NO_FEATURE", BPy_Nature_NO_FEATURE ); - PyDict_SetItemString( Nature_Type.tp_dict, "SILHOUETTE", BPy_Nature_SILHOUETTE ); - PyDict_SetItemString( Nature_Type.tp_dict, "BORDER", BPy_Nature_BORDER ); - PyDict_SetItemString( Nature_Type.tp_dict, "CREASE", BPy_Nature_CREASE ); - PyDict_SetItemString( Nature_Type.tp_dict, "RIDGE", BPy_Nature_RIDGE ); - PyDict_SetItemString( Nature_Type.tp_dict, "VALLEY", BPy_Nature_VALLEY ); - PyDict_SetItemString( Nature_Type.tp_dict, "SUGGESTIVE_CONTOUR", BPy_Nature_SUGGESTIVE_CONTOUR ); - PyDict_SetItemString( Nature_Type.tp_dict, "MATERIAL_BOUNDARY", BPy_Nature_MATERIAL_BOUNDARY ); - PyDict_SetItemString( Nature_Type.tp_dict, "EDGE_MARK", BPy_Nature_EDGE_MARK ); + PyDict_SetItemString(Nature_Type.tp_dict, "NO_FEATURE", BPy_Nature_NO_FEATURE); + PyDict_SetItemString(Nature_Type.tp_dict, "SILHOUETTE", BPy_Nature_SILHOUETTE); + PyDict_SetItemString(Nature_Type.tp_dict, "BORDER", BPy_Nature_BORDER); + PyDict_SetItemString(Nature_Type.tp_dict, "CREASE", BPy_Nature_CREASE); + PyDict_SetItemString(Nature_Type.tp_dict, "RIDGE", BPy_Nature_RIDGE); + PyDict_SetItemString(Nature_Type.tp_dict, "VALLEY", BPy_Nature_VALLEY); + PyDict_SetItemString(Nature_Type.tp_dict, "SUGGESTIVE_CONTOUR", BPy_Nature_SUGGESTIVE_CONTOUR); + PyDict_SetItemString(Nature_Type.tp_dict, "MATERIAL_BOUNDARY", BPy_Nature_MATERIAL_BOUNDARY); + PyDict_SetItemString(Nature_Type.tp_dict, "EDGE_MARK", BPy_Nature_EDGE_MARK); return 0; } -static PyObject * -BPy_Nature_bitwise(PyObject *a, int op, PyObject *b) +static PyObject *BPy_Nature_bitwise(PyObject *a, int op, PyObject *b) { BPy_Nature *result; @@ -280,26 +279,22 @@ BPy_Nature_bitwise(PyObject *a, int op, PyObject *b) return (PyObject *)result; } -static PyObject * -BPy_Nature___and__(PyObject *a, PyObject *b) +static PyObject *BPy_Nature_and(PyObject *a, PyObject *b) { return BPy_Nature_bitwise(a, '&', b); } -static PyObject * -BPy_Nature___xor__(PyObject *a, PyObject *b) +static PyObject *BPy_Nature_xor(PyObject *a, PyObject *b) { return BPy_Nature_bitwise(a, '^', b); } -static PyObject * -BPy_Nature___or__(PyObject *a, PyObject *b) +static PyObject *BPy_Nature_or(PyObject *a, PyObject *b) { return BPy_Nature_bitwise(a, '|', b); } -static int -BPy_Nature_bool(PyObject *v) +static int BPy_Nature_bool(PyObject *v) { return ((PyLongObject *)v)->ob_digit[0] != 0; } @@ -309,4 +304,3 @@ BPy_Nature_bool(PyObject *v) #ifdef __cplusplus } #endif - 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 27f70caeb70..ad83a6933c3 100644 --- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp @@ -15,7 +15,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- -static char StrokeVertex___doc__[] = +PyDoc_STRVAR(StrokeVertex_doc, "Class hierarchy: :class:`Interface0D` > :class:`CurvePoint` > :class:`StrokeVertex`\n" "\n" "Class to define a stroke vertex.\n" @@ -64,40 +64,40 @@ static char StrokeVertex___doc__[] = " :arg iSVertex: An SVertex object.\n" " :type iSVertex: :class:`SVertex`\n" " :arg iAttribute: A StrokeAttribute object.\n" -" :type iAttribute: :class:`StrokeAttribute`\n"; +" :type iAttribute: :class:`StrokeAttribute`"); -static int StrokeVertex___init__(BPy_StrokeVertex *self, PyObject *args, PyObject *kwds) +static int StrokeVertex_init(BPy_StrokeVertex *self, PyObject *args, PyObject *kwds) { PyObject *obj1 = 0, *obj2 = 0 , *obj3 = 0; - if (! PyArg_ParseTuple(args, "|OOO!", &obj1, &obj2, &PyFloat_Type, &obj3) ) - return -1; + if (!PyArg_ParseTuple(args, "|OOO!", &obj1, &obj2, &PyFloat_Type, &obj3)) + return -1; - if( !obj1 ){ + if (!obj1){ self->sv = new StrokeVertex(); - } else if( !obj2 && BPy_StrokeVertex_Check(obj1) && ((BPy_StrokeVertex *) obj1)->sv ) { + } else if (!obj2 && BPy_StrokeVertex_Check(obj1) && ((BPy_StrokeVertex *) obj1)->sv) { self->sv = new StrokeVertex( *(((BPy_StrokeVertex *) obj1)->sv) ); - } else if( !obj2 && BPy_CurvePoint_Check(obj1) && ((BPy_CurvePoint *) obj1)->cp ) { + } else if (!obj2 && BPy_CurvePoint_Check(obj1) && ((BPy_CurvePoint *) obj1)->cp) { self->sv = new StrokeVertex( ((BPy_CurvePoint *) obj1)->cp ); - } else if( !obj2 && BPy_SVertex_Check(obj1) && ((BPy_SVertex *) obj1)->sv ) { + } else if (!obj2 && BPy_SVertex_Check(obj1) && ((BPy_SVertex *) obj1)->sv) { self->sv = new StrokeVertex( ((BPy_SVertex *) obj1)->sv ); - } else if( obj3 && BPy_StrokeVertex_Check(obj1) && BPy_StrokeVertex_Check(obj2) ) { + } else if (obj3 && BPy_StrokeVertex_Check(obj1) && BPy_StrokeVertex_Check(obj2)) { StrokeVertex *sv1 = ((BPy_StrokeVertex *) obj1)->sv; StrokeVertex *sv2 = ((BPy_StrokeVertex *) obj2)->sv; - if( !sv1 || ( sv1->A() == 0 && sv1->B() == 0 ) ) { + if (!sv1 || (sv1->A() == 0 && sv1->B() == 0)) { PyErr_SetString(PyExc_TypeError, "argument 1 is an invalid StrokeVertex object"); return -1; } - if( !sv2 || ( sv2->A() == 0 && sv2->B() == 0 ) ) { + if (!sv2 || (sv2->A() == 0 && sv2->B() == 0)) { PyErr_SetString(PyExc_TypeError, "argument 2 is an invalid StrokeVertex object"); return -1; } - self->sv = new StrokeVertex( sv1, sv2, PyFloat_AsDouble( obj3 ) ); + self->sv = new StrokeVertex(sv1, sv2, PyFloat_AsDouble(obj3)); } else { PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); @@ -311,7 +311,7 @@ PyTypeObject StrokeVertex_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - StrokeVertex___doc__, /* tp_doc */ + StrokeVertex_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -326,7 +326,7 @@ PyTypeObject StrokeVertex_Type = { 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ - (initproc)StrokeVertex___init__, /* tp_init */ + (initproc)StrokeVertex_init, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ }; 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 343e65e9fe6..793fc206389 100644 --- a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp @@ -10,9 +10,9 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// -//------------------------INSTANCE METHODS ---------------------------------- +/*----------------------Chain methods ----------------------------*/ -static char Chain___doc__[] = +PyDoc_STRVAR(Chain_doc, "Class hierarchy: :class:`Interface1D` > :class:`Curve` > :class:`Chain`\n" "\n" "Class to represent a 1D elements issued from the chaining process. A\n" @@ -35,25 +35,25 @@ static char Chain___doc__[] = " Builds a chain from its Id.\n" "\n" " :arg id: An Id object.\n" -" :type id: :class:`Id`\n"; +" :type id: :class:`Id`"); -static int Chain___init__(BPy_Chain *self, PyObject *args, PyObject *kwds) +static int Chain_init(BPy_Chain *self, PyObject *args, PyObject *kwds) { PyObject *obj = 0; - if (! PyArg_ParseTuple(args, "|O", &obj) ) - return -1; + if (!PyArg_ParseTuple(args, "|O", &obj)) + return -1; - if( !obj ){ + if (!obj) { self->c = new Chain(); - - } else if( BPy_Chain_Check(obj) ) { - self->c = new Chain(*( ((BPy_Chain *) obj)->c )); - - } else if( BPy_Id_Check(obj) ) { - self->c = new Chain(*( ((BPy_Id *) obj)->id )); - + + } else if (BPy_Chain_Check(obj)) { + self->c = new Chain(*(((BPy_Chain *)obj)->c)); + + } else if (BPy_Id_Check(obj)) { + self->c = new Chain(*(((BPy_Id *)obj)->id)); + } else { PyErr_SetString(PyExc_TypeError, "invalid argument"); return -1; @@ -66,7 +66,7 @@ static int Chain___init__(BPy_Chain *self, PyObject *args, PyObject *kwds) return 0; } -static char Chain_push_viewedge_back___doc__[] = +PyDoc_STRVAR(Chain_push_viewedge_back_doc, ".. method:: push_viewedge_back(iViewEdge, orientation)\n" "\n" " Adds a ViewEdge at the end of the Chain.\n" @@ -75,7 +75,7 @@ static char Chain_push_viewedge_back___doc__[] = " :type iViewEdge: :class:`ViewEdge`\n" " :arg orientation: The orientation with which the ViewEdge must be\n" " processed.\n" -" :type orientation: bool\n"; +" :type orientation: bool"); static PyObject * Chain_push_viewedge_back( BPy_Chain *self, PyObject *args ) { PyObject *obj1 = 0, *obj2 = 0; @@ -90,7 +90,7 @@ static PyObject * Chain_push_viewedge_back( BPy_Chain *self, PyObject *args ) { Py_RETURN_NONE; } -static char Chain_push_viewedge_front___doc__[] = +PyDoc_STRVAR(Chain_push_viewedge_front_doc, ".. method:: push_viewedge_front(iViewEdge, orientation)\n" "\n" " Adds a ViewEdge at the beginning of the Chain.\n" @@ -99,7 +99,7 @@ static char Chain_push_viewedge_front___doc__[] = " :type iViewEdge: :class:`ViewEdge`\n" " :arg orientation: The orientation with which the ViewEdge must be\n" " processed.\n" -" :type orientation: bool\n"; +" :type orientation: bool"); static PyObject * Chain_push_viewedge_front( BPy_Chain *self, PyObject *args ) { PyObject *obj1 = 0, *obj2 = 0; @@ -114,10 +114,9 @@ static PyObject * Chain_push_viewedge_front( BPy_Chain *self, PyObject *args ) { Py_RETURN_NONE; } -/*----------------------Chain instance definitions ----------------------------*/ static PyMethodDef BPy_Chain_methods[] = { - {"push_viewedge_back", ( PyCFunction ) Chain_push_viewedge_back, METH_VARARGS, Chain_push_viewedge_back___doc__}, - {"push_viewedge_front", ( PyCFunction ) Chain_push_viewedge_front, METH_VARARGS, Chain_push_viewedge_front___doc__}, + {"push_viewedge_back", (PyCFunction)Chain_push_viewedge_back, METH_VARARGS, Chain_push_viewedge_back_doc}, + {"push_viewedge_front", (PyCFunction)Chain_push_viewedge_front, METH_VARARGS, Chain_push_viewedge_front_doc}, {NULL, NULL, 0, NULL} }; @@ -144,7 +143,7 @@ PyTypeObject Chain_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Chain___doc__, /* tp_doc */ + Chain_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -159,7 +158,7 @@ PyTypeObject Chain_Type = { 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ - (initproc)Chain___init__, /* tp_init */ + (initproc)Chain_init, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ }; -- cgit v1.2.3