[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54568] branches/soc-2008-mxcurioni/source /blender/freestyle/intern/python: Minor coding style clean-up.

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Fri Feb 15 00:50:30 CET 2013


Revision: 54568
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54568
Author:   kjym3
Date:     2013-02-14 23:50:30 +0000 (Thu, 14 Feb 2013)
Log Message:
-----------
Minor coding style clean-up.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_BBox.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_MediumType.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Nature.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_BBox.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_BBox.cpp	2013-02-14 23:49:30 UTC (rev 54567)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_BBox.cpp	2013-02-14 23:50:30 UTC (rev 54568)
@@ -9,40 +9,39 @@
 //-------------------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 @@
 	"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 @@
 	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 @@
 	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 */
 };

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp	2013-02-14 23:49:30 UTC (rev 54567)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp	2013-02-14 23:50:30 UTC (rev 54568)
@@ -13,22 +13,22 @@
 //-------------------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 @@
 "   :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 @@
 	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 @@
 	"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 @@
 	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 @@
 	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 */
 };

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp	2013-02-14 23:49:30 UTC (rev 54567)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp	2013-02-14 23:50:30 UTC (rev 54568)
@@ -14,7 +14,7 @@
 
 //------------------------ 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 @@
 "      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)) {

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list