[Bf-python] bpy code cleanup
Stephen Swaney
sswaney at swbell.net
Wed Sep 22 10:02:12 CEST 2004
Currently, the bpy code is a bit of a formatting
mish-mash, some of it inherited from previous versions
and much written to different standards.
The result, while functional, is a mixture of tabs,
spaces and various coding styles.
As part of the bpy code cleanup, we would like
to bring the bpy source into line with the blender
coding standard:
http://www.blender3d.org/cms/Coding_Style.141.0.html
An easy way to do this is to run the code thru the
formating utility 'indent'. Indent is capable of
outputing a wide variety of styles depending on the
formatting options. The options give control over
things like spaces vs tabs, indentation levels,
brace placement and spaces after function names
and if/for/while keywords.
Options can either be passed on the command line
or in a config file. The default
name of the config file is .indent.pro
I have brewed up a config file that results in
code something like the following example.
static PyObject *Curve_appendNurb( BPy_Curve * self, PyObject * args )
{
Nurb *nurb_ptr = self->curve->nurb.first;
/* walk to end of nurblist */
if( nurb_ptr ) {
while( nurb_ptr->next ) {
nurb_ptr = nurb_ptr->next;
}
pptr = &nurb_ptr->next;
}
if( CurNurb_appendPointToNurb( new_nurb, args ) ) {
*pptr = new_nurb;
} else {
freeNurb( new_nurb );
}
return EXPP_incr_ret( Py_None );
}
ISSUES:
Reformatting the code changes virtually every line.
If you are currently working on something, you have
a couple options:
1) run your changed sources thru indent and do a cvs update.
They should match pretty closely.
2) resolve merge conflicts manually after update. ( ugh! )
3) we can skip your files and format them after you check in
your changes.
If no one has objections, I will process all the bpy files at
one time. I will post the config file in a separate msg.
We can also check it into cvs for later use.
Comments?
--
Stephen Swaney
sswaney at swbell.net
More information about the Bf-python
mailing list