Another round in the Great BPy Cleanup:
authorStephen Swaney <sswaney@centurytel.net>
Sat, 25 Sep 2004 20:30:40 +0000 (20:30 +0000)
committerStephen Swaney <sswaney@centurytel.net>
Sat, 25 Sep 2004 20:30:40 +0000 (20:30 +0000)
Run everything thru indent to cleanup spaces vs tabs.
Clean up some of the comments by hand.
BGL.c was not touched due to all that macro wackyness.

There are no functional changes to the code.
Pre-indent versions of source are tagged with
tag bpy-cleanup-20040925 , just in case.

97 files changed:
source/blender/python/api2_2x/Armature.c
source/blender/python/api2_2x/Armature.h
source/blender/python/api2_2x/BGL.h
source/blender/python/api2_2x/BezTriple.c
source/blender/python/api2_2x/BezTriple.h
source/blender/python/api2_2x/Blender.c
source/blender/python/api2_2x/Blender.h
source/blender/python/api2_2x/Bone.c
source/blender/python/api2_2x/Bone.h
source/blender/python/api2_2x/Build.c
source/blender/python/api2_2x/Build.h
source/blender/python/api2_2x/Camera.c
source/blender/python/api2_2x/Camera.h
source/blender/python/api2_2x/CurNurb.c
source/blender/python/api2_2x/CurNurb.h
source/blender/python/api2_2x/Curve.c
source/blender/python/api2_2x/Curve.h
source/blender/python/api2_2x/Draw.c
source/blender/python/api2_2x/Draw.h
source/blender/python/api2_2x/EXPP_interface.c
source/blender/python/api2_2x/EXPP_interface.h
source/blender/python/api2_2x/Effect.c
source/blender/python/api2_2x/Effect.h
source/blender/python/api2_2x/Image.c
source/blender/python/api2_2x/Image.h
source/blender/python/api2_2x/Ipo.c
source/blender/python/api2_2x/Ipo.h
source/blender/python/api2_2x/Ipocurve.c
source/blender/python/api2_2x/Ipocurve.h
source/blender/python/api2_2x/Lamp.c
source/blender/python/api2_2x/Lamp.h
source/blender/python/api2_2x/Lattice.c
source/blender/python/api2_2x/Lattice.h
source/blender/python/api2_2x/Library.c
source/blender/python/api2_2x/MTex.c
source/blender/python/api2_2x/MTex.h
source/blender/python/api2_2x/Material.c
source/blender/python/api2_2x/Material.h
source/blender/python/api2_2x/Mathutils.c
source/blender/python/api2_2x/Mathutils.h
source/blender/python/api2_2x/Metaball.c
source/blender/python/api2_2x/Metaball.h
source/blender/python/api2_2x/NLA.c
source/blender/python/api2_2x/NLA.h
source/blender/python/api2_2x/NMesh.c
source/blender/python/api2_2x/NMesh.h
source/blender/python/api2_2x/Noise.c
source/blender/python/api2_2x/Object.c
source/blender/python/api2_2x/Object.h
source/blender/python/api2_2x/Particle.c
source/blender/python/api2_2x/Particle.h
source/blender/python/api2_2x/Registry.c
source/blender/python/api2_2x/Registry.h
source/blender/python/api2_2x/Scene.c
source/blender/python/api2_2x/Scene.h
source/blender/python/api2_2x/Sound.c
source/blender/python/api2_2x/Sound.h
source/blender/python/api2_2x/Sys.c
source/blender/python/api2_2x/Sys.h
source/blender/python/api2_2x/Text.c
source/blender/python/api2_2x/Text.h
source/blender/python/api2_2x/Texture.c
source/blender/python/api2_2x/Texture.h
source/blender/python/api2_2x/Types.c
source/blender/python/api2_2x/Types.h
source/blender/python/api2_2x/Wave.c
source/blender/python/api2_2x/Wave.h
source/blender/python/api2_2x/Window.c
source/blender/python/api2_2x/Window.h
source/blender/python/api2_2x/World.c
source/blender/python/api2_2x/World.h
source/blender/python/api2_2x/bpy_types.h
source/blender/python/api2_2x/charRGBA.c
source/blender/python/api2_2x/charRGBA.h
source/blender/python/api2_2x/constant.c
source/blender/python/api2_2x/constant.h
source/blender/python/api2_2x/euler.c
source/blender/python/api2_2x/euler.h
source/blender/python/api2_2x/gen_utils.c
source/blender/python/api2_2x/gen_utils.h
source/blender/python/api2_2x/logic.c
source/blender/python/api2_2x/logic.h
source/blender/python/api2_2x/matrix.c
source/blender/python/api2_2x/matrix.h
source/blender/python/api2_2x/modules.h
source/blender/python/api2_2x/quat.c
source/blender/python/api2_2x/quat.h
source/blender/python/api2_2x/rgbTuple.c
source/blender/python/api2_2x/rgbTuple.h
source/blender/python/api2_2x/sceneRadio.c
source/blender/python/api2_2x/sceneRadio.h
source/blender/python/api2_2x/sceneRender.c
source/blender/python/api2_2x/sceneRender.h
source/blender/python/api2_2x/vector.c
source/blender/python/api2_2x/vector.h
source/blender/python/api2_2x/windowTheme.c
source/blender/python/api2_2x/windowTheme.h

index 9ad5fba0f1a6c99171c279cafb6e0aa8f7fbf1a2..29875d3644e35d63bac3ceafec56d3ab716e5704 100644 (file)
 #include "modules.h"
 #include "Types.h"
 
-//--------------------------- Python API function prototypes for the Armature module-----------
-static PyObject *M_Armature_New (PyObject * self, PyObject * args);
-static PyObject *M_Armature_Get (PyObject * self, PyObject * args);
-//--------------------------- Python API Doc Strings for the Armature module----------------------
+//---------------- Python API function prototypes for the Armature module---
+static PyObject *M_Armature_New( PyObject * self, PyObject * args );
+static PyObject *M_Armature_Get( PyObject * self, PyObject * args );
+
+//------------- Python API Doc Strings for the Armature module-----------
 static char M_Armature_doc[] = "The Blender Armature module\n\n\
   This module provides control over **Armature Data** objects in Blender.\n";
-static char M_Armature_New_doc[] = "(name) - return a new Armature datablock of \n\
+static char M_Armature_New_doc[] =
+       "(name) - return a new Armature datablock of \n\
   optional name 'name'.";
 static char M_Armature_Get_doc[] =
-  "(name) - return the armature with the name 'name', \
+       "(name) - return the armature with the name 'name', \
   returns None if not found.\n If 'name' is not specified, it returns a list of all armatures in the\ncurrent scene.";
 static char M_Armature_get_doc[] = "(name) - DEPRECATED. Use 'Get' instead. \
   return the armature with the name 'name', returns None if not found.\n If 'name' is not specified, \
   it returns a list of all armatures in the\ncurrent scene.";
-//----------------Python method structure definition for Blender.Armature module---------------
+
+//------Python method structure definition for Blender.Armature module-----
 struct PyMethodDef M_Armature_methods[] = {
-  {"New", (PyCFunction) M_Armature_New, METH_VARARGS,  M_Armature_New_doc},
-  {"Get", M_Armature_Get, METH_VARARGS, M_Armature_Get_doc},
-  {"get", M_Armature_Get, METH_VARARGS, M_Armature_get_doc},
-  {NULL, NULL, 0, NULL}
+       {"New", ( PyCFunction ) M_Armature_New, METH_VARARGS,
+        M_Armature_New_doc},
+       {"Get", M_Armature_Get, METH_VARARGS, M_Armature_Get_doc},
+       {"get", M_Armature_Get, METH_VARARGS, M_Armature_get_doc},
+       {NULL, NULL, 0, NULL}
 };
-//----------------Python BPy_Armature methods declarations--------------------------------------------
-static PyObject *Armature_getName (BPy_Armature * self);
-static PyObject *Armature_getBones (BPy_Armature * self);
-static PyObject *Armature_addBone(BPy_Armature *self, PyObject *args);
-static PyObject *Armature_setName (BPy_Armature * self, PyObject * args);
-static PyObject *Armature_drawAxes (BPy_Armature * self, PyObject * args);
-static PyObject *Armature_drawNames (BPy_Armature * self, PyObject * args);
-//----------------Python BPy_Armature methods table---------------------------------------------------
+//--------Python BPy_Armature methods declarations----------------------------
+static PyObject *Armature_getName( BPy_Armature * self );
+static PyObject *Armature_getBones( BPy_Armature * self );
+static PyObject *Armature_addBone( BPy_Armature * self, PyObject * args );
+static PyObject *Armature_setName( BPy_Armature * self, PyObject * args );
+static PyObject *Armature_drawAxes( BPy_Armature * self, PyObject * args );
+static PyObject *Armature_drawNames( BPy_Armature * self, PyObject * args );
+//----------------Python BPy_Armature methods table---------------------------
 static PyMethodDef BPy_Armature_methods[] = {
-  {"getName", (PyCFunction) Armature_getName, METH_NOARGS,
-   "() - return Armature name"},
-  {"getBones", (PyCFunction) Armature_getBones, METH_NOARGS,
-   "() - return Armature root bones"},
-  {"setName", (PyCFunction) Armature_setName, METH_VARARGS,
-   "(str) - rename Armature"},
-  {"addBone", (PyCFunction)Armature_addBone, METH_VARARGS,
-       "(bone)-add bone"},
-  {"drawAxes", (PyCFunction)Armature_drawAxes, METH_VARARGS,
-       "will draw the axis of each bone in armature"},
-  {"drawNames", (PyCFunction)Armature_drawNames, METH_VARARGS,
-       "will draw the names of each bone in armature"},
-  {NULL, NULL, 0, NULL}
+       {"getName", ( PyCFunction ) Armature_getName, METH_NOARGS,
+        "() - return Armature name"},
+       {"getBones", ( PyCFunction ) Armature_getBones, METH_NOARGS,
+        "() - return Armature root bones"},
+       {"setName", ( PyCFunction ) Armature_setName, METH_VARARGS,
+        "(str) - rename Armature"},
+       {"addBone", ( PyCFunction ) Armature_addBone, METH_VARARGS,
+        "(bone)-add bone"},
+       {"drawAxes", ( PyCFunction ) Armature_drawAxes, METH_VARARGS,
+        "will draw the axis of each bone in armature"},
+       {"drawNames", ( PyCFunction ) Armature_drawNames, METH_VARARGS,
+        "will draw the names of each bone in armature"},
+       {NULL, NULL, 0, NULL}
 };
-//----------------Python TypeArmature callback function prototypes------------------------------
-static void Armature_dealloc (BPy_Armature * armature);
-static PyObject *Armature_getAttr (BPy_Armature * armature, char *name);
-static int Armature_setAttr (BPy_Armature * armature, char *name, PyObject * v);
-static int Armature_compare (BPy_Armature * a1, BPy_Armature * a2);
-static PyObject *Armature_repr (BPy_Armature * armature);
-static int doesBoneName_exist(char *name, bArmature* arm);
-//---------------- Python TypeArmature structure definition:-------------------------------------------
+
+//----------------Python TypeArmature callback function prototypes-----------
+static void Armature_dealloc( BPy_Armature * armature );
+static PyObject *Armature_getAttr( BPy_Armature * armature, char *name );
+static int Armature_setAttr( BPy_Armature * armature, char *name,
+                            PyObject * v );
+static int Armature_compare( BPy_Armature * a1, BPy_Armature * a2 );
+static PyObject *Armature_repr( BPy_Armature * armature );
+static int doesBoneName_exist( char *name, bArmature * arm );
+
+//---------------- Python TypeArmature structure definition:-----------
 PyTypeObject Armature_Type = {
-  PyObject_HEAD_INIT (NULL) 0, /* ob_size */
-  "Blender Armature",          /* tp_name */
-  sizeof (BPy_Armature),       /* tp_basicsize */
-  0,                           /* tp_itemsize */
-  /* methods */
-  (destructor) Armature_dealloc,       /* tp_dealloc */
-  0,                           /* tp_print */
-  (getattrfunc) Armature_getAttr,      /* tp_getattr */
-  (setattrfunc) Armature_setAttr,      /* tp_setattr */
-  (cmpfunc) Armature_compare,  /* tp_compare */
-  (reprfunc) Armature_repr,    /* tp_repr */
-  0,                           /* tp_as_number */
-  0,                           /* tp_as_sequence */
-  0,                           /* tp_as_mapping */
-  0,                           /* tp_as_hash */
-  0, 0, 0, 0, 0, 0,
-  0,                           /* tp_doc */
-  0, 0, 0, 0, 0, 0,
-  BPy_Armature_methods,                /* tp_methods */
-  0,                           /* tp_members */
+       PyObject_HEAD_INIT( NULL ) 
+       0,      /* ob_size */
+       "Blender Armature",     /* tp_name */
+       sizeof( BPy_Armature ), /* tp_basicsize */
+       0,                      /* tp_itemsize */
+       /* methods */
+       ( destructor ) Armature_dealloc,        /* tp_dealloc */
+       0,                      /* tp_print */
+       ( getattrfunc ) Armature_getAttr,       /* tp_getattr */
+       ( setattrfunc ) Armature_setAttr,       /* tp_setattr */
+       ( cmpfunc ) Armature_compare,   /* tp_compare */
+       ( reprfunc ) Armature_repr,     /* tp_repr */
+       0,                      /* tp_as_number */
+       0,                      /* tp_as_sequence */
+       0,                      /* tp_as_mapping */
+       0,                      /* tp_as_hash */
+       0, 0, 0, 0, 0, 0,
+       0,                      /* tp_doc */
+       0, 0, 0, 0, 0, 0,
+       BPy_Armature_methods,   /* tp_methods */
+       0,                      /* tp_members */
 };
-//-------------------Blender Armature Module Init------------------------------------------------------
-PyObject *
-Armature_Init (void)
+//-------------------Blender Armature Module Init-----------------
+PyObject *Armature_Init( void )
 {
-  PyObject *submodule;
-  PyObject *dict;
+       PyObject *submodule;
+       PyObject *dict;
 
-  Armature_Type.ob_type = &PyType_Type;
+       Armature_Type.ob_type = &PyType_Type;
 
-  submodule = Py_InitModule3 ("Blender.Armature",
-                             M_Armature_methods, M_Armature_doc);
+       submodule = Py_InitModule3( "Blender.Armature",
+                                   M_Armature_methods, M_Armature_doc );
 
-  /* Add the Bone submodule to this module */
-  dict = PyModule_GetDict (submodule);
-  PyDict_SetItemString (dict, "Bone", Bone_Init ());
-  PyDict_SetItemString (dict, "NLA", NLA_Init ());
+       /* Add the Bone submodule to this module */
+       dict = PyModule_GetDict( submodule );
+       PyDict_SetItemString( dict, "Bone", Bone_Init(  ) );
+       PyDict_SetItemString( dict, "NLA", NLA_Init(  ) );
 
-  return (submodule);
+       return ( submodule );
 }
-//--------------------------Blender Armature Module internal callbacks------------------------------
-//------------------append_childrenToList-------------------------------------------------------------------
-static void
-append_childrenToList(Bone *parent, PyObject *listbones)
+
+//----------------------Blender Armature Module internal callbacks----
+
+//------------------append_childrenToList-----------------------------------
+static void append_childrenToList( Bone * parent, PyObject * listbones )
 {
        Bone *child = NULL;
 
        //append children 
-    for(child = parent->childbase.first; child; child = child->next){
-               PyList_Append (listbones, Bone_CreatePyObject (child));
-               if(child->childbase.first){      //has children?
-                       append_childrenToList(child, listbones);
+       for( child = parent->childbase.first; child; child = child->next ) {
+               PyList_Append( listbones, Bone_CreatePyObject( child ) );
+               if( child->childbase.first ) {  //has children?
+                       append_childrenToList( child, listbones );
                }
        }
 }
-//------------------unique_BoneName----------------------------------------------------------------------
-static void
-unique_BoneName(char *name, bArmature* arm)
+
+//------------------unique_BoneName----------------------------
+static void unique_BoneName( char *name, bArmature * arm )
 {
-  char tempname[64];
-  int number;
-  char *dot;
-
-  if (doesBoneName_exist(name, arm)){
-       /*      Strip off the suffix */
-       dot=strchr(name, '.');
-       if (dot)
-               *dot=0;
-       
-       for (number = 1; number <=999; number++){
-               sprintf (tempname, "%s.%03d", name, number);
-               if (!doesBoneName_exist(tempname, arm)){
-                       strcpy (name, tempname);
-                       return;
+       char tempname[64];
+       int number;
+       char *dot;
+
+       if( doesBoneName_exist( name, arm ) ) {
+               /*      Strip off the suffix */
+               dot = strchr( name, '.' );
+               if( dot )
+                       *dot = 0;
+
+               for( number = 1; number <= 999; number++ ) {
+                       sprintf( tempname, "%s.%03d", name, number );
+                       if( !doesBoneName_exist( tempname, arm ) ) {
+                               strcpy( name, tempname );
+                               return;
+                       }
                }
        }
-  }
 }
-//------------------doesBoneName_exist----------------------------------------------------------------------
-static int 
-doesBoneName_exist(char *name, bArmature* arm)
+
+//------------------doesBoneName_exist----------------------------
+static int doesBoneName_exist( char *name, bArmature * arm )
 {
-  Bone *parent = NULL;
-  Bone *child = NULL;
-
-  for (parent = arm->bonebase.first; parent; parent = parent->next){
-    if (!strcmp (name, parent->name))
-               return 1;
-       for (child = parent->childbase.first; child; child = child->next){
-               if (!strcmp (name, child->name))
-                   return 1;
+       Bone *parent = NULL;
+       Bone *child = NULL;
+
+       for( parent = arm->bonebase.first; parent; parent = parent->next ) {
+               if( !strcmp( name, parent->name ) )
+                       return 1;
+               for( child = parent->childbase.first; child;
+                    child = child->next ) {
+                       if( !strcmp( name, child->name ) )
+                               return 1;
+               }
        }
-  }
-  return 0;
+       return 0;
 }
-//------------------testChildInChildbase----------------------------------------------------------------------
-static int 
-testChildInChildbase(Bone *bone, Bone *test)
+
+//------------------testChildInChildbase--------------------------
+static int testChildInChildbase( Bone * bone, Bone * test )
 {
        Bone *child;
-       for(child = bone->childbase.first; child; child = child->next){
-               if(child == test){
+       for( child = bone->childbase.first; child; child = child->next ) {
+               if( child == test ) {
                        return 1;
-               }else{
-                       if(child->childbase.first != NULL){
-                               if(testChildInChildbase(child, test)){
+               } else {
+                       if( child->childbase.first != NULL ) {
+                               if( testChildInChildbase( child, test ) ) {
                                        return 1;
                                }
                        }
@@ -213,17 +222,17 @@ testChildInChildbase(Bone *bone, Bone *test)
        }
        return 0;
 }
-//------------------testBoneInArmature----------------------------------------------------------------------
-static int
-testBoneInArmature(bArmature *arm, Bone *test)
+
+//------------------testBoneInArmature-----------------------------
+static int testBoneInArmature( bArmature * arm, Bone * test )
 {
        Bone *root;
-       for(root = arm->bonebase.first; root; root = root->next){
-               if(root == test){
+       for( root = arm->bonebase.first; root; root = root->next ) {
+               if( root == test ) {
                        return 1;
-               }else{
-                       if(root->childbase.first != NULL){
-                               if(testChildInChildbase(root, test)){
+               } else {
+                       if( root->childbase.first != NULL ) {
+                               if( testChildInChildbase( root, test ) ) {
                                        return 1;
                                }
                        }
@@ -231,413 +240,435 @@ testBoneInArmature(bArmature *arm, Bone *test)
        }
        return 0;
 }
-//-----------------testChildNameInChildbase------------------------------------------------------------------
-static Bone *
-testChildNameInChildbase(Bone *bone, char *name)
+
+//-----------------testChildNameInChildbase--------------------------
+static Bone *testChildNameInChildbase( Bone * bone, char *name )
 {
        Bone *child;
        Bone *test;
-       for(child = bone->childbase.first; child; child = child->next){
-               if(BLI_streq(child->name, name)){
+       for( child = bone->childbase.first; child; child = child->next ) {
+               if( BLI_streq( child->name, name ) ) {
                        return child;
-               }else{
-                       if(child->childbase.first != NULL){
-                               test = testChildNameInChildbase(child, name);
-                               if(test)        return test;
+               } else {
+                       if( child->childbase.first != NULL ) {
+                               test = testChildNameInChildbase( child, name );
+                               if( test )
+                                       return test;
                        }
                }
        }
        return NULL;
 }
-//----------------testBoneNameInArmature------------------------------------------------------------------
-static Bone *
-testBoneNameInArmature(bArmature *arm, char *name)
+
+//----------------testBoneNameInArmature----------------------------
+static Bone *testBoneNameInArmature( bArmature * arm, char *name )
 {
        Bone *bone;
        Bone *test;
-       for(bone = arm->bonebase.first; bone; bone = bone->next){
-               if(BLI_streq(bone->name, name)){
-                       return bone; //found it
-               }else{
-                       if(bone->childbase.first != NULL){
-                               test = testChildNameInChildbase(bone, name);
-                               if(test)        return test;
+       for( bone = arm->bonebase.first; bone; bone = bone->next ) {
+               if( BLI_streq( bone->name, name ) ) {
+                       return bone;    //found it
+               } else {
+                       if( bone->childbase.first != NULL ) {
+                               test = testChildNameInChildbase( bone, name );
+                               if( test )
+                                       return test;
                        }
                }
        }
        return NULL;
 }
-//-------------------BPy_Armature internal methods--------------------------------------------------
-//------------------dealloc--------------------------------------------------------------------------------------
-static void
-Armature_dealloc (BPy_Armature * self)
+
+//-------------------BPy_Armature internal methods------------------
+
+//------------------dealloc-----------------------------------------
+static void Armature_dealloc( BPy_Armature * self )
 {
-  PyObject_DEL (self);
+       PyObject_DEL( self );
 }
-//-----------------getattr-----------------------------------------------------------------------------------------
-static PyObject *
-Armature_getAttr (BPy_Armature * self, char *name)
+
+//-----------------getattr--------------------------------------------
+static PyObject *Armature_getAttr( BPy_Armature * self, char *name )
 {
-  PyObject *attr = Py_None;
-
-  if (strcmp (name, "name") == 0)
-    attr = Armature_getName (self);
-  if (strcmp (name, "bones") == 0)
-    attr = Armature_getBones (self);
-  else if (strcmp (name, "__members__") == 0)
-    {
-      /* 2 entries */
-      attr = Py_BuildValue ("[s,s]", "name", "bones");
-    }
-
-  if (!attr)
-    return (EXPP_ReturnPyObjError (PyExc_MemoryError,
-                                  "couldn't create PyObject"));
-
-  if (attr != Py_None)
-    return attr;               /* member attribute found, return it */
-
-  /* not an attribute, search the methods table */
-  return Py_FindMethod (BPy_Armature_methods, (PyObject *) self, name);
+       PyObject *attr = Py_None;
+
+       if( strcmp( name, "name" ) == 0 )
+               attr = Armature_getName( self );
+       if( strcmp( name, "bones" ) == 0 )
+               attr = Armature_getBones( self );
+       else if( strcmp( name, "__members__" ) == 0 ) {
+               /* 2 entries */
+               attr = Py_BuildValue( "[s,s]", "name", "bones" );
+       }
+
+       if( !attr )
+               return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
+                                               "couldn't create PyObject" ) );
+
+       if( attr != Py_None )
+               return attr;    /* member attribute found, return it */
+
+       /* not an attribute, search the methods table */
+       return Py_FindMethod( BPy_Armature_methods, ( PyObject * ) self,
+                             name );
 }
-//-----------------setattr-----------------------------------------------------------------------------------------
+
+//-----------------setattr--------------------------------------------
 static int
-Armature_setAttr (BPy_Armature * self, char *name, PyObject * value)
+Armature_setAttr( BPy_Armature * self, char *name, PyObject * value )
 {
-  PyObject *valtuple;
-  PyObject *error = NULL;
+       PyObject *valtuple;
+       PyObject *error = NULL;
 
-  valtuple = Py_BuildValue ("(O)", value);     /*the set* functions expect a tuple */
+       valtuple = Py_BuildValue( "(O)", value );       /*the set* functions expect a tuple */
 
-  if (!valtuple)
-    return EXPP_ReturnIntError (PyExc_MemoryError,
-                               "ArmatureSetAttr: couldn't create tuple");
+       if( !valtuple )
+               return EXPP_ReturnIntError( PyExc_MemoryError,
+                                           "ArmatureSetAttr: couldn't create tuple" );
 
-  if (strcmp (name, "name") == 0)
-    error = Armature_setName (self, valtuple);
-  else
-    {                          /* Error */
-      Py_DECREF (valtuple);
+       if( strcmp( name, "name" ) == 0 )
+               error = Armature_setName( self, valtuple );
+       else {                  /* Error */
+               Py_DECREF( valtuple );
 
-      /* ... member with the given name was found */
-      return (EXPP_ReturnIntError (PyExc_KeyError, "attribute not found"));
-    }
+               /* ... member with the given name was found */
+               return ( EXPP_ReturnIntError
+                        ( PyExc_KeyError, "attribute not found" ) );
+       }
 
-  Py_DECREF (valtuple);
+       Py_DECREF( valtuple );
 
-  if (error != Py_None)
-    return -1;
+       if( error != Py_None )
+               return -1;
 
-  Py_DECREF (Py_None);         /* was incref'ed by the called Armature_set* function */
-  return 0;                    /* normal exit */
+       Py_DECREF( Py_None );   /* was incref'ed by the called Armature_set* function */
+       return 0;               /* normal exit */
 }
-//-----------------repr-----------------------------------------------------------------------------------------
-static PyObject *
-Armature_repr (BPy_Armature * self)
+
+//-----------------repr-----------------------------------------------
+static PyObject *Armature_repr( BPy_Armature * self )
 {
-  return PyString_FromFormat ("[Armature \"%s\"]",
-                             self->armature->id.name + 2);
+       return PyString_FromFormat( "[Armature \"%s\"]",
+                                   self->armature->id.name + 2 );
 }
-//-----------------compare-----------------------------------------------------------------------------------------
-static int
-Armature_compare (BPy_Armature * a, BPy_Armature * b)
+
+//-----------------compare--------------------------------------------
+static int Armature_compare( BPy_Armature * a, BPy_Armature * b )
 {
-  bArmature *pa = a->armature, *pb = b->armature;
-  return (pa == pb) ? 0 : -1;
+       bArmature *pa = a->armature, *pb = b->armature;
+       return ( pa == pb ) ? 0 : -1;
 }
-//-----------------Armature_CreatePyObject-------------------------------------------------------------------
-PyObject *
-Armature_CreatePyObject (struct bArmature * obj)
+
+//-----------------Armature_CreatePyObject----------------------------
+PyObject *Armature_CreatePyObject( struct bArmature * obj )
 {
-  BPy_Armature *blen_armature;
+       BPy_Armature *blen_armature;
 
-  blen_armature =
-    (BPy_Armature *) PyObject_NEW (BPy_Armature, &Armature_Type);
+       blen_armature =
+               ( BPy_Armature * ) PyObject_NEW( BPy_Armature,
+                                                &Armature_Type );
 
-  if (blen_armature == NULL)
-    {
-      return (NULL);
-    }
-  blen_armature->armature = obj;
+       if( blen_armature == NULL ) {
+               return ( NULL );
+       }
+       blen_armature->armature = obj;
 
-  return ((PyObject *) blen_armature);
+       return ( ( PyObject * ) blen_armature );
 }
-//-----------------Armature_CheckPyObject -------------------------------------------------------------------
-int
-Armature_CheckPyObject (PyObject * py_obj)
+
+//-----------------Armature_CheckPyObject ----------------------------
+int Armature_CheckPyObject( PyObject * py_obj )
 {
-  return (py_obj->ob_type == &Armature_Type);
+       return ( py_obj->ob_type == &Armature_Type );
 }
-//-----------------Armature_FromPyObject -------------------------------------------------------------------
-struct bArmature *
-Armature_FromPyObject (PyObject * py_obj)
+
+//-----------------Armature_FromPyObject -----------------------------
+struct bArmature *Armature_FromPyObject( PyObject * py_obj )
 {
-  BPy_Armature *blen_obj;
+       BPy_Armature *blen_obj;
 
-  blen_obj = (BPy_Armature *) py_obj;
-  return (blen_obj->armature);
+       blen_obj = ( BPy_Armature * ) py_obj;
+       return ( blen_obj->armature );
 }
-//-----------------Blender Module function prototypes-------------------------------------------------
-//----------------Blender.Armature.New()-------------------------------------------------------------------
-static PyObject *
-M_Armature_New (PyObject * self, PyObject * args)
+
+//-----------------Blender Module function prototypes-----------------
+
+//----------------Blender.Armature.New()------------------------------
+static PyObject *M_Armature_New( PyObject * self, PyObject * args )
 {
-  char        *name_str = "ArmatureData";
-  BPy_Armature  *py_armature; /* for Armature Data object wrapper in Python */
-  bArmature   *bl_armature; /* for actual Armature Data we create in Blender */
-  char        buf[21];
-
-  if (!PyArg_ParseTuple(args, "|s", &name_str))
-    return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-           "expected string or empty argument"));
-
-  bl_armature = add_armature(); /* first create in Blender */
-  
-  if (bl_armature){
-    /* return user count to zero because add_armature() inc'd it */
-    bl_armature->id.us = 0;
-    /* now create the wrapper obj in Python */
-    py_armature = (BPy_Armature *)PyObject_NEW(BPy_Armature, &Armature_Type);
-  }else{
-    return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
-           "couldn't create Armature Data in Blender"));
-  }
-
-  if (py_armature == NULL)
-    return (EXPP_ReturnPyObjError (PyExc_MemoryError,
-           "couldn't create ArmaturePyObject"));
-
-  /* link Python armature wrapper with Blender Armature: */
-  py_armature->armature = bl_armature;
-
-  if (strcmp(name_str, "ArmatureData") == 0)
-    return (PyObject *)py_armature;
-  else { /* user gave us a name for the armature, use it */
-    PyOS_snprintf(buf, sizeof(buf), "%s", name_str);
-    rename_id(&bl_armature->id, buf);
-  }
-
-  return (PyObject *)py_armature;
+       char *name_str = "ArmatureData";
+       BPy_Armature *py_armature;      /* for Armature Data object wrapper in Python */
+       bArmature *bl_armature; /* for actual Armature Data we create in Blender */
+       char buf[21];
+
+       if( !PyArg_ParseTuple( args, "|s", &name_str ) )
+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                               "expected string or empty argument" ) );
+
+       bl_armature = add_armature(  ); /* first create in Blender */
+
+       if( bl_armature ) {
+               /* return user count to zero because add_armature() inc'd it */
+               bl_armature->id.us = 0;
+               /* now create the wrapper obj in Python */
+               py_armature =
+                       ( BPy_Armature * ) PyObject_NEW( BPy_Armature,
+                                                        &Armature_Type );
+       } else {
+               return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                                               "couldn't create Armature Data in Blender" ) );
+       }
+
+       if( py_armature == NULL )
+               return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
+                                               "couldn't create ArmaturePyObject" ) );
+
+       /* link Python armature wrapper with Blender Armature: */
+       py_armature->armature = bl_armature;
+
+       if( strcmp( name_str, "ArmatureData" ) == 0 )
+               return ( PyObject * ) py_armature;
+       else {                  /* user gave us a name for the armature, use it */
+               PyOS_snprintf( buf, sizeof( buf ), "%s", name_str );
+               rename_id( &bl_armature->id, buf );
+       }
+
+       return ( PyObject * ) py_armature;
 }
-//----------------Blender.Armature.Get()-------------------------------------------------------------------
-static PyObject *
-M_Armature_Get (PyObject * self, PyObject * args)
+
+//----------------Blender.Armature.Get()------------------------------
+static PyObject *M_Armature_Get( PyObject * self, PyObject * args )
 {
        char *name = NULL;
        bArmature *armature_iter;
        BPy_Armature *wanted_armature;
 
-       if (!PyArg_ParseTuple (args, "|s", &name))
-       return (EXPP_ReturnPyObjError (PyExc_TypeError,
-                       "expected string argument (or nothing)"));
+       if( !PyArg_ParseTuple( args, "|s", &name ) )
+               return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+                                               "expected string argument (or nothing)" ) );
 
        armature_iter = G.main->armature.first;
 
        /* Use the name to search for the armature requested. */
 
-       if (name){                              /* (name) - Search armature by name */
+       if( name ) {            /* (name) - Search armature by name */
                wanted_armature = NULL;
-               while ((armature_iter) && (wanted_armature == NULL)){
-                       if (strcmp (name, armature_iter->id.name + 2) == 0) {
+               while( ( armature_iter ) && ( wanted_armature == NULL ) ) {
+                       if( strcmp( name, armature_iter->id.name + 2 ) == 0 ) {
                                wanted_armature =
-                                       (BPy_Armature *) PyObject_NEW (BPy_Armature, &Armature_Type);
-                               if (wanted_armature)
-                                       wanted_armature->armature = armature_iter;
+                                       ( BPy_Armature * )
+                                       PyObject_NEW( BPy_Armature,
+                                                     &Armature_Type );
+                               if( wanted_armature )
+                                       wanted_armature->armature =
+                                               armature_iter;
                        }
                        armature_iter = armature_iter->id.next;
                }
 
-               if (wanted_armature == NULL){                   /* Requested Armature doesn't exist */
+               if( wanted_armature == NULL ) { /* Requested Armature doesn't exist */
                        char error_msg[64];
-                       PyOS_snprintf (error_msg, sizeof (error_msg),
-                               "Armature \"%s\" not found", name);
-                       return (EXPP_ReturnPyObjError (PyExc_NameError, error_msg));
+                       PyOS_snprintf( error_msg, sizeof( error_msg ),
+                                      "Armature \"%s\" not found", name );
+                       return ( EXPP_ReturnPyObjError
+                                ( PyExc_NameError, error_msg ) );
                }
-               return (PyObject *) wanted_armature;
-       }else{
+               return ( PyObject * ) wanted_armature;
+       } else {
                /* Return a list of with armatures in the scene */
                int index = 0;
                PyObject *armlist, *pyobj;
 
-               armlist = PyList_New (BLI_countlist (&(G.main->armature)));
+               armlist = PyList_New( BLI_countlist( &( G.main->armature ) ) );
 
-               if (armlist == NULL)
-                       return (EXPP_ReturnPyObjError (PyExc_MemoryError,
-                                               "couldn't create PyList"));
+               if( armlist == NULL )
+                       return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
+                                                       "couldn't create PyList" ) );
 
-               while (armature_iter){
-                       pyobj = Armature_CreatePyObject (armature_iter);
+               while( armature_iter ) {
+                       pyobj = Armature_CreatePyObject( armature_iter );
 
-                       if (!pyobj)
-                       return (EXPP_ReturnPyObjError (PyExc_MemoryError,
-                                                       "couldn't create PyString"));
+                       if( !pyobj )
+                               return ( EXPP_ReturnPyObjError
+                                        ( PyExc_MemoryError,
+                                          "couldn't create PyString" ) );
 
-                       PyList_SET_ITEM (armlist, index, pyobj);
+                       PyList_SET_ITEM( armlist, index, pyobj );
                        armature_iter = armature_iter->id.next;
                        index++;
                }
-       return (armlist);
+               return ( armlist );
        }
 }
-//--------------------------Python BPy_Armature methods------------------------------------------
-//---------------------BPy_Armature.getName()-------------------------------------------------------
-static PyObject *
-Armature_getName (BPy_Armature * self)
+
+//--------------------------Python BPy_Armature methods---------------
+
+//---------------------BPy_Armature.getName()-------------------------
+static PyObject *Armature_getName( BPy_Armature * self )
 {
-  PyObject *attr = PyString_FromString (self->armature->id.name + 2);
+       PyObject *attr = PyString_FromString( self->armature->id.name + 2 );
 
-  if (attr)
-    return attr;
+       if( attr )
+               return attr;
 
-  return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
-                                "couldn't get Armature.name attribute"));
+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                                       "couldn't get Armature.name attribute" ) );
 }
-//---------------------BPy_Armature.getBones()-------------------------------------------------------
-static PyObject *
-Armature_getBones (BPy_Armature * self)
+
+//---------------------BPy_Armature.getBones()------------------------
+static PyObject *Armature_getBones( BPy_Armature * self )
 {
 
-  PyObject *listbones = NULL;
-  Bone *parent = NULL;
-  
-  listbones = PyList_New(0);
+       PyObject *listbones = NULL;
+       Bone *parent = NULL;
 
-  //append root bones
-  for (parent = self->armature->bonebase.first; parent; parent = parent->next){
-      PyList_Append (listbones, Bone_CreatePyObject (parent));
-         if(parent->childbase.first){   //has children?
-                       append_childrenToList(parent, listbones);
-         }
-  }
+       listbones = PyList_New( 0 );
 
-  return listbones;
+       //append root bones
+       for( parent = self->armature->bonebase.first; parent;
+            parent = parent->next ) {
+               PyList_Append( listbones, Bone_CreatePyObject( parent ) );
+               if( parent->childbase.first ) { //has children?
+                       append_childrenToList( parent, listbones );
+               }
+       }
+
+       return listbones;
 }
-//---------------------BPy_Armature.addBone()-------------------------------------------------------
-static PyObject *Armature_addBone(BPy_Armature *self, PyObject *args)
+
+//---------------------BPy_Armature.addBone()-------------------------
+static PyObject *Armature_addBone( BPy_Armature * self, PyObject * args )
 {
-       BPy_Bonepy_bone = NULL;
+       BPy_Bone *py_bone = NULL;
        float M_boneObjectspace[4][4];
        float iM_parentRest[4][4];
        Bone *blen_bone;
        char *parent_str = "";
        Bone *parent;
-       
-       if (!PyArg_ParseTuple(args, "O!", &Bone_Type, &py_bone))
-               return (EXPP_ReturnPyObjError (PyExc_TypeError, 
-                       "expected bone object argument (or nothing)"));
 
-       if(py_bone->bone != NULL)
-               return EXPP_ReturnPyObjError (PyExc_TypeError, "this bone has already been linked to an armature");
+       if( !PyArg_ParseTuple( args, "O!", &Bone_Type, &py_bone ) )
+               return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+                                               "expected bone object argument (or nothing)" ) );
+
+       if( py_bone->bone != NULL )
+               return EXPP_ReturnPyObjError( PyExc_TypeError,
+                                             "this bone has already been linked to an armature" );
 
-       //check to see if we can parent this bone if it will be attempted otherwise exit
-       if(!BLI_streq(py_bone->parent, parent_str)){     //parenting being attempted
+       //check to see if we can parent this bone if it will be attempted 
+        //otherwise exit
+       if( !BLI_streq( py_bone->parent, parent_str ) ) {       //parenting being attempted
                //get parent if exists in this armature
-               parent = testBoneNameInArmature(self->armature, py_bone->parent);
-               if(!parent){ //could find the parent's name
-                       return (EXPP_ReturnPyObjError (PyExc_TypeError, 
-                          "cannot find parent's name in armature - check to see if name of parent is correct"));
+               parent = testBoneNameInArmature( self->armature,
+                                                py_bone->parent );
+               if( !parent ) { //could find the parent's name
+                       return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+                                                       "cannot find parent's name in armature - check to see if name of parent is correct" ) );
                }
-       }else{ //no parent for this bone
+       } else {                //no parent for this bone
                parent = NULL;
        }
 
        //create a bone struct
-       blen_bone = (Bone*)MEM_callocN(sizeof(Bone), "DefaultBone");
+       blen_bone = ( Bone * ) MEM_callocN( sizeof( Bone ), "DefaultBone" );
 
        //set the bone struct pointer
        py_bone->bone = blen_bone;
        //update the bonestruct data from py data
-       if(!updateBoneData(py_bone, parent))
-               return EXPP_ReturnPyObjError (PyExc_AttributeError , "bone struct empty");
+       if( !updateBoneData( py_bone, parent ) )
+               return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                             "bone struct empty" );
 
        //make sure the name is unique for this armature
-       unique_BoneName(py_bone->bone->name, self->armature);
+       unique_BoneName( py_bone->bone->name, self->armature );
 
-       //if bone has a parent....      
-       if(py_bone->bone->parent){
+       //if bone has a parent....      
+       if( py_bone->bone->parent ) {
 
                //then check to see if parent has been added to the armature - bone loop test
-               if(!testBoneInArmature(self->armature, py_bone->bone->parent))
-                       return (EXPP_ReturnPyObjError (PyExc_TypeError, 
-                          "cannot parent to a bone not yet added to armature!"));
-               
+               if( !testBoneInArmature
+                   ( self->armature, py_bone->bone->parent ) )
+                       return ( EXPP_ReturnPyObjError
+                                ( PyExc_TypeError,
+                                  "cannot parent to a bone not yet added to armature!" ) );
+
                //add to parent's childbase
-               BLI_addtail (&py_bone->bone->parent->childbase, py_bone->bone);
+               BLI_addtail( &py_bone->bone->parent->childbase,
+                            py_bone->bone );
 
                //get the worldspace coords for the parent
-               get_objectspace_bone_matrix(py_bone->bone->parent, M_boneObjectspace, 0,0);
+               get_objectspace_bone_matrix( py_bone->bone->parent,
+                                            M_boneObjectspace, 0, 0 );
 
                // Invert the parent rest matrix
-               Mat4Invert (iM_parentRest, M_boneObjectspace);
+               Mat4Invert( iM_parentRest, M_boneObjectspace );
 
                //transformation of local bone
-               Mat4MulVecfl(iM_parentRest, py_bone->bone->tail);
-               Mat4MulVecfl(iM_parentRest, py_bone->bone->head);
+               Mat4MulVecfl( iM_parentRest, py_bone->bone->tail );
+               Mat4MulVecfl( iM_parentRest, py_bone->bone->head );
 
-       }else //no parent....
-               BLI_addtail (&self->armature->bonebase,py_bone->bone);
+       } else                  //no parent....
+               BLI_addtail( &self->armature->bonebase, py_bone->bone );
 
        //rebuild_bone_parent_matrix(py_bone->bone);
 
-       precalc_bonelist_irestmats(&self->armature->bonebase);
-       precalc_armature_posemats(self->armature);
-       precalc_bone_defmat (py_bone->bone);
-       
-       Py_INCREF(Py_None);
+       precalc_bonelist_irestmats( &self->armature->bonebase );
+       precalc_armature_posemats( self->armature );
+       precalc_bone_defmat( py_bone->bone );
+
+       Py_INCREF( Py_None );
        return Py_None;
 }
-//---------------------BPy_Armature.setName()-------------------------------------------------------
-static PyObject *
-Armature_setName (BPy_Armature * self, PyObject * args)
+
+//---------------------BPy_Armature.setName()-------------------------
+static PyObject *Armature_setName( BPy_Armature * self, PyObject * args )
 {
-  char *name;
-  char buf[21];
+       char *name;
+       char buf[21];
 
-  if (!PyArg_ParseTuple (args, "s", &name))
-    return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                  "expected string argument"));
+       if( !PyArg_ParseTuple( args, "s", &name ) )
+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                               "expected string argument" ) );
 
-  PyOS_snprintf (buf, sizeof (buf), "%s", name);
+       PyOS_snprintf( buf, sizeof( buf ), "%s", name );
 
-  rename_id (&self->armature->id, buf);
+       rename_id( &self->armature->id, buf );
 
-  Py_INCREF (Py_None);
-  return Py_None;
+       Py_INCREF( Py_None );
+       return Py_None;
 }
-//---------------------BPy_Armature.drawAxes()-------------------------------------------------------
-static PyObject *
-Armature_drawAxes (BPy_Armature * self, PyObject * args)
+
+//---------------------BPy_Armature.drawAxes()------------------------
+static PyObject *Armature_drawAxes( BPy_Armature * self, PyObject * args )
 {
        int toggle;
 
-       if (!PyArg_ParseTuple (args, "i", &toggle))
-               return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                       "expected 1 or 0 as integer"));
+       if( !PyArg_ParseTuple( args, "i", &toggle ) )
+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                               "expected 1 or 0 as integer" ) );
 
-       if(toggle)
+       if( toggle )
                self->armature->flag |= ARM_DRAWAXES;
        else
                self->armature->flag &= ~ARM_DRAWAXES;
 
-       Py_INCREF (Py_None);
+       Py_INCREF( Py_None );
        return Py_None;
 }
-//---------------------BPy_Armature.drawNames()-------------------------------------------------------
-static PyObject *
-Armature_drawNames (BPy_Armature * self, PyObject * args)
+
+//---------------------BPy_Armature.drawNames()-------------------------
+static PyObject *Armature_drawNames( BPy_Armature * self, PyObject * args )
 {
        int toggle;
 
-       if (!PyArg_ParseTuple (args, "i", &toggle))
-               return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                       "expected 1 or 0 as integer"));
+       if( !PyArg_ParseTuple( args, "i", &toggle ) )
+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                               "expected 1 or 0 as integer" ) );
 
-       if(toggle)
+       if( toggle )
                self->armature->flag |= ARM_DRAWNAMES;
        else
                self->armature->flag &= ~ARM_DRAWNAMES;
 
-       Py_INCREF (Py_None);
+       Py_INCREF( Py_None );
        return Py_None;
 }
-
index 4b40c08d300b5203cdf75f0b123c68edbe4f7845..c96736b4c5e2a66bdd20e01b214a59bfed103b86 100644 (file)
@@ -1,4 +1,5 @@
 /* 
+ * $Id$
  *
  * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
  *
 #include <Python.h>
 #include <DNA_armature_types.h>
 
-//---------------------Python BPy_Armature structure definition------------------------------
+//---------------------Python BPy_Armature structure definition-------
 typedef struct {
-  PyObject_HEAD
-  bArmature *armature;
+       PyObject_HEAD bArmature * armature;
 } BPy_Armature;
 
-//--------------------visible prototypes------------------------------------------------------------
-PyObject *Armature_Init (void);
+//--------------------visible prototypes------------------------------
+PyObject *Armature_Init( void );
 
-#endif /* EXPP_ARMATURE_H */
+#endif                         /* EXPP_ARMATURE_H */
index fe9ef6d6948062f42a7e3a3e7a0f412e516796ec..c5b2d9df85c539c4e74f5f64d9c86dd763d6e77a 100644 (file)
@@ -1,4 +1,5 @@
 /* 
+ * $Id$
  *
  * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
  *
@@ -60,7 +61,7 @@
 #include "BIF_mywindow.h"
 
 #include "interface.h"
-#include "mydevice.h"  /*@ for all the event constants */
+#include "mydevice.h"          /*@ for all the event constants */
 
 #include "Python.h"
 
 /*@ For Python access to OpenGL functions requiring a pointer. */
 
 typedef struct _Buffer {
-  PyObject_VAR_HEAD
-
-  PyObject *parent;
-  
-  int type; /* GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT */
-  int ndimensions;
-  int *dimensions;
-  
-  union {
-    char  *asbyte;
-    short *asshort;
-    int   *asint;
-    float *asfloat;
-
-    void  *asvoid;
-  } buf;
+       PyObject_VAR_HEAD PyObject * parent;
+
+       int type;               /* GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT */
+       int ndimensions;
+       int *dimensions;
+
+       union {
+               char *asbyte;
+               short *asshort;
+               int *asint;
+               float *asfloat;
+
+               void *asvoid;
+       } buf;
 } Buffer;
 
-static int type_size(int type);
-static Buffer *make_buffer(int type, int ndimensions, int *dimensions);
-static int Buffer_ass_slice(PyObject *self, int begin, int end, PyObject *seq);
+static int type_size( int type );
+static Buffer *make_buffer( int type, int ndimensions, int *dimensions );
+static int Buffer_ass_slice( PyObject * self, int begin, int end,
+                            PyObject * seq );
 
-static char Method_Buffer_doc[]=
-"(type, dimensions, [template]) - Create a new Buffer object\n\n\
+static char Method_Buffer_doc[] =
+       "(type, dimensions, [template]) - Create a new Buffer object\n\n\
 (type) - The format to store data in\n\
 (dimensions) - An int or sequence specifying the dimensions of the buffer\n\
 [template] - A sequence of matching dimensions to the buffer to be created\n\
@@ -109,46 +109,47 @@ For example, passing [100, 100] will create a 2 dimensional\n\
 square buffer. Passing [16, 16, 32] will create a 3 dimensional\n\
 buffer which is twice as deep as it is wide or high.";
 
-static PyObject *Method_Buffer (PyObject *self, PyObject *args);
+static PyObject *Method_Buffer( PyObject * self, PyObject * args );
 
 /* Buffer sequence methods */
 
-static int Buffer_len(PyObject *self);
-static PyObject *Buffer_item(PyObject *self, int i);
-static PyObject *Buffer_slice(PyObject *self, int begin, int end);
-static int Buffer_ass_item(PyObject *self, int i, PyObject *v);
-static int Buffer_ass_slice(PyObject *self, int begin, int end, PyObject *seq);
+static int Buffer_len( PyObject * self );
+static PyObject *Buffer_item( PyObject * self, int i );
+static PyObject *Buffer_slice( PyObject * self, int begin, int end );
+static int Buffer_ass_item( PyObject * self, int i, PyObject * v );
+static int Buffer_ass_slice( PyObject * self, int begin, int end,
+                            PyObject * seq );
 
 static PySequenceMethods Buffer_SeqMethods = {
-  (inquiry)           Buffer_len,       /*sq_length*/
-  (binaryfunc)        0,                /*sq_concat*/
-  (intargfunc)        0,                /*sq_repeat*/
-  (intargfunc)        Buffer_item,      /*sq_item*/
-  (intintargfunc)     Buffer_slice,     /*sq_slice*/
-  (intobjargproc)     Buffer_ass_item,  /*sq_ass_item*/
-  (intintobjargproc)  Buffer_ass_slice, /*sq_ass_slice*/
+       ( inquiry ) Buffer_len, /*sq_length */
+       ( binaryfunc ) 0,       /*sq_concat */
+       ( intargfunc ) 0,       /*sq_repeat */
+       ( intargfunc ) Buffer_item,     /*sq_item */
+       ( intintargfunc ) Buffer_slice, /*sq_slice */
+       ( intobjargproc ) Buffer_ass_item,      /*sq_ass_item */
+       ( intintobjargproc ) Buffer_ass_slice,  /*sq_ass_slice */
 };
 
-static void Buffer_dealloc(PyObject *self);
-static PyObject *Buffer_tolist(PyObject *self);
-static PyObject *Buffer_dimensions(PyObject *self);
-static PyObject *Buffer_getattr(PyObject *self, char *name);
-static PyObject *Buffer_repr(PyObject *self);
+static void Buffer_dealloc( PyObject * self );
+static PyObject *Buffer_tolist( PyObject * self );
+static PyObject *Buffer_dimensions( PyObject * self );
+static PyObject *Buffer_getattr( PyObject * self, char *name );
+static PyObject *Buffer_repr( PyObject * self );
 
 PyTypeObject buffer_Type = {
-  PyObject_HEAD_INIT(NULL)
-  0,                            /*ob_size*/
-  "buffer",                     /*tp_name*/
-  sizeof(Buffer),               /*tp_basicsize*/
-  0,                            /*tp_itemsize*/
-  (destructor) Buffer_dealloc,  /*tp_dealloc*/
-  (printfunc)  0,               /*tp_print*/
-  (getattrfunc) Buffer_getattr, /*tp_getattr*/
-  (setattrfunc) 0,              /*tp_setattr*/
-  (cmpfunc) 0,                  /*tp_compare*/
-  (reprfunc) Buffer_repr,       /*tp_repr*/
-  0,                            /*tp_as_number*/
-  &Buffer_SeqMethods,           /*tp_as_sequence*/
+       PyObject_HEAD_INIT( NULL )      /* required python macro */
+       0,      /*ob_size */
+       "buffer",               /*tp_name */
+       sizeof( Buffer ),       /*tp_basicsize */
+       0,                      /*tp_itemsize */
+       ( destructor ) Buffer_dealloc,  /*tp_dealloc */
+       ( printfunc ) 0,        /*tp_print */
+       ( getattrfunc ) Buffer_getattr, /*tp_getattr */
+       ( setattrfunc ) 0,      /*tp_setattr */
+       ( cmpfunc ) 0,          /*tp_compare */
+       ( reprfunc ) Buffer_repr,       /*tp_repr */
+       0,                      /*tp_as_number */
+       &Buffer_SeqMethods,     /*tp_as_sequence */
 };
 
 /* #ifndef __APPLE__ */
@@ -173,7 +174,7 @@ PyTypeObject buffer_Type = {
 /* TYPE_def is the C initialization of the variable */
 
 #define void_str      ""
-#define void_var(num)   
+#define void_var(num)
 #define void_ref(num)   &bgl_var##num
 #define void_def(num)   char bgl_var##num
 
@@ -252,7 +253,7 @@ PyTypeObject buffer_Type = {
  * Py_ArgParse doesn't grok writing into unsigned variables, 
  * so we use signed everything (even stuff that should be unsigned.
  */
+
 /* typedef unsigned int GLenum; */
 #define GLenum_str      "i"
 #define GLenum_var(num)   bgl_var##num
@@ -387,28 +388,28 @@ PyTypeObject buffer_Type = {
 #define arg_str9(a1, a2, a3, a4, a5, a6, a7, a8, a9)arg_str8(a1, a2, a3, a4, a5, a6, a7, a8) a9##_str
 #define arg_str10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)arg_str9(a1, a2, a3, a4, a5, a6, a7, a8, a9) a10##_str
 
-#define ret_def_void  
-#define ret_set_void  
+#define ret_def_void
+#define ret_set_void
 #define ret_ret_void    return EXPP_incr_ret(Py_None)
 
 #define ret_def_GLint   int ret_int
-#define ret_set_GLint   ret_int= 
+#define ret_set_GLint   ret_int=
 #define ret_ret_GLint   return PyInt_FromLong(ret_int);
 
 #define ret_def_GLuint    unsigned int ret_uint
-#define ret_set_GLuint    ret_uint= 
+#define ret_set_GLuint    ret_uint=
 #define ret_ret_GLuint    return PyInt_FromLong((long) ret_uint);
 
 #define ret_def_GLenum    unsigned int ret_uint
-#define ret_set_GLenum    ret_uint= 
+#define ret_set_GLenum    ret_uint=
 #define ret_ret_GLenum    return PyInt_FromLong((long) ret_uint);
 
 #define ret_def_GLboolean unsigned char ret_bool
-#define ret_set_GLboolean ret_bool= 
+#define ret_set_GLboolean ret_bool=
 #define ret_ret_GLboolean return PyInt_FromLong((long) ret_bool);
 
 #define ret_def_GLstring  const unsigned char *ret_str;
-#define ret_set_GLstring  ret_str= 
+#define ret_set_GLstring  ret_str=
 #define ret_ret_GLstring  return PyString_FromString(ret_str);
 
 #define BGL_Wrap(nargs, funcname, ret, arg_list) \
@@ -431,4 +432,4 @@ static PyObject *Method_##funcname (PyObject *self, PyObject *args) {\
 
 /* #endif */
 
-PyObject *BGL_Init(void); 
+PyObject *BGL_Init( void );
index 9c3034aa5cdaaf4c6876ae537e7e9a92e1589b9f..23cd7d50d227dbf7fd8baae982a5f4d6ef585edd 100644 (file)
 #include "modules.h"
 
 /*****************************************************************************/
-/* Python API function prototypes for the BezTriple module.                        */
+/* Python API function prototypes for the BezTriple module.                  */
 /*****************************************************************************/
-static PyObject *M_BezTriple_New (PyObject * self, PyObject * args);
-static PyObject *M_BezTriple_Get (PyObject * self, PyObject * args);
+static PyObject *M_BezTriple_New( PyObject * self, PyObject * args );
+static PyObject *M_BezTriple_Get( PyObject * self, PyObject * args );
 
 /*****************************************************************************/
-/* Python C_BezTriple instance methods declarations:                            */
+/* Python C_BezTriple instance methods declarations:                        */
 /*****************************************************************************/
-static PyObject *BezTriple_setPoints (C_BezTriple * self, PyObject * args);
-static PyObject *BezTriple_getPoints (C_BezTriple * self);
-static PyObject *BezTriple_getTriple (C_BezTriple * self);
+static PyObject *BezTriple_setPoints( C_BezTriple * self, PyObject * args );
+static PyObject *BezTriple_getPoints( C_BezTriple * self );
+static PyObject *BezTriple_getTriple( C_BezTriple * self );
 
 /*****************************************************************************/
-/* Python BezTriple_Type callback function prototypes:                          */
+/* Python BezTriple_Type callback function prototypes:                      */
 /*****************************************************************************/
-static void BezTripleDeAlloc (C_BezTriple * self);
-static int BezTripleSetAttr (C_BezTriple * self, char *name, PyObject * v);
-static PyObject *BezTripleGetAttr (C_BezTriple * self, char *name);
-static PyObject *BezTripleRepr (C_BezTriple * self);
+static void BezTripleDeAlloc( C_BezTriple * self );
+static int BezTripleSetAttr( C_BezTriple * self, char *name, PyObject * v );
+static PyObject *BezTripleGetAttr( C_BezTriple * self, char *name );
+static PyObject *BezTripleRepr( C_BezTriple * self );
 
 /*****************************************************************************/
-/* Python method structure definition for Blender.BezTriple module:             */
+/* Python method structure definition for Blender.BezTriple module:          */
 /*****************************************************************************/
 
 struct PyMethodDef M_BezTriple_methods[] = {
-  {"New", (PyCFunction) M_BezTriple_New, METH_VARARGS | METH_KEYWORDS, 0},
-  {"Get", M_BezTriple_Get, METH_VARARGS, 0},
-  {"get", M_BezTriple_Get, METH_VARARGS, 0},
-  {NULL, NULL, 0, NULL}
+       {"New", ( PyCFunction ) M_BezTriple_New, METH_VARARGS | METH_KEYWORDS,
+        0},
+       {"Get", M_BezTriple_Get, METH_VARARGS, 0},
+       {"get", M_BezTriple_Get, METH_VARARGS, 0},
+       {NULL, NULL, 0, NULL}
 };
 
 /*****************************************************************************/
-/* Python C_BezTriple methods table:                                            */
+/* Python C_BezTriple methods table:                                        */
 /*****************************************************************************/
 static PyMethodDef C_BezTriple_methods[] = {
-  /* name, method, flags, doc */
-  {"setPoints", (PyCFunction) BezTriple_setPoints, METH_VARARGS,
-   "(str) - Change BezTriple point coordinates"},
-  {"getPoints", (PyCFunction) BezTriple_getPoints, METH_NOARGS,
-   "() - return BezTriple knot point x and y coordinates"},
-  {"getTriple", (PyCFunction) BezTriple_getTriple, METH_NOARGS,
-   "() - return list of 3 floating point triplets.  order is H1, knot, H2"},
-  {NULL, NULL, 0, NULL}
+       /* name, method, flags, doc */
+       {"setPoints", ( PyCFunction ) BezTriple_setPoints, METH_VARARGS,
+        "(str) - Change BezTriple point coordinates"},
+       {"getPoints", ( PyCFunction ) BezTriple_getPoints, METH_NOARGS,
+        "() - return BezTriple knot point x and y coordinates"},
+       {"getTriple", ( PyCFunction ) BezTriple_getTriple, METH_NOARGS,
+        "() - return list of 3 floating point triplets.  order is H1, knot, H2"},
+       {NULL, NULL, 0, NULL}
 };
 
 
 /*****************************************************************************/
-/* Python BezTriple_Type structure definition:                                  */
+/* Python BezTriple_Type structure definition:                              */
 /*****************************************************************************/
 PyTypeObject BezTriple_Type = {
-  PyObject_HEAD_INIT (NULL) 0, /* ob_size */
-  "BezTriple",                 /* tp_name */
-  sizeof (C_BezTriple),                /* tp_basicsize */
-  0,                           /* tp_itemsize */
-  /* methods */
-  (destructor) BezTripleDeAlloc,       /* tp_dealloc */
-  0,                           /* tp_print */
-  (getattrfunc) BezTripleGetAttr,      /* tp_getattr */
-  (setattrfunc) BezTripleSetAttr,      /* tp_setattr */
-  0,                           /* tp_compare */
-  (reprfunc) BezTripleRepr,    /* tp_repr */
-  0,                           /* tp_as_number */
-  0,                           /* tp_as_sequence */
-  0,                           /* tp_as_mapping */
-  0,                           /* tp_as_hash */
-  0, 0, 0, 0, 0, 0,
-  0,                           /* tp_doc */
-  0, 0, 0, 0, 0, 0,
-  C_BezTriple_methods,         /* tp_methods */
-  0,                           /* tp_members */
-  0,                           /* tm_getset */
-  0
+       PyObject_HEAD_INIT( NULL )  /* required python macro */
+       0,      /* ob_size */
+       "BezTriple",            /* tp_name */
+       sizeof( C_BezTriple ),  /* tp_basicsize */
+       0,                      /* tp_itemsize */
+       /* methods */
+       ( destructor ) BezTripleDeAlloc,        /* tp_dealloc */
+       0,                      /* tp_print */
+       ( getattrfunc ) BezTripleGetAttr,       /* tp_getattr */
+       ( setattrfunc ) BezTripleSetAttr,       /* tp_setattr */
+       0,                      /* tp_compare */
+       ( reprfunc ) BezTripleRepr,     /* tp_repr */
+       0,                      /* tp_as_number */
+       0,                      /* tp_as_sequence */
+       0,                      /* tp_as_mapping */
+       0,                      /* tp_as_hash */
+       0, 0, 0, 0, 0, 0,
+       0,                      /* tp_doc */
+       0, 0, 0, 0, 0, 0,
+       C_BezTriple_methods,    /* tp_methods */
+       0,                      /* tp_members */
+       0,                      /* tm_getset */
+       0
 };
 
 
 /*****************************************************************************/
-/* Function:              M_BezTriple_New                                          */
-/* Python equivalent:     Blender.BezTriple.New                                    */
+/* Function:              M_BezTriple_New                                   */
+/* Python equivalent:     Blender.BezTriple.New                             */
 /*****************************************************************************/
-static PyObject *
-M_BezTriple_New (PyObject * self, PyObject * args)
+static PyObject *M_BezTriple_New( PyObject * self, PyObject * args )
 {
-  return 0;
+       return 0;
 }
 
 /*****************************************************************************/
-/* Function:              M_BezTriple_Get                                       */
-/* Python equivalent:     Blender.BezTriple.Get                                 */
+/* Function:              M_BezTriple_Get                                   */
+/* Python equivalent:     Blender.BezTriple.Get                             */
 /* Description:           Receives a string and returns the ipo data obj  */
 /*                        whose name matches the string.  If no argument is  */
 /*                        passed in, a list of all ipo data names in the  */
 /*                        current scene is returned.                         */
 /*****************************************************************************/
-static PyObject *
-M_BezTriple_Get (PyObject * self, PyObject * args)
+static PyObject *M_BezTriple_Get( PyObject * self, PyObject * args )
 {
-  return 0;
+       return 0;
 }
 
 /*****************************************************************************/
-/* Function:    BezTripleDeAlloc                                                   */
-/* Description: This is a callback function for the C_BezTriple type. It is        */
+/* Function:    BezTripleDeAlloc                                            */
+/* Description: This is a callback function for the C_BezTriple type. It is  */
 /*              the destructor function.                                     */
 /*****************************************************************************/
-static void
-BezTripleDeAlloc (C_BezTriple * self)
+static void BezTripleDeAlloc( C_BezTriple * self )
 {
-  PyObject_DEL (self);
+       PyObject_DEL( self );
 }
 
-static PyObject *
-BezTriple_getPoints (C_BezTriple * self)
+static PyObject *BezTriple_getPoints( C_BezTriple * self )
 {
-  struct BezTriple *bezt = self->beztriple;
-  PyObject *l = PyList_New (0);
-  int i;
-  for (i = 0; i < 2; i++)
-    {
-      PyList_Append (l, PyFloat_FromDouble (bezt->vec[1][i]));
-    }
-  return l;
+       struct BezTriple *bezt = self->beztriple;
+       PyObject *l = PyList_New( 0 );
+       int i;
+       for( i = 0; i < 2; i++ ) {
+               PyList_Append( l, PyFloat_FromDouble( bezt->vec[1][i] ) );
+       }
+       return l;
 }
 
 
@@ -178,120 +175,112 @@ BezTriple_getPoints (C_BezTriple * self)
  *  each point consists of a list of x,y,z float values.
  */
 
-static PyObject *
-BezTriple_getTriple (C_BezTriple * self)
+static PyObject *BezTriple_getTriple( C_BezTriple * self )
 {
-  int i;
-  struct BezTriple *bezt = self->beztriple;
-  PyObject *retlist = PyList_New (0);
-  PyObject *point;
+       int i;
+       struct BezTriple *bezt = self->beztriple;
+       PyObject *retlist = PyList_New( 0 );
+       PyObject *point;
 
-  for (i = 0; i < 3; i++)
-    {
-      point = Py_BuildValue ("[fff]",
-                            bezt->vec[i][0],
-                            bezt->vec[i][1], bezt->vec[i][2]);
+       for( i = 0; i < 3; i++ ) {
+               point = Py_BuildValue( "[fff]",
+                                      bezt->vec[i][0],
+                                      bezt->vec[i][1], bezt->vec[i][2] );
 
-      PyList_Append (retlist, point);
-    }
+               PyList_Append( retlist, point );
+       }
 
-  return retlist;
+       return retlist;
 }
 
 
-static PyObject *
-BezTriple_setPoints (C_BezTriple * self, PyObject * args)
+static PyObject *BezTriple_setPoints( C_BezTriple * self, PyObject * args )
 {
 
-  int i;
-  struct BezTriple *bezt = self->beztriple;
-  PyObject *popo = 0;
-
-  if (!PyArg_ParseTuple (args, "O", &popo))
-    return (EXPP_ReturnPyObjError
-           (PyExc_TypeError, "expected sequence argument"));
-
-  if (PySequence_Check (popo) == 0)
-    {
-      puts ("error in BezTriple_setPoints - expected sequence");
-      Py_INCREF (Py_None);
-      return Py_None;
-    }
-
-  {
-    /*
-       some debug stuff 
-       this will become an overloaded args check
-     */
-    int size = PySequence_Size (popo);
-    printf ("\n dbg: sequence size is %d\n", size);
-  }
-
-  for (i = 0; i < 2; i++)
-    {
-      PyObject *o = PySequence_GetItem (popo, i);
-      if (!o)
-       printf ("\n bad o. o no!\n");
-
-      /*   bezt->vec[1][i] = PyFloat_AsDouble (PyTuple_GetItem (popo, i)); */
-      bezt->vec[1][i] = PyFloat_AsDouble (o);
-      bezt->vec[0][i] = bezt->vec[1][i] - 1;
-      bezt->vec[2][i] = bezt->vec[1][i] + 1;
-    }
-
-  /* experimental fussing with handles - ipo.c: calchandles_ipocurve */
-  if (bezt->vec[0][0] > bezt->vec[1][0])
-    bezt->vec[0][0] = bezt->vec[1][0];
-
-  if (bezt->vec[2][0] < bezt->vec[1][0])
-    bezt->vec[2][0] = bezt->vec[1][0];
-
-  Py_INCREF (Py_None);
-  return Py_None;
+       int i;
+       struct BezTriple *bezt = self->beztriple;
+       PyObject *popo = 0;
+
+       if( !PyArg_ParseTuple( args, "O", &popo ) )
+               return ( EXPP_ReturnPyObjError
+                        ( PyExc_TypeError, "expected sequence argument" ) );
+
+       if( PySequence_Check( popo ) == 0 ) {
+               puts( "error in BezTriple_setPoints - expected sequence" );
+               Py_INCREF( Py_None );
+               return Py_None;
+       }
+
+       {
+               /*
+                  some debug stuff 
+                  this will become an overloaded args check
+                */
+               int size = PySequence_Size( popo );
+               printf( "\n dbg: sequence size is %d\n", size );
+       }
+
+       for( i = 0; i < 2; i++ ) {
+               PyObject *o = PySequence_GetItem( popo, i );
+               if( !o )
+                       printf( "\n bad o. o no!\n" );
+
+               /*   bezt->vec[1][i] = PyFloat_AsDouble (PyTuple_GetItem (popo, i)); */
+               bezt->vec[1][i] = PyFloat_AsDouble( o );
+               bezt->vec[0][i] = bezt->vec[1][i] - 1;
+               bezt->vec[2][i] = bezt->vec[1][i] + 1;
+       }
+
+       /* experimental fussing with handles - ipo.c: calchandles_ipocurve */
+       if( bezt->vec[0][0] > bezt->vec[1][0] )
+               bezt->vec[0][0] = bezt->vec[1][0];
+
+       if( bezt->vec[2][0] < bezt->vec[1][0] )
+               bezt->vec[2][0] = bezt->vec[1][0];
+
+       Py_INCREF( Py_None );
+       return Py_None;
 }
 
 
 /*****************************************************************************/
-/* Function:    BezTripleGetAttr                                                   */
-/* Description: This is a callback function for the C_BezTriple type. It is        */
-/*              the function that accesses C_BezTriple "member variables" and      */
-/*              methods.                                                     */
+/* Function:    BezTripleGetAttr                                            */
+/* Description: This is a callback function for the C_BezTriple type. It   */
+/*              taccesses C_BezTriple "member variables" and    methods.    */
 /*****************************************************************************/
-static PyObject *
-BezTripleGetAttr (C_BezTriple * self, char *name)
+static PyObject *BezTripleGetAttr( C_BezTriple * self, char *name )
 {
-  if (strcmp (name, "pt") == 0)
-    return BezTriple_getPoints (self);
-  else if (strcmp (name, "vec") == 0)
-    return BezTriple_getTriple (self);
+       if( strcmp( name, "pt" ) == 0 )
+               return BezTriple_getPoints( self );
+       else if( strcmp( name, "vec" ) == 0 )
+               return BezTriple_getTriple( self );
 
-  /* look for default methods */
-  return Py_FindMethod (C_BezTriple_methods, (PyObject *) self, name);
+       /* look for default methods */
+       return Py_FindMethod( C_BezTriple_methods, ( PyObject * ) self, name );
 }
 
 /*****************************************************************************/
-/* Function:    BezTripleSetAttr                                                */
-/* Description: This is a callback function for the C_BezTriple type. It is the */
-/*              function that sets BezTriple Data attributes (member variables).*/
+/* Function:    BezTripleSetAttr                                            */
+/* Description: This is a callback function for the C_BezTriple type. It */
+/*               sets BezTriple Data attributes (member variables).  */
 /*****************************************************************************/
-static int
-BezTripleSetAttr (C_BezTriple * self, char *name, PyObject * value)
+static int BezTripleSetAttr( C_BezTriple * self, char *name, PyObject * value )
 {
 #if 0
-  /*
-     this does not work at the moment:  Wed Apr  7  2004
-     when the necessary code to make pt act like a sequence is
-     available, it will be reenabled
-   */
+       /*
+          this does not work at the moment:  Wed Apr  7  2004
+          when the necessary code to make pt act like a sequence is
+          available, it will be reenabled
+        */
 
-  if (strcmp (name, "pt") == 0)
-    BezTriple_setPoints (self, value);
+       if( strcmp( name, "pt" ) == 0 )
+               BezTriple_setPoints( self, value );
 
-  return 0;                    /* normal exit */
+       return 0;               /* normal exit */
 #endif
 
-  return (EXPP_ReturnIntError (PyExc_AttributeError,
-                              "cannot set a read-only attribute"));
+       return ( EXPP_ReturnIntError( PyExc_AttributeError,
+                                     "cannot set a read-only attribute" ) );
 }
 
 /*****************************************************************************/
@@ -299,72 +288,70 @@ BezTripleSetAttr (C_BezTriple * self, char *name, PyObject * value)
 /* Description: This is a callback function for the C_BezTriple type. It     */
 /*              builds a meaninful string to represent  BezTriple objects.   */
 /*****************************************************************************/
-static PyObject *
-BezTripleRepr (C_BezTriple * self)
+static PyObject *BezTripleRepr( C_BezTriple * self )
 {
-  /*      float vec[3][3];
-     float alfa;
-     short s[3][2];
-     short h1, h2;
-     char f1, f2, f3, hide;
-   */
-  char str[1000];
-  sprintf (str,
-          "BezTriple %f %f %f %f %f %f %f %f %f %f\n %d %d %d %d %d %d %d %d %d %d %d %d\n",
-          self->beztriple->vec[0][0], self->beztriple->vec[0][1],
-          self->beztriple->vec[0][2], self->beztriple->vec[1][0],
-          self->beztriple->vec[1][1], self->beztriple->vec[1][2],
-          self->beztriple->vec[2][0], self->beztriple->vec[2][1],
-          self->beztriple->vec[2][2], self->beztriple->alfa,
-          self->beztriple->s[0][0], self->beztriple->s[0][1],
-          self->beztriple->s[1][0], self->beztriple->s[1][1],
-          self->beztriple->s[2][0], self->beztriple->s[1][1],
-          self->beztriple->h1, self->beztriple->h2, self->beztriple->f1,
-          self->beztriple->f2, self->beztriple->f3, self->beztriple->hide);
-  return PyString_FromString (str);
+       /*      float vec[3][3];
+          float alfa;
+          short s[3][2];
+          short h1, h2;
+          char f1, f2, f3, hide;
+        */
+       char str[1000];
+       sprintf( str,
+                "BezTriple %f %f %f %f %f %f %f %f %f %f\n %d %d %d %d %d %d %d %d %d %d %d %d\n",
+                self->beztriple->vec[0][0], self->beztriple->vec[0][1],
+                self->beztriple->vec[0][2], self->beztriple->vec[1][0],
+                self->beztriple->vec[1][1], self->beztriple->vec[1][2],
+                self->beztriple->vec[2][0], self->beztriple->vec[2][1],
+                self->beztriple->vec[2][2], self->beztriple->alfa,
+                self->beztriple->s[0][0], self->beztriple->s[0][1],
+                self->beztriple->s[1][0], self->beztriple->s[1][1],
+                self->beztriple->s[2][0], self->beztriple->s[1][1],
+                self->beztriple->h1, self->beztriple->h2, self->beztriple->f1,
+                self->beztriple->f2, self->beztriple->f3,
+                self->beztriple->hide );
+       return PyString_FromString( str );
 }
 
 /* Three Python BezTriple_Type helper functions needed by the Object module: */
 
 /*****************************************************************************/
-/* Function:    BezTriple_CreatePyObject                                           */
-/* Description: This function will create a new C_BezTriple from an existing       */
+/* Function:    BezTriple_CreatePyObject                                    */
+/* Description: This function will create a new C_BezTriple from an existing */
 /*              Blender ipo structure.                                       */
 /*****************************************************************************/
-PyObject *
-BezTriple_CreatePyObject (BezTriple * bzt)
+PyObject *BezTriple_CreatePyObject( BezTriple * bzt )
 {
-  C_BezTriple *pybeztriple;
+       C_BezTriple *pybeztriple;
 
-  pybeztriple = (C_BezTriple *) PyObject_NEW (C_BezTriple, &BezTriple_Type);
+       pybeztriple =
+               ( C_BezTriple * ) PyObject_NEW( C_BezTriple, &BezTriple_Type );
 
-  if (!pybeztriple)
-    return EXPP_ReturnPyObjError (PyExc_MemoryError,
-                                 "couldn't create C_BezTriple object");
+       if( !pybeztriple )
+               return EXPP_ReturnPyObjError( PyExc_MemoryError,
+                                             "couldn't create C_BezTriple object" );
 
-  pybeztriple->beztriple = bzt;
+       pybeztriple->beztriple = bzt;
 
-  return (PyObject *) pybeztriple;
+       return ( PyObject * ) pybeztriple;
 }
 
 /*****************************************************************************/
-/* Function:    BezTriple_CheckPyObject                                            */
+/* Function:    BezTriple_CheckPyObject                                     */
 /* Description: This function returns true when the given PyObject is of the */
-/*              type BezTriple. Otherwise it will return false.                    */
+/*              type BezTriple. Otherwise it will return false.             */
 /*****************************************************************************/
-int
-BezTriple_CheckPyObject (PyObject * pyobj)
+int BezTriple_CheckPyObject( PyObject * pyobj )
 {
-  return (pyobj->ob_type == &BezTriple_Type);
+       return ( pyobj->ob_type == &BezTriple_Type );
 }
 
 /*****************************************************************************/
-/* Function:    BezTriple_FromPyObject                                             */
-/* Description: This function returns the Blender beztriple from the given         */
+/* Function:    BezTriple_FromPyObject                                      */
+/* Description: This function returns the Blender beztriple from the given   */
 /*              PyObject.                                                    */
 /*****************************************************************************/
-BezTriple *
-BezTriple_FromPyObject (PyObject * pyobj)
+BezTriple *BezTriple_FromPyObject( PyObject * pyobj )
 {
-  return ((C_BezTriple *) pyobj)->beztriple;
+       return ( ( C_BezTriple * ) pyobj )->beztriple;
 }
index 992c306199ae07c589b2edd6e8effb3635088dc2..e4795b4ff07540143a9c362d63e31a2f12304720 100644 (file)
@@ -1,4 +1,5 @@
 /* 
+ * $Id$
  *
  * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
  *
 #include <DNA_curve_types.h>
 
 /*****************************************************************************/
-/* Python C_BezTriple structure definition:                                     */
+/* Python C_BezTriple structure definition:              */
 /*****************************************************************************/
 
-typedef struct
-{
-  PyObject_HEAD  /* required python macro */
-  BezTriple *beztriple;
-}
-C_BezTriple;
+typedef struct {
+       PyObject_HEAD           /* required python macro */
+       BezTriple * beztriple;
+} C_BezTriple;
 
 
-#endif /* EXPP_BEZTRIPLE_H */
+#endif                         /* EXPP_BEZTRIPLE_H */
index 0cb848fc76b447d7db58097d95d372ef2ce0e911..9e0c513f8b17c080fa978057f39302331467f645 100644 (file)
 
 /* for open, close in Blender_Load */
 #include <fcntl.h>
-#ifndef WIN32 
+#ifndef WIN32
 #include <unistd.h>
 #else
 #include "BLI_winstuff.h"
 #include <io.h>
 #endif
 
-#include <BDR_editobject.h> /* exit_editmode() */
+#include <BDR_editobject.h>    /* exit_editmode() */
 #include <BIF_usiblender.h>
 #include <BLI_blenlib.h>
 #include <BLO_writefile.h>
 #include <DNA_ID.h>
 #include <DNA_object_types.h>
 #include <DNA_scene_types.h>
-#include <DNA_screen_types.h> /* for SPACE_VIEW3D */
-#include <DNA_space_types.h> /* for SPACE_VIEW3D */
+#include <DNA_screen_types.h>  /* for SPACE_VIEW3D */
+#include <DNA_space_types.h>   /* for SPACE_VIEW3D */
 #include <DNA_userdef_types.h>
 #include <BKE_ipo.h>
 #include <blendef.h>
 
 #include "gen_utils.h"
 #include "modules.h"
-#include "../BPY_extern.h" /* for bpy_gethome() */
+#include "../BPY_extern.h"     /* for bpy_gethome() */
 
 /* From Window.h, used here by Blender_Redraw */
-PyObject *M_Window_Redraw(PyObject *self, PyObject *args);
+PyObject *M_Window_Redraw( PyObject * self, PyObject * args );
 
 /**********************************************************/
 /* Python API function prototypes for the Blender module.      */
 /**********************************************************/
-static PyObject *Blender_Set (PyObject *self, PyObject *args);
-static PyObject *Blender_Get (PyObject *self, PyObject *args);
-static PyObject *Blender_Redraw(PyObject *self, PyObject *args);
-static PyObject *Blender_ReleaseGlobalDict(PyObject *self, PyObject *args);
-static PyObject *Blender_Quit(PyObject *self);
-static PyObject *Blender_Load(PyObject *self, PyObject *args);
-static PyObject *Blender_Save(PyObject *self, PyObject *args);
+static PyObject *Blender_Set( PyObject * self, PyObject * args );
+static PyObject *Blender_Get( PyObject * self, PyObject * args );
+static PyObject *Blender_Redraw( PyObject * self, PyObject * args );
+static PyObject *Blender_ReleaseGlobalDict( PyObject * self, PyObject * args );
+static PyObject *Blender_Quit( PyObject * self );
+static PyObject *Blender_Load( PyObject * self, PyObject * args );
+static PyObject *Blender_Save( PyObject * self, PyObject * args );
 
 /*****************************************************************************/
-/* The following string definitions are used for documentation strings.                         */
-/* In Python these will be written to the console when doing a                                                  */
-/* Blender.__doc__                                                                                                                                                                                                                                      */
+/* The following string definitions are used for documentation strings.         */
+/* In Python these will be written to the console when doing a          */
+/* Blender.__doc__      */
 /*****************************************************************************/
 static char Blender_Set_doc[] =
-"(request, data) - Update settings in Blender\n\
+       "(request, data) - Update settings in Blender\n\
 \n\
 (request) A string identifying the setting to change\n\
        'curframe'      - Sets the current frame using the number in data";
 
-static char Blender_Get_doc[] =
-"(request) - Retrieve settings from Blender\n\
+static char Blender_Get_doc[] = "(request) - Retrieve settings from Blender\n\
 \n\
 (request) A string indentifying the data to be returned\n\
        'curframe'      - Returns the current animation frame\n\
@@ -105,13 +104,12 @@ static char Blender_Get_doc[] =
 static char Blender_Redraw_doc[] = "() - Redraw all 3D windows";
 
 static char Blender_ReleaseGlobalDict_doc[] =
-"Deprecated, please use the Blender.Registry module solution instead.";
+       "Deprecated, please use the Blender.Registry module solution instead.";
 
 static char Blender_Quit_doc[] =
-"() - Quit Blender.  The current data is saved as 'quit.blend' before leaving.";
+       "() - Quit Blender.  The current data is saved as 'quit.blend' before leaving.";
 
-static char Blender_Load_doc[] =
-"(filename) - Load the given file.\n\
+static char Blender_Load_doc[] = "(filename) - Load the given file.\n\
 Supported formats:\n\
 Blender, DXF, Inventor 1.0 ASCII, VRML 1.0 asc, STL, Videoscape, radiogour.\n\
 \n\
@@ -125,7 +123,7 @@ Notes:\n\
 only one running at the moment.";
 
 static char Blender_Save_doc[] =
-"(filename) - Save data to a file based on the filename's extension.\n\
+       "(filename) - Save data to a file based on the filename's extension.\n\
 Supported are: Blender's .blend and the builtin exporters:\n\
 VRML 1.0 (.wrl), Videoscape (.obj), DXF (.dxf) and STL (.stl)\n\
 (filename) - A filename with one of the supported extensions.\n\
@@ -135,193 +133,187 @@ Note 2: only .blend raises an error if file wasn't saved.\n\
 \twhen writing to one of the other formats.";
 
 /*****************************************************************************/
-/* Python method structure definition.                                                                                                                                                  */
+/* Python method structure definition.          */
 /*****************************************************************************/
 static struct PyMethodDef Blender_methods[] = {
-       {"Set",          Blender_Set, METH_VARARGS, Blender_Set_doc},
-       {"Get",          Blender_Get, METH_VARARGS, Blender_Get_doc},
+       {"Set", Blender_Set, METH_VARARGS, Blender_Set_doc},
+       {"Get", Blender_Get, METH_VARARGS, Blender_Get_doc},
        {"Redraw", Blender_Redraw, METH_VARARGS, Blender_Redraw_doc},
-       {"Quit",         (PyCFunction)Blender_Quit, METH_NOARGS, Blender_Quit_doc},
+       {"Quit", ( PyCFunction ) Blender_Quit, METH_NOARGS, Blender_Quit_doc},
        {"Load", Blender_Load, METH_VARARGS, Blender_Load_doc},
        {"Save", Blender_Save, METH_VARARGS, Blender_Save_doc},
        {"ReleaseGlobalDict", &Blender_ReleaseGlobalDict,
-               METH_VARARGS, Blender_ReleaseGlobalDict_doc},
-       {NULL, NULL, 0, NULL}
+        METH_VARARGS, Blender_ReleaseGlobalDict_doc},
+       {NULL, NULL, 0, NULL}
 };
 
 /*****************************************************************************/
-/* Global variables                                                                                                                                                                                                                                     */
+/* Global variables     */
 /*****************************************************************************/
 PyObject *g_blenderdict;
 
 /*****************************************************************************/
-/* Function:                                                   Blender_Set                                                                                                                                                              */
-/* Python equivalent:                  Blender.Set                                                                                                                                                              */
+/* Function:   Blender_Set              */
+/* Python equivalent:  Blender.Set              */
 /*****************************************************************************/
-static PyObject *Blender_Set (PyObject *self, PyObject *args)
+static PyObject *Blender_Set( PyObject * self, PyObject * args )
 {
-       char                    * name;
-       PyObject        * arg;
-       int                                     framenum;
-                       
-       if (!PyArg_ParseTuple(args, "sO", &name, &arg))
-       {
+       char *name;
+       PyObject *arg;
+       int framenum;
+
+       if( !PyArg_ParseTuple( args, "sO", &name, &arg ) ) {
                /* TODO: Do we need to generate a nice error message here? */
-               return (NULL);
+               return ( NULL );
        }
 
-       if (StringEqual (name, "curframe"))
-       {
-               if (!PyArg_Parse(arg, "i", &framenum))
-               {
-               /* TODO: Do we need to generate a nice error message here? */
-                       return (NULL);
+       if( StringEqual( name, "curframe" ) ) {
+               if( !PyArg_Parse( arg, "i", &framenum ) ) {
+                       /* TODO: Do we need to generate a nice error message here? */
+                       return ( NULL );
                }
 
                G.scene->r.cfra = framenum;
 
-               update_for_newframe();
+               update_for_newframe(  );
+       } else {
+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                               "bad request identifier" ) );
        }
-       else
-       {
-               return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                                                                                                                                       "bad request identifier"));
-       }
-       return ( EXPP_incr_ret (Py_None) );
+       return ( EXPP_incr_ret( Py_None ) );
 }
 
 /*****************************************************************************/
-/* Function:                                                   Blender_Get                                                                                                                                                              */
-/* Python equivalent:                  Blender.Get                                                                                                                                                              */
+/* Function:           Blender_Get      */
+/* Python equivalent:  Blender.Get              */
 /*****************************************************************************/
-static PyObject *Blender_Get (PyObject *self, PyObject *args)
+static PyObject *Blender_Get( PyObject * self, PyObject * args )
 {
-       PyObject        * object;
-       PyObject        * dict;
-       char                    * str;
-                               
-       if (!PyArg_ParseTuple (args, "O", &object))
-       {
-       /* TODO: Do we need to generate a nice error message here? */
-               return (NULL);
+       PyObject *object;
+       PyObject *dict;
+       char *str;
+
+       if( !PyArg_ParseTuple( args, "O", &object ) ) {
+               /* TODO: Do we need to generate a nice error message here? */
+               return ( NULL );
        }
 
-       if (PyString_Check (object))
-       {
-               str = PyString_AsString (object);
+       if( PyString_Check( object ) ) {
+               str = PyString_AsString( object );
 
-               if (StringEqual (str, "curframe"))
-               {
-                       return ( PyInt_FromLong (G.scene->r.cfra) );
+               if( StringEqual( str, "curframe" ) ) {
+                       return ( PyInt_FromLong( G.scene->r.cfra ) );
                }
-               if (StringEqual (str, "curtime"))
-               {
-                       return ( PyFloat_FromDouble (frame_to_float (G.scene->r.cfra) ) );
+               if( StringEqual( str, "curtime" ) ) {
+                       return ( PyFloat_FromDouble
+                                ( frame_to_float( G.scene->r.cfra ) ) );
                }
-               if (StringEqual (str, "staframe"))
-               {
-                       return ( PyInt_FromLong (G.scene->r.sfra) );
+               if( StringEqual( str, "staframe" ) ) {
+                       return ( PyInt_FromLong( G.scene->r.sfra ) );
                }
-               if (StringEqual (str, "endframe"))
-               {
-                       return ( PyInt_FromLong (G.scene->r.efra) );
+               if( StringEqual( str, "endframe" ) ) {
+                       return ( PyInt_FromLong( G.scene->r.efra ) );
                }
-               if (StringEqual (str, "filename"))
-               {
-                       return ( PyString_FromString (G.sce) );
+               if( StringEqual( str, "filename" ) ) {
+                       return ( PyString_FromString( G.sce ) );
                }
-               if (StringEqual (str, "datadir"))
-               {
+               if( StringEqual( str, "datadir" ) ) {
                        char datadir[FILE_MAXDIR];
-                       BLI_make_file_string("/", datadir, bpy_gethome(), "bpydata/");
-                       if (BLI_exists(datadir)) return PyString_FromString(datadir);
-                       else return EXPP_incr_ret (Py_None);
+                       BLI_make_file_string( "/", datadir, bpy_gethome(  ),
+                                             "bpydata/" );
+                       if( BLI_exists( datadir ) )
+                               return PyString_FromString( datadir );
+                       else
+                               return EXPP_incr_ret( Py_None );
                }
-               if (StringEqual (str, "scriptsdir"))
-               {
+               if( StringEqual( str, "scriptsdir" ) ) {
                        char scriptsdir[FILE_MAXDIR];
-                       BLI_make_file_string("/", scriptsdir, bpy_gethome(), "scripts/");
-                       if (BLI_exists(scriptsdir)) return PyString_FromString(scriptsdir);
-                       else return EXPP_incr_ret (Py_None);
+                       BLI_make_file_string( "/", scriptsdir, bpy_gethome(  ),
+                                             "scripts/" );
+                       if( BLI_exists( scriptsdir ) )
+                               return PyString_FromString( scriptsdir );
+                       else
+                               return EXPP_incr_ret( Py_None );
                }
                /* According to the old file (opy_blender.c), the following if
-                        statement is a quick hack and needs some clean up. */
-               if (StringEqual (str, "vrmloptions"))
-               {
-                       dict = PyDict_New ();
-
-                       PyDict_SetItemString (dict, "twoside",
-                                                                       PyInt_FromLong (U.vrmlflag & USER_VRML_TWOSIDED));
-
-                       PyDict_SetItemString (dict, "layers",
-                                                                       PyInt_FromLong (U.vrmlflag & USER_VRML_LAYERS));
-
-                       PyDict_SetItemString (dict, "autoscale",
-                                                                       PyInt_FromLong (U.vrmlflag & USER_VRML_AUTOSCALE));
-
-                       return (dict);
-               } /* End 'quick hack' part. */
-               if (StringEqual (str, "version"))
-               {
-                       return ( PyInt_FromLong (G.version) );
+                  statement is a quick hack and needs some clean up. */
+               if( StringEqual( str, "vrmloptions" ) ) {
+                       dict = PyDict_New(  );
+
+                       PyDict_SetItemString( dict, "twoside",
+                                             PyInt_FromLong( U.
+                                                             vrmlflag &
+                                                             USER_VRML_TWOSIDED ) );
+
+                       PyDict_SetItemString( dict, "layers",
+                                             PyInt_FromLong( U.
+                                                             vrmlflag &
+                                                             USER_VRML_LAYERS ) );
+
+                       PyDict_SetItemString( dict, "autoscale",
+                                             PyInt_FromLong( U.
+                                                             vrmlflag &
+                                                             USER_VRML_AUTOSCALE ) );
+
+                       return ( dict );
+               }               /* End 'quick hack' part. */
+               if( StringEqual( str, "version" ) ) {
+                       return ( PyInt_FromLong( G.version ) );
                }
                /* TODO: Do we want to display a usefull message here that the
-                                                                requested data is unknown?
-               else
-               {
-                       return (EXPP_ReturnPyObjError (..., "message") );
-               }
-               */
-       }
-       else
-       {
-               return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                                                                                                                               "expected string argument"));
+                  requested data is unknown?
+                  else
+                  {
+                  return (EXPP_ReturnPyObjError (..., "message") );
+                  }
+                */
+       } else {
+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                               "expected string argument" ) );
        }
 
-       return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                                                                                                               "bad request identifier"));
+       return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                       "bad request identifier" ) );
 }
 
 /*****************************************************************************/
-/* Function:                                                   Blender_Redraw                                                                                                                                           */
-/* Python equivalent:                  Blender.Redraw                                                                                                                                           */
+/* Function:           Blender_Redraw           */
+/* Python equivalent:  Blender.Redraw                   */
 /*****************************************************************************/
-static PyObject *Blender_Redraw(PyObject *self, PyObject *args)
+static PyObject *Blender_Redraw( PyObject * self, PyObject * args )
 {
        int wintype = SPACE_VIEW3D;
 
-       if (!PyArg_ParseTuple (args, "|i", &wintype))
-       {
-               return EXPP_ReturnPyObjError (PyExc_TypeError,
-                                                                                               "expected int argument (or nothing)");
+       if( !PyArg_ParseTuple( args, "|i", &wintype ) ) {
+               return EXPP_ReturnPyObjError( PyExc_TypeError,
+                                             "expected int argument (or nothing)" );
        }
 
-       return M_Window_Redraw(self, Py_BuildValue("(i)", wintype));
+       return M_Window_Redraw( self, Py_BuildValue( "(i)", wintype ) );
 }
 
 /*****************************************************************************/
-/* Function:                                                   Blender_ReleaseGlobalDict                                                                                                        */
-/* Python equivalent:                  Blender.ReleaseGlobalDict                                                                                                        */
-/* Description:                                                Deprecated function.                                                                                                                     */
+/* Function:   Blender_ReleaseGlobalDict                */
+/* Python equivalent:  Blender.ReleaseGlobalDict                        */
+/* Description:                Deprecated function.                     */
 /*****************************************************************************/
-static PyObject *Blender_ReleaseGlobalDict(PyObject *self, PyObject *args)
+static PyObject *Blender_ReleaseGlobalDict( PyObject * self, PyObject * args )
 {
-       Py_INCREF(Py_None);
+       Py_INCREF( Py_None );
        return Py_None;
 }
 
 /*****************************************************************************/
-/* Function:                                                   Blender_Quit                                                                                                                                                     */
-/* Python equivalent:                  Blender.Quit                                                                                                                                                     */
+/* Function:           Blender_Quit             */
+/* Python equivalent:  Blender.Quit                     */
 /*****************************************************************************/
-static PyObject *Blender_Quit(PyObject *self)
+static PyObject *Blender_Quit( PyObject * self )
 {
-       BIF_write_autosave(); /* save the current data first */
+       BIF_write_autosave(  ); /* save the current data first */
 
-       exit_usiblender(); /* renames last autosave to quit.blend */
+       exit_usiblender(  );    /* renames last autosave to quit.blend */
 
-       Py_INCREF(Py_None);
+       Py_INCREF( Py_None );
        return Py_None;
 }
 
@@ -330,7 +322,7 @@ static PyObject *Blender_Quit(PyObject *self)
  * loads Blender's .blend, DXF, radiogour(?), STL, Videoscape,
  * Inventor 1.0 ASCII, VRML 1.0 asc.
  */
-static PyObject *Blender_Load(PyObject *self, PyObject *args)
+static PyObject *Blender_Load( PyObject * self, PyObject * args )
 {
        char *fname = NULL;
        int keep_oldfname = 0;
@@ -338,69 +330,73 @@ static PyObject *Blender_Load(PyObject *self, PyObject *args)
        char str[32], name[FILE_MAXDIR];
        int file, is_blend_file = 0;
 
-       if (!PyArg_ParseTuple(args, "|si", &fname, &keep_oldfname))
-               return EXPP_ReturnPyObjError(PyExc_TypeError,
-                       "expected filename and optional int or nothing as arguments");
+       if( !PyArg_ParseTuple( args, "|si", &fname, &keep_oldfname ) )
+               return EXPP_ReturnPyObjError( PyExc_TypeError,
+                                             "expected filename and optional int or nothing as arguments" );
 
-       if (fname) {
-               if (strlen(fname) > FILE_MAXDIR) /* G.main->name's max length */
-                       return EXPP_ReturnPyObjError(PyExc_AttributeError,
-                               "filename too long!");
-               else if (!BLI_exists(fname))
-                       return EXPP_ReturnPyObjError(PyExc_AttributeError,
-                               "requested file doesn't exist!");
+       if( fname ) {
+               if( strlen( fname ) > FILE_MAXDIR )     /* G.main->name's max length */
+                       return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                                     "filename too long!" );
+               else if( !BLI_exists( fname ) )
+                       return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                                     "requested file doesn't exist!" );
 
-               if (keep_oldfname) BLI_strncpy(name, G.sce, FILE_MAXDIR);
+               if( keep_oldfname )
+                       BLI_strncpy( name, G.sce, FILE_MAXDIR );
        }
 
        /* We won't let a new .blend file be loaded if there are still other
         * scripts running, since loading a new file will close and remove them. */
 
-       if (G.main->script.first != G.main->script.last)
-               return EXPP_ReturnPyObjError(PyExc_RuntimeError,
-                       "there are other scripts running at the Scripts win, close them first!");
+       if( G.main->script.first != G.main->script.last )
+               return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                                             "there are other scripts running at the Scripts win, close them first!" );
 
-       if (fname) {
-               file = open(fname, O_BINARY|O_RDONLY);
+       if( fname ) {
+               file = open( fname, O_BINARY | O_RDONLY );
 
-               if (file <= 0) {
-                       return EXPP_ReturnPyObjError(PyExc_RuntimeError,
-                               "cannot open file!");
-               }
-               else {
-                       read(file, str, 31);
-                       close(file);
+               if( file <= 0 ) {
+                       return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                                                     "cannot open file!" );
+               } else {
+                       read( file, str, 31 );
+                       close( file );
 
-                       if (strncmp(str, "BLEN", 4) == 0) is_blend_file = 1;
+                       if( strncmp( str, "BLEN", 4 ) == 0 )
+                               is_blend_file = 1;
                }
-       }
-       else is_blend_file = 1; /* no arg given means default: .B.blend */
+       } else
+               is_blend_file = 1;      /* no arg given means default: .B.blend */
 
-       if (is_blend_file) {
-               int during_slink = during_scriptlink();
+       if( is_blend_file ) {
+               int during_slink = during_scriptlink(  );
 
                /* when loading a .blend file from a scriptlink, the scriptlink pointer
                 * in BPY_do_pyscript becomes invalid during a loop.  Inform it here.
                 * Also do not allow a nested scriptlink (called from inside another)
                 * to load .blend files, to avoid nasty problems. */
-               if (during_slink >= 1) {
-                       if (during_slink == 1)
-                               disable_where_scriptlink(-1);
+               if( during_slink >= 1 ) {
+                       if( during_slink == 1 )
+                               disable_where_scriptlink( -1 );
                        else {
-                               return EXPP_ReturnPyObjError(PyExc_EnvironmentError,
-                                       "Blender.Load: cannot load .blend files from a nested scriptlink.");
+                               return EXPP_ReturnPyObjError
+                                       ( PyExc_EnvironmentError,
+                                         "Blender.Load: cannot load .blend files from a nested scriptlink." );
                        }
                }
 
                /* trick: mark the script so that its script struct won't be freed after
                 * the script is executed (to avoid a double free warning on exit): */
                script = G.main->script.first;
-               if (script) script->flags |= SCRIPT_GUI;
+               if( script )
+                       script->flags |= SCRIPT_GUI;
 
-               BIF_write_autosave(); /* for safety let's preserve the current data */
+               BIF_write_autosave(  ); /* for safety let's preserve the current data */
        }
 
-       if (G.obedit) exit_editmode(1);
+       if( G.obedit )
+               exit_editmode( 1 );
 
        /* for safety, any filename with .B.blend is considered the default one.
         * It doesn't seem necessary to compare file attributes (like st_ino and
@@ -409,136 +405,137 @@ static PyObject *Blender_Load(PyObject *self, PyObject *args)
         * default one for sure.  Taking any .B.blend file as the default is good
         * enough here.  Note: the default file requires extra clean-up done by
         * BIF_read_homefile: freeing the user theme data. */
-       if (!fname || (strstr(fname, ".B.blend") && is_blend_file))
-               BIF_read_homefile();
+       if( !fname || ( strstr( fname, ".B.blend" ) && is_blend_file ) )
+               BIF_read_homefile(  );
        else
-               BIF_read_file(fname);
+               BIF_read_file( fname );
 
-       if (fname && keep_oldfname) {
-               /*BLI_strncpy(G.main->name, name, FILE_MAXDIR);*/
-               BLI_strncpy(G.sce, name, FILE_MAXDIR);
+       if( fname && keep_oldfname ) {
+               /*BLI_strncpy(G.main->name, name, FILE_MAXDIR); */
+               BLI_strncpy( G.sce, name, FILE_MAXDIR );
        }
 
-       Py_INCREF(Py_None);
+       Py_INCREF( Py_None );
        return Py_None;
 }
 
-static PyObject *Blender_Save(PyObject *self, PyObject *args)
+static PyObject *Blender_Save( PyObject * self, PyObject * args )
 {
        char *fname = NULL;
        int overwrite = 0, len = 0;
        char *error = NULL;
        Library *li;
 
-       if (!PyArg_ParseTuple(args, "s|i", &fname, &overwrite))
-               return EXPP_ReturnPyObjError(PyExc_TypeError,
-                       "expected filename and optional int (overwrite flag) as arguments");
+       if( !PyArg_ParseTuple( args, "s|i", &fname, &overwrite ) )
+               return EXPP_ReturnPyObjError( PyExc_TypeError,
+                                             "expected filename and optional int (overwrite flag) as arguments" );
 
-       for (li = G.main->library.first; li; li = li->id.next) {
-               if (BLI_streq(li->name, fname)) {
-                       return EXPP_ReturnPyObjError(PyExc_AttributeError,
-                               "cannot overwrite used library");
+       for( li = G.main->library.first; li; li = li->id.next ) {
+               if( BLI_streq( li->name, fname ) ) {
+                       return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                                     "cannot overwrite used library" );
                }
        }
-       
+
        /* for safety, any filename with .B.blend is considered the default one
         * and not accepted here. */
-       if (strstr(fname, ".B.blend"))
-               return EXPP_ReturnPyObjError(PyExc_AttributeError,
-                       "filename can't contain the substring \".B.blend\" in it.");
-
-       len = strlen(fname);
-
-       if (len > FILE_MAXFILE)
-               return EXPP_ReturnPyObjError(PyExc_AttributeError,
-                       "filename is too long!");
-       else if (BLI_exists(fname) && !overwrite)
-               return EXPP_ReturnPyObjError(PyExc_AttributeError,
-                       "file already exists and overwrite flag was not given.");
-
-       disable_where_script(1); /* to avoid error popups in the write_* functions */
-
-       if (BLI_testextensie(fname, ".blend")) {
-               if (G.fileflags & G_AUTOPACK) packAll();
-               if (!BLO_write_file(fname, G.fileflags, &error)) {
-                       disable_where_script(0);
-                       return EXPP_ReturnPyObjError(PyExc_SystemError, error);
+       if( strstr( fname, ".B.blend" ) )
+               return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                             "filename can't contain the substring \".B.blend\" in it." );
+
+       len = strlen( fname );
+
+       if( len > FILE_MAXFILE )
+               return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                             "filename is too long!" );
+       else if( BLI_exists( fname ) && !overwrite )
+               return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                             "file already exists and overwrite flag was not given." );
+
+       disable_where_script( 1 );      /* to avoid error popups in the write_* functions */
+
+       if( BLI_testextensie( fname, ".blend" ) ) {
+               if( G.fileflags & G_AUTOPACK )
+                       packAll(  );
+               if( !BLO_write_file( fname, G.fileflags, &error ) ) {
+                       disable_where_script( 0 );
+                       return EXPP_ReturnPyObjError( PyExc_SystemError,
+                                                     error );
                }
-       }
-       else if (BLI_testextensie(fname, ".dxf"))
-               write_dxf(fname);
-       else if (BLI_testextensie(fname, ".stl"))
-               write_stl(fname);
-       else if (BLI_testextensie(fname, ".wrl"))
-               write_vrml(fname);
-       else if (BLI_testextensie(fname, ".obj"))
-               write_videoscape(fname);
+       } else if( BLI_testextensie( fname, ".dxf" ) )
+               write_dxf( fname );
+       else if( BLI_testextensie( fname, ".stl" ) )
+               write_stl( fname );
+       else if( BLI_testextensie( fname, ".wrl" ) )
+               write_vrml( fname );
+       else if( BLI_testextensie( fname, ".obj" ) )
+               write_videoscape( fname );
        else {
-               disable_where_script(0);
-               return EXPP_ReturnPyObjError(PyExc_AttributeError,
-                       "unknown file extension.");
+               disable_where_script( 0 );
+               return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                             "unknown file extension." );
        }
 
-       disable_where_script(0);
+       disable_where_script( 0 );
 
-       Py_INCREF(Py_None);
+       Py_INCREF( Py_None );
        return Py_None;
 }
 
 /*****************************************************************************/
-/* Function:                                                   initBlender                                                                                                                                                              */
+/* Function:           initBlender              */
 /*****************************************************************************/
-void M_Blender_Init (void)
+void M_Blender_Init( void )
 {
-       PyObject                                * module;
-       PyObject                                * dict;
+       PyObject *module;
+       PyObject *dict;
 
        g_blenderdict = NULL;
 
        /* TODO: create a docstring for the Blender module */
-       module = Py_InitModule3("Blender", Blender_methods, NULL);
+       module = Py_InitModule3( "Blender", Blender_methods, NULL );
 
-       types_InitAll(); /* set all our pytypes to &PyType_Type*/
+       types_InitAll(  );      /* set all our pytypes to &PyType_Type */
 
-       dict = PyModule_GetDict (module);
+       dict = PyModule_GetDict( module );
        g_blenderdict = dict;
 
-       Py_INCREF(Py_False);
-       PyDict_SetItemString(dict, "bylink", Py_False);
-       Py_INCREF(Py_None);
-       PyDict_SetItemString(dict, "link", Py_None);
-       PyDict_SetItemString(dict, "event", PyString_FromString(""));
-
-       PyDict_SetItemString (dict, "Types",            Types_Init());
-       PyDict_SetItemString (dict, "sys",                      sys_Init());
-       PyDict_SetItemString (dict, "Registry", Registry_Init());
-       PyDict_SetItemString (dict, "Scene",            Scene_Init());
-       PyDict_SetItemString (dict, "Object",           Object_Init());
-       PyDict_SetItemString (dict, "Material", Material_Init());
-       PyDict_SetItemString (dict, "Camera",           Camera_Init());
-       PyDict_SetItemString (dict, "Lamp",                     Lamp_Init());
-       PyDict_SetItemString (dict, "Lattice",  Lattice_Init());
-       PyDict_SetItemString (dict, "Curve",            Curve_Init());
-       PyDict_SetItemString (dict, "Armature", Armature_Init());
-       PyDict_SetItemString (dict, "Ipo",                      Ipo_Init());
-       PyDict_SetItemString (dict, "IpoCurve", IpoCurve_Init());
-       PyDict_SetItemString (dict, "Metaball", Metaball_Init());
-       PyDict_SetItemString (dict, "Image",            Image_Init());
-       PyDict_SetItemString (dict, "Window",           Window_Init());
-       PyDict_SetItemString (dict, "Draw",                     Draw_Init());
-       PyDict_SetItemString (dict, "BGL",                      BGL_Init());
-       PyDict_SetItemString (dict, "Effect",           Effect_Init());
-       PyDict_SetItemString (dict, "Text",                     Text_Init());
-       PyDict_SetItemString (dict, "World",            World_Init());
-       PyDict_SetItemString (dict, "Texture",  Texture_Init());
-       PyDict_SetItemString (dict, "NMesh",            NMesh_Init());
-       PyDict_SetItemString (dict, "Noise",            Noise_Init());
-       PyDict_SetItemString (dict, "Mathutils",Mathutils_Init());
-       PyDict_SetItemString (dict, "Library",  Library_Init());
-       PyDict_SetItemString (dict, "Sound",    Sound_Init());
-
-       PyDict_SetItemString (dict, "CurNurb",  CurNurb_Init());
-
-       PyModule_AddIntConstant(module, "TRUE",  1);
-       PyModule_AddIntConstant(module, "FALSE",  0);
+       Py_INCREF( Py_False );
+       PyDict_SetItemString( dict, "bylink", Py_False );
+       Py_INCREF( Py_None );
+       PyDict_SetItemString( dict, "link", Py_None );
+       PyDict_SetItemString( dict, "event", PyString_FromString( "" ) );
+
+       PyDict_SetItemString( dict, "Types", Types_Init(  ) );
+       PyDict_SetItemString( dict, "sys", sys_Init(  ) );
+       PyDict_SetItemString( dict, "Registry", Registry_Init(  ) );
+       PyDict_SetItemString( dict, "Scene", Scene_Init(  ) );
+       PyDict_SetItemString( dict, "Object", Object_Init(  ) );
+       PyDict_SetItemString( dict, "Material", Material_Init(  ) );
+       PyDict_SetItemString( dict, "Camera", Camera_Init(  ) );
+       PyDict_SetItemString( dict, "Lamp", Lamp_Init(  ) );
+       PyDict_SetItemString( dict, "Lattice", Lattice_Init(  ) );
+       PyDict_SetItemString( dict, "Curve", Curve_Init(  ) );
+       PyDict_SetItemString( dict, "Armature", Armature_Init(  ) );
+       PyDict_SetItemString( dict, "Ipo", Ipo_Init(  ) );
+       PyDict_SetItemString( dict, "IpoCurve", IpoCurve_Init(  ) );
+       PyDict_SetItemString( dict, "Metaball", Metaball_Init(  ) );
+       PyDict_SetItemString( dict, "Image", Image_Init(  ) );
+       PyDict_SetItemString( dict, "Window", Window_Init(  ) );
+       PyDict_SetItemString( dict, "Draw", Draw_Init(  ) );
+       PyDict_SetItemString( dict, "BGL", BGL_Init(  ) );
+       PyDict_SetItemString( dict, "Effect", Effect_Init(  ) );
+       PyDict_SetItemString( dict, "Text", Text_Init(  ) );
+       PyDict_SetItemString( dict, "World", World_Init(  ) );
+       PyDict_SetItemString( dict, "Texture", Texture_Init(  ) );
+       PyDict_SetItemString( dict, "NMesh", NMesh_Init(  ) );
+       PyDict_SetItemString( dict, "Noise", Noise_Init(  ) );
+       PyDict_SetItemString( dict, "Mathutils", Mathutils_Init(  ) );
+       PyDict_SetItemString( dict, "Library", Library_Init(  ) );
+       PyDict_SetItemString( dict, "Sound", Sound_Init(  ) );
+
+       PyDict_SetItemString( dict, "CurNurb", CurNurb_Init(  ) );
+
+       PyModule_AddIntConstant( module, "TRUE", 1 );
+       PyModule_AddIntConstant( module, "FALSE", 0 );
 }
index 40585fffd3a4b5e2a21bacd954d3b31f3aa9c237..af7fa7c10569ef07a6caf10017665a6ca4b6241c 100644 (file)
@@ -1,4 +1,5 @@
 /* 
+ * $Id$
  *
  * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
  *
@@ -31,4 +32,4 @@
 
 #ifndef EXPP_BLENDER_H
 #define EXPP_BLENDER_H
-#endif /* EXPP_BLENDER_H */
+#endif                         /* EXPP_BLENDER_H */
index 52c1e33d586f258d60d972a331032a0e37293c68..0367fa99a65969a8cd4fbcfa16da6cfdcaff0e4a 100644 (file)
 #include "matrix.h"
 #include "vector.h"
 
-//------------------------Python API function prototypes for the Bone module---------------------------
-static PyObject *M_Bone_New (PyObject * self, PyObject * args);
-//------------------------Python API Doc strings for the Bone module--------------------------------------
+//--------------------Python API function prototypes for the Bone module----
+static PyObject *M_Bone_New( PyObject * self, PyObject * args );
+
+//------------------------Python API Doc strings for the Bone module--------
 char M_Bone_doc[] = "The Blender Bone module\n\n\
 This module provides control over **Bone Data** objects in Blender.\n\n\
 Example::\n\n\
        from Blender import Armature.Bone\n\
        l = Armature.Bone.New()\n";
 char M_Bone_New_doc[] = "(name) - return a new Bone of name 'name'.";
-//--------------- Python method structure definition for Blender.Armature.Bone module------------
+
+//----- Python method structure definition for Blender.Armature.Bone module---
 struct PyMethodDef M_Bone_methods[] = {
-  {"New", (PyCFunction) M_Bone_New, METH_VARARGS,   M_Bone_New_doc},
-  {NULL, NULL, 0, NULL}
+       {"New", ( PyCFunction ) M_Bone_New, METH_VARARGS, M_Bone_New_doc},
+       {NULL, NULL, 0, NULL}
 };
-//--------------- Python BPy_Bone methods declarations:---------------------------------------------------
-static PyObject *Bone_getName (BPy_Bone * self);
-static PyObject *Bone_getRoll (BPy_Bone * self);
-static PyObject *Bone_getHead (BPy_Bone * self);
-static PyObject *Bone_getTail (BPy_Bone * self);
-static PyObject *Bone_getLoc (BPy_Bone * self);
-static PyObject *Bone_getSize (BPy_Bone * self);
-static PyObject *Bone_getQuat (BPy_Bone * self);
-static PyObject *Bone_getParent (BPy_Bone * self);
-static PyObject *Bone_hasParent (BPy_Bone * self);
-static PyObject *Bone_getWeight (BPy_Bone * self);
-static PyObject *Bone_getBoneclass (BPy_Bone * self);
-static PyObject *Bone_hasIK(BPy_Bone * self);
-static PyObject *Bone_getChildren (BPy_Bone * self);
-static PyObject *Bone_clearParent (BPy_Bone * self);
-static PyObject *Bone_clearChildren (BPy_Bone * self);
-static PyObject *Bone_hide (BPy_Bone * self);
-static PyObject *Bone_unhide (BPy_Bone * self);
-static PyObject *Bone_setName (BPy_Bone * self, PyObject * args);
-static PyObject *Bone_setRoll (BPy_Bone * self, PyObject * args);
-static PyObject *Bone_setHead (BPy_Bone * self, PyObject * args);
-static PyObject *Bone_setTail (BPy_Bone * self, PyObject * args);
-static PyObject *Bone_setLoc (BPy_Bone * self, PyObject * args);
-static PyObject *Bone_setSize (BPy_Bone * self, PyObject * args);
-static PyObject *Bone_setQuat (BPy_Bone * self, PyObject * args);
-static PyObject *Bone_setParent(BPy_Bone *self, PyObject *args);
-static PyObject *Bone_setWeight(BPy_Bone *self, PyObject *args);
-static PyObject *Bone_setPose (BPy_Bone *self, PyObject *args);
-static PyObject *Bone_setBoneclass (BPy_Bone *self, PyObject *args);
-static PyObject *Bone_getRestMatrix(BPy_Bone * self, PyObject *args);
-//--------------- Python BPy_Bone methods table:-----------------------------------------------------------------
+//--------------- Python BPy_Bone methods declarations:-------------------
+static PyObject *Bone_getName( BPy_Bone * self );
+static PyObject *Bone_getRoll( BPy_Bone * self );
+static PyObject *Bone_getHead( BPy_Bone * self );
+static PyObject *Bone_getTail( BPy_Bone * self );
+static PyObject *Bone_getLoc( BPy_Bone * self );
+static PyObject *Bone_getSize( BPy_Bone * self );
+static PyObject *Bone_getQuat( BPy_Bone * self );
+static PyObject *Bone_getParent( BPy_Bone * self );
+static PyObject *Bone_hasParent( BPy_Bone * self );
+static PyObject *Bone_getWeight( BPy_Bone * self );
+static PyObject *Bone_getBoneclass( BPy_Bone * self );
+static PyObject *Bone_hasIK( BPy_Bone * self );
+static PyObject *Bone_getChildren( BPy_Bone * self );
+static PyObject *Bone_clearParent( BPy_Bone * self );
+static PyObject *Bone_clearChildren( BPy_Bone * self );
+static PyObject *Bone_hide( BPy_Bone * self );
+static PyObject *Bone_unhide( BPy_Bone * self );
+static PyObject *Bone_setName( BPy_Bone * self, PyObject * args );
+static PyObject *Bone_setRoll( BPy_Bone * self, PyObject * args );
+static PyObject *Bone_setHead( BPy_Bone * self, PyObject * args );
+static PyObject *Bone_setTail( BPy_Bone * self, PyObject * args );
+static PyObject *Bone_setLoc( BPy_Bone * self, PyObject * args );
+static PyObject *Bone_setSize( BPy_Bone * self, PyObject * args );
+static PyObject *Bone_setQuat( BPy_Bone * self, PyObject * args );
+static PyObject *Bone_setParent( BPy_Bone * self, PyObject * args );
+static PyObject *Bone_setWeight( BPy_Bone * self, PyObject * args );
+static PyObject *Bone_setPose( BPy_Bone * self, PyObject * args );
+static PyObject *Bone_setBoneclass( BPy_Bone * self, PyObject * args );
+static PyObject *Bone_getRestMatrix( BPy_Bone * self, PyObject * args );
+
+//--------------- Python BPy_Bone methods table:--------------------------
 static PyMethodDef BPy_Bone_methods[] = {
-  {"getName", (PyCFunction) Bone_getName, METH_NOARGS,
-   "() - return Bone name"},
-  {"getRoll", (PyCFunction) Bone_getRoll, METH_NOARGS,
-   "() - return Bone roll"},
-  {"getHead", (PyCFunction) Bone_getHead, METH_NOARGS,
-   "() - return Bone head"},
-  {"getTail", (PyCFunction) Bone_getTail, METH_NOARGS,
-   "() - return Bone tail"},
-  {"getLoc", (PyCFunction) Bone_getLoc, METH_NOARGS, "() - return Bone loc"},
-  {"getSize", (PyCFunction) Bone_getSize, METH_NOARGS,
-   "() - return Bone size"},
-  {"getQuat", (PyCFunction) Bone_getQuat, METH_NOARGS,
-   "() - return Bone quat"},
-  {"hide", (PyCFunction) Bone_hide, METH_NOARGS,
-   "() - hides the bone"},
-  {"unhide", (PyCFunction) Bone_unhide, METH_NOARGS,
-   "() - unhides the bone"},
-  {"getWeight", (PyCFunction) Bone_getWeight, METH_NOARGS,
-   "() - return Bone weight"},
-  {"getBoneclass", (PyCFunction) Bone_getBoneclass, METH_NOARGS,
-   "() - return Bone boneclass"},
-  {"hasIK", (PyCFunction)Bone_hasIK, METH_VARARGS,  
-   "() - get the Bone IKToParent flag."},
-  {"getParent", (PyCFunction) Bone_getParent, METH_NOARGS,
-   "() - return the parent bone of this one if it exists."
-   " None if not found. You can check this condition with the "
-   "hasParent() method."},
-  {"hasParent", (PyCFunction) Bone_hasParent, METH_NOARGS,
-   "() - return true if bone has a parent"},
-  {"getChildren", (PyCFunction) Bone_getChildren, METH_NOARGS,
-   "() - return Bone children list"},
-  {"clearParent", (PyCFunction) Bone_clearParent, METH_NOARGS,
-   "() - clears the bone's parent in the armature and makes it root"},
-  {"clearChildren", (PyCFunction) Bone_clearChildren, METH_NOARGS,
-   "() - remove the children associated with this bone"},
-  {"setName", (PyCFunction) Bone_setName, METH_VARARGS,
-   "(str) - rename Bone"},
-  {"setRoll", (PyCFunction) Bone_setRoll, METH_VARARGS,
-   "(float) - set Bone roll"},
-  {"setHead", (PyCFunction) Bone_setHead, METH_VARARGS,
-   "(float,float,float) - set Bone head pos"},
-  {"setTail", (PyCFunction) Bone_setTail, METH_VARARGS,
-   "(float,float,float) - set Bone tail pos"},
-  {"setLoc", (PyCFunction) Bone_setLoc, METH_VARARGS,
-   "(float,float,float) - set Bone loc"},
-  {"setSize", (PyCFunction) Bone_setSize, METH_VARARGS,
-   "(float,float,float) - set Bone size"},
-  {"setQuat", (PyCFunction) Bone_setQuat, METH_VARARGS,
-   "(float,float,float,float) - set Bone quat"},
-  {"setParent", (PyCFunction)Bone_setParent, METH_VARARGS,  
-   "() - set the Bone parent of this one."},
-  {"setWeight", (PyCFunction)Bone_setWeight, METH_VARARGS,  
-   "() - set the Bone weight."},
-  {"setPose", (PyCFunction)Bone_setPose, METH_VARARGS,  
-   "() - set a pose for this bone at a frame."},
-  {"setBoneclass", (PyCFunction)Bone_setBoneclass, METH_VARARGS,  
-   "() - set the Bone boneclass."},
-  {"getRestMatrix", (PyCFunction)Bone_getRestMatrix, METH_VARARGS,  
-   "() - return the rest matrix for this bone"},
-  {NULL, NULL, 0, NULL}
+       {"getName", ( PyCFunction ) Bone_getName, METH_NOARGS,
+        "() - return Bone name"},
+       {"getRoll", ( PyCFunction ) Bone_getRoll, METH_NOARGS,
+        "() - return Bone roll"},
+       {"getHead", ( PyCFunction ) Bone_getHead, METH_NOARGS,
+        "() - return Bone head"},
+       {"getTail", ( PyCFunction ) Bone_getTail, METH_NOARGS,
+        "() - return Bone tail"},
+       {"getLoc", ( PyCFunction ) Bone_getLoc, METH_NOARGS,
+        "() - return Bone loc"},
+       {"getSize", ( PyCFunction ) Bone_getSize, METH_NOARGS,
+        "() - return Bone size"},
+       {"getQuat", ( PyCFunction ) Bone_getQuat, METH_NOARGS,
+        "() - return Bone quat"},
+       {"hide", ( PyCFunction ) Bone_hide, METH_NOARGS,
+        "() - hides the bone"},
+       {"unhide", ( PyCFunction ) Bone_unhide, METH_NOARGS,
+        "() - unhides the bone"},
+       {"getWeight", ( PyCFunction ) Bone_getWeight, METH_NOARGS,
+        "() - return Bone weight"},
+       {"getBoneclass", ( PyCFunction ) Bone_getBoneclass, METH_NOARGS,
+        "() - return Bone boneclass"},
+       {"hasIK", ( PyCFunction ) Bone_hasIK, METH_VARARGS,
+        "() - get the Bone IKToParent flag."},
+       {"getParent", ( PyCFunction ) Bone_getParent, METH_NOARGS,
+        "() - return the parent bone of this one if it exists."
+        " None if not found. You can check this condition with the "
+        "hasParent() method."},
+       {"hasParent", ( PyCFunction ) Bone_hasParent, METH_NOARGS,
+        "() - return true if bone has a parent"},
+       {"getChildren", ( PyCFunction ) Bone_getChildren, METH_NOARGS,
+        "() - return Bone children list"},
+       {"clearParent", ( PyCFunction ) Bone_clearParent, METH_NOARGS,
+        "() - clears the bone's parent in the armature and makes it root"},
+       {"clearChildren", ( PyCFunction ) Bone_clearChildren, METH_NOARGS,
+        "() - remove the children associated with this bone"},
+       {"setName", ( PyCFunction ) Bone_setName, METH_VARARGS,
+        "(str) - rename Bone"},
+       {"setRoll", ( PyCFunction ) Bone_setRoll, METH_VARARGS,
+        "(float) - set Bone roll"},
+       {"setHead", ( PyCFunction ) Bone_setHead, METH_VARARGS,
+        "(float,float,float) - set Bone head pos"},
+       {"setTail", ( PyCFunction ) Bone_setTail, METH_VARARGS,
+        "(float,float,float) - set Bone tail pos"},
+       {"setLoc", ( PyCFunction ) Bone_setLoc, METH_VARARGS,
+        "(float,float,float) - set Bone loc"},
+       {"setSize", ( PyCFunction ) Bone_setSize, METH_VARARGS,
+        "(float,float,float) - set Bone size"},
+       {"setQuat", ( PyCFunction ) Bone_setQuat, METH_VARARGS,
+        "(float,float,float,float) - set Bone quat"},
+       {"setParent", ( PyCFunction ) Bone_setParent, METH_VARARGS,
+        "() - set the Bone parent of this one."},
+       {"setWeight", ( PyCFunction ) Bone_setWeight, METH_VARARGS,
+        "() - set the Bone weight."},
+       {"setPose", ( PyCFunction ) Bone_setPose, METH_VARARGS,
+        "() - set a pose for this bone at a frame."},
+       {"setBoneclass", ( PyCFunction ) Bone_setBoneclass, METH_VARARGS,
+        "() - set the Bone boneclass."},
+       {"getRestMatrix", ( PyCFunction ) Bone_getRestMatrix, METH_VARARGS,
+        "() - return the rest matrix for this bone"},
+       {NULL, NULL, 0, NULL}
 };
-//--------------- Python TypeBone callback function prototypes----------------------------------------
-static void Bone_dealloc (BPy_Bone * bone);
-static PyObject *Bone_getAttr (BPy_Bone * bone, char *name);
-static int Bone_setAttr (BPy_Bone * bone, char *name, PyObject * v);
-static int Bone_compare (BPy_Bone * a1, BPy_Bone * a2);
-static PyObject *Bone_repr (BPy_Bone * bone);
-//--------------- Python TypeBone structure definition------------------------------------------------------
+
+//--------------- Python TypeBone callback function prototypes----------
+static void Bone_dealloc( BPy_Bone * bone );
+static PyObject *Bone_getAttr( BPy_Bone * bone, char *name );
+static int Bone_setAttr( BPy_Bone * bone, char *name, PyObject * v );
+static int Bone_compare( BPy_Bone * a1, BPy_Bone * a2 );
+static PyObject *Bone_repr( BPy_Bone * bone );
+
+//--------------- Python TypeBone structure definition-------------
 PyTypeObject Bone_Type = {
-  PyObject_HEAD_INIT (NULL) 0, /* ob_size */
-  "Blender Bone",              /* tp_name */
-  sizeof (BPy_Bone),           /* tp_basicsize */
-  0,                           /* tp_itemsize */
-  /* methods */
-  (destructor) Bone_dealloc,   /* tp_dealloc */
-  0,                           /* tp_print */
-  (getattrfunc) Bone_getAttr,  /* tp_getattr */
-  (setattrfunc) Bone_setAttr,  /* tp_setattr */
-  (cmpfunc) Bone_compare,      /* tp_compare */
-  (reprfunc) Bone_repr,                /* tp_repr */
-  0,                           /* tp_as_number */
-  0,                           /* tp_as_sequence */
-  0,                           /* tp_as_mapping */
-  0,                           /* tp_as_hash */
-  0, 0, 0, 0, 0, 0,
-  0,                           /* tp_doc */
-  0, 0, 0, 0, 0, 0,
-  BPy_Bone_methods,            /* tp_methods */
-  0,                           /* tp_members */
+       PyObject_HEAD_INIT( NULL ) 
+       0,      /* ob_size */
+       "Blender Bone",         /* tp_name */
+       sizeof( BPy_Bone ),     /* tp_basicsize */
+       0,                      /* tp_itemsize */
+       /* methods */
+       ( destructor ) Bone_dealloc,    /* tp_dealloc */
+       0,                      /* tp_print */
+       ( getattrfunc ) Bone_getAttr,   /* tp_getattr */
+       ( setattrfunc ) Bone_setAttr,   /* tp_setattr */
+       ( cmpfunc ) Bone_compare,       /* tp_compare */
+       ( reprfunc ) Bone_repr, /* tp_repr */
+       0,                      /* tp_as_number */
+       0,                      /* tp_as_sequence */
+       0,                      /* tp_as_mapping */
+       0,                      /* tp_as_hash */
+       0, 0, 0, 0, 0, 0,
+       0,                      /* tp_doc */
+       0, 0, 0, 0, 0, 0,
+       BPy_Bone_methods,       /* tp_methods */
+       0,                      /* tp_members */
 };
-//--------------- Bone Module Init----------------------------------------------------------------------------------------
-PyObject *
-Bone_Init (void)
+
+//--------------- Bone Module Init-----------------------------
+PyObject *Bone_Init( void )
 {
-  PyObject *submodule;
-
-  Bone_Type.ob_type = &PyType_Type;
-
-  submodule = Py_InitModule3 ("Blender.Armature.Bone",
-                             M_Bone_methods, M_Bone_doc);
-
-  PyModule_AddIntConstant(submodule, "ROT",  POSE_ROT);
-  PyModule_AddIntConstant(submodule, "LOC",  POSE_LOC);
-  PyModule_AddIntConstant(submodule, "SIZE", POSE_SIZE);
-  PyModule_AddIntConstant(submodule, "SKINNABLE", 0);
-  PyModule_AddIntConstant(submodule, "UNSKINNABLE", 1);
-  PyModule_AddIntConstant(submodule, "HEAD", 2);
-  PyModule_AddIntConstant(submodule, "NECK", 3);
-  PyModule_AddIntConstant(submodule, "BACK", 4);
-  PyModule_AddIntConstant(submodule, "SHOULDER", 5);
-  PyModule_AddIntConstant(submodule, "ARM", 6);
-  PyModule_AddIntConstant(submodule, "HAND", 7);
-  PyModule_AddIntConstant(submodule, "FINGER", 8);
-  PyModule_AddIntConstant(submodule, "THUMB", 9);
-  PyModule_AddIntConstant(submodule, "PELVIS", 10);
-  PyModule_AddIntConstant(submodule, "LEG", 11);
-  PyModule_AddIntConstant(submodule, "FOOT", 12);
-  PyModule_AddIntConstant(submodule, "TOE", 13);
-  PyModule_AddIntConstant(submodule, "TENTACLE", 14);
-
-  return (submodule);
+       PyObject *submodule;
+
+       Bone_Type.ob_type = &PyType_Type;
+
+       submodule = Py_InitModule3( "Blender.Armature.Bone",
+                                   M_Bone_methods, M_Bone_doc );
+
+       PyModule_AddIntConstant( submodule, "ROT", POSE_ROT );
+       PyModule_AddIntConstant( submodule, "LOC", POSE_LOC );
+       PyModule_AddIntConstant( submodule, "SIZE", POSE_SIZE );
+       PyModule_AddIntConstant( submodule, "SKINNABLE", 0 );
+       PyModule_AddIntConstant( submodule, "UNSKINNABLE", 1 );
+       PyModule_AddIntConstant( submodule, "HEAD", 2 );
+       PyModule_AddIntConstant( submodule, "NECK", 3 );
+       PyModule_AddIntConstant( submodule, "BACK", 4 );
+       PyModule_AddIntConstant( submodule, "SHOULDER", 5 );
+       PyModule_AddIntConstant( submodule, "ARM", 6 );
+       PyModule_AddIntConstant( submodule, "HAND", 7 );
+       PyModule_AddIntConstant( submodule, "FINGER", 8 );
+       PyModule_AddIntConstant( submodule, "THUMB", 9 );
+       PyModule_AddIntConstant( submodule, "PELVIS", 10 );
+       PyModule_AddIntConstant( submodule, "LEG", 11 );
+       PyModule_AddIntConstant( submodule, "FOOT", 12 );
+       PyModule_AddIntConstant( submodule, "TOE", 13 );
+       PyModule_AddIntConstant( submodule, "TENTACLE", 14 );
+
+       return ( submodule );
 }
-//--------------- Bone module internal callbacks-------------------------------------------------------------
-//--------------- updatePyBone-------------------------------------------------------------------------------------
-int
-updatePyBone(BPy_Bone *self)
+
+//--------------- Bone module internal callbacks-----------------
+
+//--------------- updatePyBone------------------------------------
+int updatePyBone( BPy_Bone * self )
 {
-       int x,y;
+       int x, y;
        char *parent_str = "";
 
-       if(!self->bone){
+       if( !self->bone ) {
                //nothing to update - not linked
                return 0;
-       }else{
-               BLI_strncpy(self->name, self->bone->name, strlen(self->bone->name) + 1);
+       } else {
+               BLI_strncpy( self->name, self->bone->name,
+                            strlen( self->bone->name ) + 1 );
                self->roll = self->bone->roll;
                self->flag = self->bone->flag;
                self->boneclass = self->bone->boneclass;
                self->dist = self->bone->dist;
                self->weight = self->bone->weight;
 
-               if(self->bone->parent){    
-                       self->parent = BLI_strncpy(self->parent, self->bone->parent->name, strlen(self->bone->parent->name) + 1);
-               }else{
-                       self->parent = BLI_strncpy(self->parent, parent_str, strlen(parent_str) + 1);
+               if( self->bone->parent ) {
+                       self->parent =
+                               BLI_strncpy( self->parent,
+                                            self->bone->parent->name,
+                                            strlen( self->bone->parent->
+                                                    name ) + 1 );
+               } else {
+                       self->parent =
+                               BLI_strncpy( self->parent, parent_str,
+                                            strlen( parent_str ) + 1 );
                }
 
-               for(x = 0; x < 3; x++){
+               for( x = 0; x < 3; x++ ) {
                        self->head->vec[x] = self->bone->head[x];
                        self->tail->vec[x] = self->bone->tail[x];
                        self->loc->vec[x] = self->bone->loc[x];
@@ -254,43 +269,49 @@ updatePyBone(BPy_Bone *self)
                        self->size->vec[x] = self->bone->size[x];
                        self->dsize->vec[x] = self->bone->dsize[x];
                }
-               for(x = 0; x < 4; x++){
+               for( x = 0; x < 4; x++ ) {
                        self->quat->quat[x] = self->bone->quat[x];
                        self->dquat->quat[x] = self->bone->dquat[x];
                }
-               for(x = 0; x < 4; x++){
-                       for(y = 0; y < 4; y++){
-                               self->obmat->matrix[x][y] = self->bone->obmat[x][y];
-                               self->parmat->matrix[x][y] = self->bone->parmat[x][y];
-                               self->defmat->matrix[x][y] = self->bone->defmat[x][y];
-                               self->irestmat->matrix[x][y] = self->bone->irestmat[x][y];
-                               self->posemat->matrix[x][y] = self->bone->posemat[x][y];
+               for( x = 0; x < 4; x++ ) {
+                       for( y = 0; y < 4; y++ ) {
+                               self->obmat->matrix[x][y] =
+                                       self->bone->obmat[x][y];
+                               self->parmat->matrix[x][y] =
+                                       self->bone->parmat[x][y];
+                               self->defmat->matrix[x][y] =
+                                       self->bone->defmat[x][y];
+                               self->irestmat->matrix[x][y] =
+                                       self->bone->irestmat[x][y];
+                               self->posemat->matrix[x][y] =
+                                       self->bone->posemat[x][y];
                        }
                }
                return 1;
        }
 }
-//--------------- updateBoneData-------------------------------------------------------------------------------------
-int
-updateBoneData(BPy_Bone *self, Bone *parent)
+
+//--------------- updateBoneData------------------------------------
+int updateBoneData( BPy_Bone * self, Bone * parent )
 {
        //called from Armature.addBone()
-        int x,y;
+       int x, y;
 
-        //called in Armature.addBone() to update the Bone * data
-       if(!self->bone){
+       //called in Armature.addBone() to update the Bone * data
+       if( !self->bone ) {
                //nothing to update - not linked
                return 0;
-       }else{
-               BLI_strncpy(self->bone->name, self->name, strlen(self->name) + 1);
+       } else {
+               BLI_strncpy( self->bone->name, self->name,
+                            strlen( self->name ) + 1 );
                self->bone->roll = self->roll;
                self->bone->flag = self->flag;
                self->bone->boneclass = self->boneclass;
                self->bone->dist = self->dist;
                self->bone->weight = self->weight;
-               self->bone->parent = parent; //parent will be checked from self->parent string in addBone()
+               self->bone->parent = parent;    //parent will be checked from self->parent string in addBone()
 
-               for(x = 0; x < 3; x++){
+               for( x = 0; x < 3; x++ ) {
                        self->bone->head[x] = self->head->vec[x];
                        self->bone->tail[x] = self->tail->vec[x];
                        self->bone->loc[x] = self->loc->vec[x];
@@ -298,293 +319,370 @@ updateBoneData(BPy_Bone *self, Bone *parent)
                        self->bone->size[x] = self->size->vec[x];
                        self->bone->dsize[x] = self->dsize->vec[x];
                }
-               for(x = 0; x < 4; x++){
+               for( x = 0; x < 4; x++ ) {
                        self->bone->quat[x] = self->quat->quat[x];
                        self->bone->dquat[x] = self->dquat->quat[x];
                }
-               for(x = 0; x < 4; x++){
-                       for(y = 0; y < 4; y++){
-                               self->bone->obmat[x][y] = self->obmat->matrix[x][y];
-                               self->bone->parmat[x][y] = self->parmat->matrix[x][y];
-                               self->bone->defmat[x][y] = self->defmat->matrix[x][y];
-                               self->bone->irestmat[x][y] = self->irestmat->matrix[x][y];
-                               self->bone->posemat[x][y] = self->posemat->matrix[x][y];
+               for( x = 0; x < 4; x++ ) {
+                       for( y = 0; y < 4; y++ ) {
+                               self->bone->obmat[x][y] =
+                                       self->obmat->matrix[x][y];
+                               self->bone->parmat[x][y] =
+                                       self->parmat->matrix[x][y];
+                               self->bone->defmat[x][y] =
+                                       self->defmat->matrix[x][y];
+                               self->bone->irestmat[x][y] =
+                                       self->irestmat->matrix[x][y];
+                               self->bone->posemat[x][y] =
+                                       self->posemat->matrix[x][y];
                        }
                }
                return 1;
        }
 }
-//--------------- testChildbase--------------------------------------------------------------------------------
-static int
-testChildbase(Bone *bone, Bone *test)
+
+//--------------- testChildbase----------------------------------
+static int testChildbase( Bone * bone, Bone * test )
 {
        Bone *child;
 
-       for(child = bone->childbase.first; child; child = child->next){
-               if(child == test){
+       for( child = bone->childbase.first; child; child = child->next ) {
+               if( child == test ) {
                        return 1;
                }
-               if(child->childbase.first != NULL)
-                       testChildbase(child, test);
+               if( child->childbase.first != NULL )
+                       testChildbase( child, test );
        }
 
        return 0;
 }
-//--------------- returnBoneclassEnum---------------------------------------------------------------------
-static PyObject *
-returnBoneclassEnum(int value)
+
+//--------------- returnBoneclassEnum----------------------------
+static PyObject *returnBoneclassEnum( int value )
 {
        char *str;
-       str = PyMem_Malloc(32 + 1);
-
-       switch(value){
-               case 0:
-                       BLI_strncpy(str,"SKINNABLE",32);        break;
-               case 1:
-                       BLI_strncpy(str,"UNSKINNABLE",32);      break;
-               case 2:
-                       BLI_strncpy(str,"HEAD",32);     break;
-               case 3:
-                       BLI_strncpy(str,"NECK",32);     break;
-               case 4:
-                       BLI_strncpy(str,"BACK",32);     break;
-               case 5:
-                       BLI_strncpy(str,"SHOULDER",32); break;
-               case 6:
-                       BLI_strncpy(str,"ARM",32); break;
-               case 7:
-                       BLI_strncpy(str,"HAND",32);     break;
-               case 8:
-                       BLI_strncpy(str,"FINGER",32);   break;
-               case 9:
-                       BLI_strncpy(str,"THUMB",32);    break;
-               case 10:
-                       BLI_strncpy(str,"PELVIS",32);   break;
-               case 11:
-                       BLI_strncpy(str,"LEG",32);      break;
-               case 12:
-                       BLI_strncpy(str,"FOOT",32);     break;
-               case 13:
-                       BLI_strncpy(str,"TOE",32);      break;
-               case 14:
-                       BLI_strncpy(str,"TENTACLE",32);         break;
-               default:
-                       BLI_strncpy(str, "SKINNABLE",32);       break;
+       str = PyMem_Malloc( 32 + 1 );
+
+       switch ( value ) {
+       case 0:
+               BLI_strncpy( str, "SKINNABLE", 32 );
+               break;
+       case 1:
+               BLI_strncpy( str, "UNSKINNABLE", 32 );
+               break;
+       case 2:
+               BLI_strncpy( str, "HEAD", 32 );
+               break;
+       case 3:
+               BLI_strncpy( str, "NECK", 32 );
+               break;
+       case 4:
+               BLI_strncpy( str, "BACK", 32 );
+               break;
+       case 5:
+               BLI_strncpy( str, "SHOULDER", 32 );
+               break;
+       case 6:
+               BLI_strncpy( str, "ARM", 32 );
+               break;
+       case 7:
+               BLI_strncpy( str, "HAND", 32 );
+               break;
+       case 8:
+               BLI_strncpy( str, "FINGER", 32 );
+               break;
+       case 9:
+               BLI_strncpy( str, "THUMB", 32 );
+               break;
+       case 10:
+               BLI_strncpy( str, "PELVIS", 32 );
+               break;
+       case 11:
+               BLI_strncpy( str, "LEG", 32 );
+               break;
+       case 12:
+               BLI_strncpy( str, "FOOT", 32 );
+               break;
+       case 13:
+               BLI_strncpy( str, "TOE", 32 );
+               break;
+       case 14:
+               BLI_strncpy( str, "TENTACLE", 32 );
+               break;
+       default:
+               BLI_strncpy( str, "SKINNABLE", 32 );
+               break;
        }
-       return (PyObject*)PyString_FromString(str);
+       return ( PyObject * ) PyString_FromString( str );
 }
-//---------------BPy_Bone internal callbacks/methods---------------------------------------------
-//--------------- dealloc---------------------------------------------------------------------------------------
-static void
-Bone_dealloc (BPy_Bone * self)
+
+//---------------BPy_Bone internal callbacks/methods---------------
+
+//--------------- dealloc------------------------------------------
+static void Bone_dealloc( BPy_Bone * self )
 {
-       PyMem_Free (self->name);
-       PyMem_Free (self->parent);
-    PyObject_DEL (self);
+       PyMem_Free( self->name );
+       PyMem_Free( self->parent );
+       PyObject_DEL( self );
 }
-//---------------getattr---------------------------------------------------------------------------------------
-static PyObject *
-Bone_getAttr (BPy_Bone * self, char *name)
+
+//---------------getattr-------------------------------------------
+static PyObject *Bone_getAttr( BPy_Bone * self, char *name )
 {
-  PyObject *attr = Py_None;
-
-  if (strcmp (name, "name") == 0)
-    attr = Bone_getName (self);
-  else if (strcmp (name, "roll") == 0)
-    attr = Bone_getRoll (self);
-  else if (strcmp (name, "head") == 0)
-    attr = Bone_getHead (self);
-  else if (strcmp (name, "tail") == 0)
-    attr = Bone_getTail (self);
-  else if (strcmp (name, "size") == 0)
-    attr = Bone_getSize (self);
-  else if (strcmp (name, "loc") == 0)
-    attr = Bone_getLoc (self);
-  else if (strcmp (name, "quat") == 0)
-    attr = Bone_getQuat (self);
-  else if (strcmp (name, "parent") == 0)
-    /*  Skip the checks for Py_None as its a valid result to this call. */
-    return Bone_getParent (self);
-  else if (strcmp (name, "children") == 0)
-    attr = Bone_getChildren (self);
-  else if (strcmp (name, "weight") == 0)
-    attr = Bone_getWeight (self);
-  else if (strcmp (name, "boneclass") == 0)
-    attr = Bone_getBoneclass (self);
-  else if (strcmp (name, "ik") == 0)
-    attr = Bone_hasIK (self);
-  else if (strcmp (name, "__members__") == 0)
-    {
-      /* 9 entries */
-      attr = Py_BuildValue ("[s,s,s,s,s,s,s,s,s,s,s]",
-                           "name", "roll", "head", "tail", "loc", "size",
-                           "quat", "parent", "children", "weight", "boneclass", "ik");
-    }
-
-  if (!attr)
-    return (EXPP_ReturnPyObjError (PyExc_MemoryError,
-                                  "couldn't create PyObject"));
-
-  if (attr != Py_None)
-    return attr;               /* member attribute found, return it */
-
-  /* not an attribute, search the methods table */
-  return Py_FindMethod (BPy_Bone_methods, (PyObject *) self, name);
+       PyObject *attr = Py_None;
+
+       if( strcmp( name, "name" ) == 0 )
+               attr = Bone_getName( self );
+       else if( strcmp( name, "roll" ) == 0 )
+               attr = Bone_getRoll( self );
+       else if( strcmp( name, "head" ) == 0 )
+               attr = Bone_getHead( self );
+       else if( strcmp( name, "tail" ) == 0 )
+               attr = Bone_getTail( self );
+       else if( strcmp( name, "size" ) == 0 )
+               attr = Bone_getSize( self );
+       else if( strcmp( name, "loc" ) == 0 )
+               attr = Bone_getLoc( self );
+       else if( strcmp( name, "quat" ) == 0 )
+               attr = Bone_getQuat( self );
+       else if( strcmp( name, "parent" ) == 0 )
+               /*  Skip the checks for Py_None as its a valid result to this call. */
+               return Bone_getParent( self );
+       else if( strcmp( name, "children" ) == 0 )
+               attr = Bone_getChildren( self );
+       else if( strcmp( name, "weight" ) == 0 )
+               attr = Bone_getWeight( self );
+       else if( strcmp( name, "boneclass" ) == 0 )
+               attr = Bone_getBoneclass( self );
+       else if( strcmp( name, "ik" ) == 0 )
+               attr = Bone_hasIK( self );
+       else if( strcmp( name, "__members__" ) == 0 ) {
+               /* 9 entries */
+               attr = Py_BuildValue( "[s,s,s,s,s,s,s,s,s,s,s]",
+                                     "name", "roll", "head", "tail", "loc",
+                                     "size", "quat", "parent", "children",
+                                     "weight", "boneclass", "ik" );
+       }
+
+       if( !attr )
+               return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
+                                               "couldn't create PyObject" ) );
+
+       if( attr != Py_None )
+               return attr;    /* member attribute found, return it */
+
+       /* not an attribute, search the methods table */
+       return Py_FindMethod( BPy_Bone_methods, ( PyObject * ) self, name );
 }
-//--------------- setattr---------------------------------------------------------------------------------------
-static int
-Bone_setAttr (BPy_Bone * self, char *name, PyObject * value)
+
+//--------------- setattr-------------------------------------------
+static int Bone_setAttr( BPy_Bone * self, char *name, PyObject * value )
 {
-  PyObject *valtuple;
-  PyObject *error = NULL;
+       PyObject *valtuple;
+       PyObject *error = NULL;
 
-  valtuple = Py_BuildValue ("(O)", value);     /* the set* functions expect a tuple */
+       valtuple = Py_BuildValue( "(O)", value );       /* the set* functions expect a tuple */
 
-  if (!valtuple)
-    return EXPP_ReturnIntError (PyExc_MemoryError,
-                               "BoneSetAttr: couldn't create tuple");
+       if( !valtuple )
+               return EXPP_ReturnIntError( PyExc_MemoryError,
+                                           "BoneSetAttr: couldn't create tuple" );
 
-  if (strcmp (name, "name") == 0)
-    error = Bone_setName (self, valtuple);
-  else
-    {                          /* Error */
-      Py_DECREF (valtuple);
+       if( strcmp( name, "name" ) == 0 )
+               error = Bone_setName( self, valtuple );
+       else {                  /* Error */
+               Py_DECREF( valtuple );
 
-      /* ... member with the given name was found */
-      return (EXPP_ReturnIntError (PyExc_KeyError, "attribute not found"));
-    }
+               /* ... member with the given name was found */
+               return ( EXPP_ReturnIntError
+                        ( PyExc_KeyError, "attribute not found" ) );
+       }
 
-  Py_DECREF (valtuple);
+       Py_DECREF( valtuple );
 
-  if (error != Py_None)
-    return -1;
+       if( error != Py_None )
+               return -1;
 
-  Py_DECREF (Py_None);         /* was incref'ed by the called Bone_set* function */
-  return 0;                    /* normal exit */
+       Py_DECREF( Py_None );   /* was incref'ed by the called Bone_set* function */
+       return 0;               /* normal exit */
 }
-//--------------- repr---------------------------------------------------------------------------------------
-static PyObject *
-Bone_repr (BPy_Bone * self)
+
+//--------------- repr---------------------------------------------
+static PyObject *Bone_repr( BPy_Bone * self )
 {
-  if (self->bone)
-    return PyString_FromFormat ("[Bone \"%s\"]", self->bone->name);
-  else
-    return PyString_FromString ("NULL");
+       if( self->bone )
+               return PyString_FromFormat( "[Bone \"%s\"]",
+                                           self->bone->name );
+       else
+               return PyString_FromString( "NULL" );
 }
-//--------------- compare---------------------------------------------------------------------------------------
-static int
-Bone_compare (BPy_Bone * a, BPy_Bone * b)
+
+//--------------- compare------------------------------------------
+static int Bone_compare( BPy_Bone * a, BPy_Bone * b )
 {
-  Bone *pa = a->bone, *pb = b->bone;
-  return (pa == pb) ? 0 : -1;
+       Bone *pa = a->bone, *pb = b->bone;
+       return ( pa == pb ) ? 0 : -1;
 }
-//--------------- Bone_CreatePyObject--------------------------------------------------------------------
-PyObject *
-Bone_CreatePyObject (struct Bone * bone)
+
+//--------------- Bone_CreatePyObject---------------------------------
+PyObject *Bone_CreatePyObject( struct Bone * bone )
 {
        BPy_Bone *blen_bone;
 
-       blen_bone = (BPy_Bone *) PyObject_NEW (BPy_Bone, &Bone_Type);
+       blen_bone = ( BPy_Bone * ) PyObject_NEW( BPy_Bone, &Bone_Type );
 
        //set the all important Bone flag
        blen_bone->bone = bone;
 
        //allocate space for python vars
-       blen_bone->name= PyMem_Malloc (32 + 1);
-       blen_bone->parent =PyMem_Malloc (32 + 1);
-       blen_bone->head = (VectorObject*)newVectorObject(PyMem_Malloc (3*sizeof (float)), 3);           
-       blen_bone->tail = (VectorObject*)newVectorObject(PyMem_Malloc (3*sizeof (float)), 3);                   
-       blen_bone->loc = (VectorObject*)newVectorObject(PyMem_Malloc (3*sizeof (float)), 3);    
-       blen_bone->dloc = (VectorObject*)newVectorObject(PyMem_Malloc (3*sizeof (float)), 3);   
-       blen_bone->size = (VectorObject*)newVectorObject(PyMem_Malloc (3*sizeof (float)), 3);   
-       blen_bone->dsize = (VectorObject*)newVectorObject(PyMem_Malloc (3*sizeof (float)), 3);  
-       blen_bone->quat = (QuaternionObject*)newQuaternionObject(PyMem_Malloc (4*sizeof (float)));
-       blen_bone->dquat = (QuaternionObject*)newQuaternionObject(PyMem_Malloc (4*sizeof (float)));
-       blen_bone->obmat = (MatrixObject*)newMatrixObject(PyMem_Malloc(16*sizeof(float)),4,4);
-       blen_bone->parmat = (MatrixObject*)newMatrixObject(PyMem_Malloc(16*sizeof(float)),4,4);
-       blen_bone->defmat = (MatrixObject*)newMatrixObject(PyMem_Malloc(16*sizeof(float)),4,4);
-       blen_bone->irestmat = (MatrixObject*)newMatrixObject(PyMem_Malloc(16*sizeof(float)),4,4);
-       blen_bone->posemat = (MatrixObject*)newMatrixObject(PyMem_Malloc(16*sizeof(float)),4,4);        
-
-       if(!updatePyBone(blen_bone))
-               return EXPP_ReturnPyObjError (PyExc_AttributeError , "bone struct empty");
-
-       return ((PyObject *) blen_bone);
+       blen_bone->name = PyMem_Malloc( 32 + 1 );
+       blen_bone->parent = PyMem_Malloc( 32 + 1 );
+       blen_bone->head =
+               ( VectorObject * )
+               newVectorObject( PyMem_Malloc( 3 * sizeof( float ) ), 3 );
+       blen_bone->tail =
+               ( VectorObject * )
+               newVectorObject( PyMem_Malloc( 3 * sizeof( float ) ), 3 );
+       blen_bone->loc =
+               ( VectorObject * )
+               newVectorObject( PyMem_Malloc( 3 * sizeof( float ) ), 3 );
+       blen_bone->dloc =
+               ( VectorObject * )
+               newVectorObject( PyMem_Malloc( 3 * sizeof( float ) ), 3 );
+       blen_bone->size =
+               ( VectorObject * )
+               newVectorObject( PyMem_Malloc( 3 * sizeof( float ) ), 3 );
+       blen_bone->dsize =
+               ( VectorObject * )
+               newVectorObject( PyMem_Malloc( 3 * sizeof( float ) ), 3 );
+       blen_bone->quat =
+               ( QuaternionObject * )
+               newQuaternionObject( PyMem_Malloc( 4 * sizeof( float ) ) );
+       blen_bone->dquat =
+               ( QuaternionObject * )
+               newQuaternionObject( PyMem_Malloc( 4 * sizeof( float ) ) );
+       blen_bone->obmat =
+               ( MatrixObject * )
+               newMatrixObject( PyMem_Malloc( 16 * sizeof( float ) ), 4, 4 );
+       blen_bone->parmat =
+               ( MatrixObject * )
+               newMatrixObject( PyMem_Malloc( 16 * sizeof( float ) ), 4, 4 );
+       blen_bone->defmat =
+               ( MatrixObject * )
+               newMatrixObject( PyMem_Malloc( 16 * sizeof( float ) ), 4, 4 );
+       blen_bone->irestmat =
+               ( MatrixObject * )
+               newMatrixObject( PyMem_Malloc( 16 * sizeof( float ) ), 4, 4 );
+       blen_bone->posemat =
+               ( MatrixObject * )
+               newMatrixObject( PyMem_Malloc( 16 * sizeof( float ) ), 4, 4 );
+
+       if( !updatePyBone( blen_bone ) )
+               return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                             "bone struct empty" );
+
+       return ( ( PyObject * ) blen_bone );
 }
-//--------------- Bone_CheckPyObject--------------------------------------------------------------------
-int
-Bone_CheckPyObject (PyObject * py_obj)
+
+//--------------- Bone_CheckPyObject--------------------------------
+int Bone_CheckPyObject( PyObject * py_obj )
 {
-  return (py_obj->ob_type == &Bone_Type);
+       return ( py_obj->ob_type == &Bone_Type );
 }
-//--------------- Bone_FromPyObject--------------------------------------------------------------------
-struct Bone *
-Bone_FromPyObject (PyObject * py_obj)
+
+//--------------- Bone_FromPyObject---------------------------------
+struct Bone *Bone_FromPyObject( PyObject * py_obj )
 {
-  BPy_Bone *blen_obj;
-
-  blen_obj = (BPy_Bone *) py_obj;
-  if (!((BPy_Bone*)py_obj)->bone) {    //test to see if linked to armature
-         //use python vars
-         return NULL;
-  }else{
-        //use bone datastruct
-       return (blen_obj->bone);
-  }
+       BPy_Bone *blen_obj;
+
+       blen_obj = ( BPy_Bone * ) py_obj;
+       if( !( ( BPy_Bone * ) py_obj )->bone ) {        //test to see if linked to armature
+               //use python vars
+               return NULL;
+       } else {
+               //use bone datastruct
+               return ( blen_obj->bone );
+       }
 }
-//--------------- Python Bone Module methods------------------------------------------------------------------
-//--------------- Blender.Armature.Bone.New()-----------------------------------------------------------------
-static PyObject *
-M_Bone_New (PyObject * self, PyObject * args)
+
+//--------------- Python Bone Module methods------------------------
+
+//--------------- Blender.Armature.Bone.New()-----------------------
+static PyObject *M_Bone_New( PyObject * self, PyObject * args )
 {
        char *name_str = "BoneName";
        char *parent_str = "";
        BPy_Bone *py_bone = NULL;       /* for Bone Data object wrapper in Python */
 
-       if (!PyArg_ParseTuple (args, "|s", &name_str))
-               return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                       "expected string or empty argument"));
+       if( !PyArg_ParseTuple( args, "|s", &name_str ) )
+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                               "expected string or empty argument" ) );
 
        //create python bone
-       py_bone = (BPy_Bone *) PyObject_NEW (BPy_Bone, &Bone_Type);
+       py_bone = ( BPy_Bone * ) PyObject_NEW( BPy_Bone, &Bone_Type );
 
        //allocate space for python vars
-    py_bone->name= PyMem_Malloc (32 + 1);
-       py_bone->parent =PyMem_Malloc (32 + 1);
-       py_bone->head = (VectorObject*)newVectorObject(PyMem_Malloc (3*sizeof (float)), 3);     
-       py_bone->tail = (VectorObject*)newVectorObject(PyMem_Malloc (3*sizeof (float)), 3);                     
-       py_bone->loc = (VectorObject*)newVectorObject(PyMem_Malloc (3*sizeof (float)), 3);      
-       py_bone->dloc = (VectorObject*)newVectorObject(PyMem_Malloc (3*sizeof (float)), 3);     
-       py_bone->size = (VectorObject*)newVectorObject(PyMem_Malloc (3*sizeof (float)), 3);     
-       py_bone->dsize = (VectorObject*)newVectorObject(PyMem_Malloc (3*sizeof (float)), 3);    
-       py_bone->quat = (QuaternionObject*)newQuaternionObject(PyMem_Malloc (4*sizeof (float)));
-       py_bone->dquat = (QuaternionObject*)newQuaternionObject(PyMem_Malloc (4*sizeof (float)));
-       py_bone->obmat = (MatrixObject*)newMatrixObject(PyMem_Malloc(16*sizeof(float)),4,4);
-       py_bone->parmat = (MatrixObject*)newMatrixObject(PyMem_Malloc(16*sizeof(float)),4,4);
-       py_bone->defmat = (MatrixObject*)newMatrixObject(PyMem_Malloc(16*sizeof(float)),4,4);
-       py_bone->irestmat = (MatrixObject*)newMatrixObject(PyMem_Malloc(16*sizeof(float)),4,4);
-       py_bone->posemat = (MatrixObject*)newMatrixObject(PyMem_Malloc(16*sizeof(float)),4,4);  
-       
+       py_bone->name = PyMem_Malloc( 32 + 1 );
+       py_bone->parent = PyMem_Malloc( 32 + 1 );
+       py_bone->head =
+               ( VectorObject * )
+               newVectorObject( PyMem_Malloc( 3 * sizeof( float ) ), 3 );
+       py_bone->tail =
+               ( VectorObject * )
+               newVectorObject( PyMem_Malloc( 3 * sizeof( float ) ), 3 );
+       py_bone->loc =
+               ( VectorObject * )
+               newVectorObject( PyMem_Malloc( 3 * sizeof( float ) ), 3 );
+       py_bone->dloc =
+               ( VectorObject * )
+               newVectorObject( PyMem_Malloc( 3 * sizeof( float ) ), 3 );
+       py_bone->size =
+               ( VectorObject * )
+               newVectorObject( PyMem_Malloc( 3 * sizeof( float ) ), 3 );
+       py_bone->dsize =
+               ( VectorObject * )
+               newVectorObject( PyMem_Malloc( 3 * sizeof( float ) ), 3 );
+       py_bone->quat =
+               ( QuaternionObject * )
+               newQuaternionObject( PyMem_Malloc( 4 * sizeof( float ) ) );
+       py_bone->dquat =
+               ( QuaternionObject * )
+               newQuaternionObject( PyMem_Malloc( 4 * sizeof( float ) ) );
+       py_bone->obmat =
+               ( MatrixObject * )
+               newMatrixObject( PyMem_Malloc( 16 * sizeof( float ) ), 4, 4 );
+       py_bone->parmat =
+               ( MatrixObject * )
+               newMatrixObject( PyMem_Malloc( 16 * sizeof( float ) ), 4, 4 );
+       py_bone->defmat =
+               ( MatrixObject * )
+               newMatrixObject( PyMem_Malloc( 16 * sizeof( float ) ), 4, 4 );
+       py_bone->irestmat =
+               ( MatrixObject * )
+               newMatrixObject( PyMem_Malloc( 16 * sizeof( float ) ), 4, 4 );
+       py_bone->posemat =
+               ( MatrixObject * )
+               newMatrixObject( PyMem_Malloc( 16 * sizeof( float ) ), 4, 4 );
+
        //default py values
-       BLI_strncpy(py_bone->name, name_str, strlen(name_str) + 1);
-       BLI_strncpy(py_bone->parent, parent_str, strlen(parent_str) + 1);
+       BLI_strncpy( py_bone->name, name_str, strlen( name_str ) + 1 );
+       BLI_strncpy( py_bone->parent, parent_str, strlen( parent_str ) + 1 );
        py_bone->roll = 0.0f;
        py_bone->flag = 32;
        py_bone->boneclass = BONE_SKINNABLE;
        py_bone->dist = 1.0f;
        py_bone->weight = 1.0f;
-       Vector_Zero(py_bone->head);
-       Vector_Zero(py_bone->loc);
-       Vector_Zero(py_bone->dloc);
-       Vector_Zero(py_bone->size);
-       Vector_Zero(py_bone->dsize);
-    Quaternion_Identity(py_bone->quat);
-       Quaternion_Identity(py_bone->dquat);
-       Matrix_Identity(py_bone->obmat);
-       Matrix_Identity(py_bone->parmat);
-       Matrix_Identity(py_bone->defmat);
-       Matrix_Identity(py_bone->irestmat);
-       Matrix_Identity(py_bone->posemat);
+       Vector_Zero( py_bone->head );
+       Vector_Zero( py_bone->loc );
+       Vector_Zero( py_bone->dloc );
+       Vector_Zero( py_bone->size );
+       Vector_Zero( py_bone->dsize );
+       Quaternion_Identity( py_bone->quat );
+       Quaternion_Identity( py_bone->dquat );
+       Matrix_Identity( py_bone->obmat );
+       Matrix_Identity( py_bone->parmat );
+       Matrix_Identity( py_bone->defmat );
+       Matrix_Identity( py_bone->irestmat );
+       Matrix_Identity( py_bone->posemat );
 
        //default tail of 2,0,0
        py_bone->tail->vec[0] = 2.0f;
@@ -594,734 +692,771 @@ M_Bone_New (PyObject * self, PyObject * args)
        //set the datapointer to null (unlinked)
        py_bone->bone = NULL;
 
-       return (PyObject *) py_bone;
+       return ( PyObject * ) py_bone;
 }
-//--------------- Python BPy_Bone methods------------------------------------------------------------------
-//--------------- BPy_Bone.getName()--------------------------------------------------------------------------
-static PyObject *
-Bone_getName (BPy_Bone * self)
+
+//--------------- Python BPy_Bone methods---------------------------
+
+//--------------- BPy_Bone.getName()--------------------------------
+static PyObject *Bone_getName( BPy_Bone * self )
 {
-  PyObject *attr = NULL;
-
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         attr = PyString_FromString (self->name);
-  }else{
-         //use bone datastruct
-      attr = PyString_FromString (self->bone->name);
-  }
-  if (attr)
-    return attr;
-
-  return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
-                                "couldn't get Bone.name attribute"));
+       PyObject *attr = NULL;
+
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               attr = PyString_FromString( self->name );
+       } else {
+               //use bone datastruct
+               attr = PyString_FromString( self->bone->name );
+       }
+       if( attr )
+               return attr;
+
+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                                       "couldn't get Bone.name attribute" ) );
 }
-//--------------- BPy_Bone.getRoll()------------------------------------------------------------------------------
-static PyObject *
-Bone_getRoll (BPy_Bone * self)
+
+//--------------- BPy_Bone.getRoll()---------------------------------
+static PyObject *Bone_getRoll( BPy_Bone * self )
 {
-  PyObject *attr = NULL;
-
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         attr = Py_BuildValue ("f", self->roll);
-  }else{
-         //use bone datastruct
-      attr = Py_BuildValue ("f", self->bone->roll);
-  }
-  if (attr)
-    return attr;
-
-  return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
-                                "couldn't get Bone.roll attribute"));
+       PyObject *attr = NULL;
+
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               attr = Py_BuildValue( "f", self->roll );
+       } else {
+               //use bone datastruct
+               attr = Py_BuildValue( "f", self->bone->roll );
+       }
+       if( attr )
+               return attr;
+
+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                                       "couldn't get Bone.roll attribute" ) );
 }
-//--------------- BPy_Bone.getWeight()----------------------------------------------------------------------------
-static PyObject *
-Bone_getWeight (BPy_Bone * self)
+
+//--------------- BPy_Bone.getWeight()---------------------------------
+static PyObject *Bone_getWeight( BPy_Bone * self )
 {
-  PyObject *attr = NULL;
-
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         attr = Py_BuildValue ("f", self->weight);
-  }else{
-         //use bone datastruct
-      attr = Py_BuildValue ("f", self->bone->weight);
-  }
-  if (attr)
-    return attr;
-
-  return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
-                                "couldn't get Bone.weight attribute"));
+       PyObject *attr = NULL;
+
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               attr = Py_BuildValue( "f", self->weight );
+       } else {
+               //use bone datastruct
+               attr = Py_BuildValue( "f", self->bone->weight );
+       }
+       if( attr )
+               return attr;
+
+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                                       "couldn't get Bone.weight attribute" ) );
 }
-//--------------- BPy_Bone.getHead()--------------------------------------------------------------------------
-static PyObject *
-Bone_getHead (BPy_Bone * self)
+
+//--------------- BPy_Bone.getHead()----------------------------------
+static PyObject *Bone_getHead( BPy_Bone * self )
 {
-  PyObject *attr = NULL;
-  float *vec;
-  int x;
-
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         vec = PyMem_Malloc(3 * sizeof(float));
-         for(x = 0; x < 3; x++)
-             vec[x] = self->head->vec[x];
-         attr =  (PyObject *)newVectorObject(vec, 3);
-  }else{
-         //use bone datastruct
-         attr = newVectorObject(PyMem_Malloc (3*sizeof (float)), 3);
-         ((VectorObject*)attr)->vec[0] = self->bone->head[0];
-         ((VectorObject*)attr)->vec[1] = self->bone->head[1];
-         ((VectorObject*)attr)->vec[2] = self->bone->head[2];
-  }
-  if (attr)
-    return attr;
-
-  return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
-                                "couldn't get Bone.head attribute"));
+       PyObject *attr = NULL;
+       float *vec;
+       int x;
+
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               vec = PyMem_Malloc( 3 * sizeof( float ) );
+               for( x = 0; x < 3; x++ )
+                       vec[x] = self->head->vec[x];
+               attr = ( PyObject * ) newVectorObject( vec, 3 );
+       } else {
+               //use bone datastruct
+               attr = newVectorObject( PyMem_Malloc( 3 * sizeof( float ) ),
+                                       3 );
+               ( ( VectorObject * ) attr )->vec[0] = self->bone->head[0];
+               ( ( VectorObject * ) attr )->vec[1] = self->bone->head[1];
+               ( ( VectorObject * ) attr )->vec[2] = self->bone->head[2];
+       }
+       if( attr )
+               return attr;
+
+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                                       "couldn't get Bone.head attribute" ) );
 }
-//--------------- BPy_Bone.getTail()--------------------------------------------------------------------------
-static PyObject *
-Bone_getTail (BPy_Bone * self)
+
+//--------------- BPy_Bone.getTail()---------------------------------
+static PyObject *Bone_getTail( BPy_Bone * self )
 {
-  PyObject *attr = NULL;
-  float *vec;
-  int x;
-
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         vec = PyMem_Malloc(3 * sizeof(float));
-         for(x = 0; x < 3; x++)
-             vec[x] = self->tail->vec[x];
-         attr =  (PyObject *)newVectorObject(vec, 3);
-  }else{
-         //use bone datastruct
-         attr = newVectorObject(PyMem_Malloc (3*sizeof (float)), 3);
-         ((VectorObject*)attr)->vec[0] = self->bone->tail[0];
-         ((VectorObject*)attr)->vec[1] = self->bone->tail[1];
-         ((VectorObject*)attr)->vec[2] = self->bone->tail[2];
-  }
-  if (attr)
-    return attr;
-
-  return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
-                                "couldn't get Bone.tail attribute"));
+       PyObject *attr = NULL;
+       float *vec;
+       int x;
+
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               vec = PyMem_Malloc( 3 * sizeof( float ) );
+               for( x = 0; x < 3; x++ )
+                       vec[x] = self->tail->vec[x];
+               attr = ( PyObject * ) newVectorObject( vec, 3 );
+       } else {
+               //use bone datastruct
+               attr = newVectorObject( PyMem_Malloc( 3 * sizeof( float ) ),
+                                       3 );
+               ( ( VectorObject * ) attr )->vec[0] = self->bone->tail[0];
+               ( ( VectorObject * ) attr )->vec[1] = self->bone->tail[1];
+               ( ( VectorObject * ) attr )->vec[2] = self->bone->tail[2];
+       }
+       if( attr )
+               return attr;
+
+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                                       "couldn't get Bone.tail attribute" ) );
 }
-//--------------- BPy_Bone.getLoc()----------------------------------------------------------------------------
-static PyObject *
-Bone_getLoc (BPy_Bone * self)
+
+//--------------- BPy_Bone.getLoc()---------------------------------
+static PyObject *Bone_getLoc( BPy_Bone * self )
 {
-  PyObject *attr = NULL;
-  float *vec;
-  int x;
-
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         vec = PyMem_Malloc(3 * sizeof(float));
-         for(x = 0; x < 3; x++)
-             vec[x] = self->loc->vec[x];
-         attr =  (PyObject *)newVectorObject(vec, 3);
-  }else{
-         //use bone datastruct
-         attr = newVectorObject(PyMem_Malloc (3*sizeof (float)), 3);
-         ((VectorObject*)attr)->vec[0] = self->bone->loc[0];
-         ((VectorObject*)attr)->vec[1] = self->bone->loc[1];
-         ((VectorObject*)attr)->vec[2] = self->bone->loc[2];
-  }
-  if (attr)
-    return attr;
-
-  return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
-                                "couldn't get Bone.loc attribute"));
+       PyObject *attr = NULL;
+       float *vec;
+       int x;
+
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               vec = PyMem_Malloc( 3 * sizeof( float ) );
+               for( x = 0; x < 3; x++ )
+                       vec[x] = self->loc->vec[x];
+               attr = ( PyObject * ) newVectorObject( vec, 3 );
+       } else {
+               //use bone datastruct
+               attr = newVectorObject( PyMem_Malloc( 3 * sizeof( float ) ),
+                                       3 );
+               ( ( VectorObject * ) attr )->vec[0] = self->bone->loc[0];
+               ( ( VectorObject * ) attr )->vec[1] = self->bone->loc[1];
+               ( ( VectorObject * ) attr )->vec[2] = self->bone->loc[2];
+       }
+       if( attr )
+               return attr;
+
+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                                       "couldn't get Bone.loc attribute" ) );
 }
-//--------------- BPy_Bone.getSize()----------------------------------------------------------------------------
-static PyObject *
-Bone_getSize (BPy_Bone * self)
+
+//--------------- BPy_Bone.getSize()-----------------------------
+static PyObject *Bone_getSize( BPy_Bone * self )
 {
-  PyObject *attr = NULL;
-  float *vec;
-  int x;
-
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         vec = PyMem_Malloc(3 * sizeof(float));
-         for(x = 0; x < 3; x++)
-             vec[x] = self->size->vec[x];
-         attr =  (PyObject *)newVectorObject(vec, 3);
-  }else{
-         //use bone datastruct
-         attr = newVectorObject(PyMem_Malloc (3*sizeof (float)), 3);
-         ((VectorObject*)attr)->vec[0] = self->bone->size[0];
-         ((VectorObject*)attr)->vec[1] = self->bone->size[1];
-         ((VectorObject*)attr)->vec[2] = self->bone->size[2];
-  }
-  if (attr)
-    return attr;
-
-  return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
-                                "couldn't get Bone.size attribute"));
+       PyObject *attr = NULL;
+       float *vec;
+       int x;
+
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               vec = PyMem_Malloc( 3 * sizeof( float ) );
+               for( x = 0; x < 3; x++ )
+                       vec[x] = self->size->vec[x];
+               attr = ( PyObject * ) newVectorObject( vec, 3 );
+       } else {
+               //use bone datastruct
+               attr = newVectorObject( PyMem_Malloc( 3 * sizeof( float ) ),
+                                       3 );
+               ( ( VectorObject * ) attr )->vec[0] = self->bone->size[0];
+               ( ( VectorObject * ) attr )->vec[1] = self->bone->size[1];
+               ( ( VectorObject * ) attr )->vec[2] = self->bone->size[2];
+       }
+       if( attr )
+               return attr;
+
+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                                       "couldn't get Bone.size attribute" ) );
 }
-//--------------- BPy_Bone.getQuat()----------------------------------------------------------------------------
-static PyObject *
-Bone_getQuat (BPy_Bone * self)
+
+//--------------- BPy_Bone.getQuat()--------------------------------
+static PyObject *Bone_getQuat( BPy_Bone * self )
 {
-  PyObject *attr = NULL;
-  float *quat;
-  int x;
-
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars - p.s. - you must return a copy or else
-         //python will trash the internal var
-         quat = PyMem_Malloc(4 * sizeof(float));
-         for(x = 0; x < 4; x++)
-             quat[x] = self->quat->quat[x];
-         attr =  (PyObject *)newQuaternionObject(quat);
-  }else{
-         //use bone datastruct
-         attr = newQuaternionObject(PyMem_Malloc (4*sizeof (float)));
-         ((QuaternionObject*)attr)->quat[0] = self->bone->quat[0];
-         ((QuaternionObject*)attr)->quat[1] = self->bone->quat[1];
-         ((QuaternionObject*)attr)->quat[2] = self->bone->quat[2];
-         ((QuaternionObject*)attr)->quat[3] = self->bone->quat[3];
-  }
-
-  return attr;
+       PyObject *attr = NULL;
+       float *quat;
+       int x;
+
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars - p.s. - you must return a copy or else
+               //python will trash the internal var
+               quat = PyMem_Malloc( 4 * sizeof( float ) );
+               for( x = 0; x < 4; x++ )
+                       quat[x] = self->quat->quat[x];
+               attr = ( PyObject * ) newQuaternionObject( quat );
+       } else {
+               //use bone datastruct
+               attr = newQuaternionObject( PyMem_Malloc
+                                           ( 4 * sizeof( float ) ) );
+               ( ( QuaternionObject * ) attr )->quat[0] = self->bone->quat[0];
+               ( ( QuaternionObject * ) attr )->quat[1] = self->bone->quat[1];
+               ( ( QuaternionObject * ) attr )->quat[2] = self->bone->quat[2];
+               ( ( QuaternionObject * ) attr )->quat[3] = self->bone->quat[3];
+       }
+
+       return attr;
 }
-//--------------- BPy_Bone.hasParent()--------------------------------------------------------------------------
-static PyObject *
-Bone_hasParent (BPy_Bone * self)
+
+//--------------- BPy_Bone.hasParent()---------------------------
+static PyObject *Bone_hasParent( BPy_Bone * self )
 {
-       char * parent_str = "";
+       char *parent_str = "";
 
-       if (!self->bone) {      //test to see if linked to armature
+       if( !self->bone ) {     //test to see if linked to armature
                //use python vars
-               if (BLI_streq(self->parent, parent_str)) {
-                               Py_INCREF (Py_False);
-                               return Py_False;
-               }else{
-                               Py_INCREF (Py_True);
-                               return Py_True;
+               if( BLI_streq( self->parent, parent_str ) ) {
+                       Py_INCREF( Py_False );
+                       return Py_False;
+               } else {
+                       Py_INCREF( Py_True );
+                       return Py_True;
                }
-       }else{
+       } else {
                //use bone datastruct
-               if (self->bone->parent) {
-                               Py_INCREF (Py_True);
-                               return Py_True;
-               }else{
-                               Py_INCREF (Py_False);
-                               return Py_False;
+               if( self->bone->parent ) {
+                       Py_INCREF( Py_True );
+                       return Py_True;
+               } else {
+                       Py_INCREF( Py_False );
+                       return Py_False;
                }
        }
 }
-//--------------- BPy_Bone.getParent()--------------------------------------------------------------------------
-static PyObject *
-Bone_getParent (BPy_Bone * self)
+
+//--------------- BPy_Bone.getParent()------------------------------
+static PyObject *Bone_getParent( BPy_Bone * self )
 {
-       char * parent_str = ""; 
-       if (!self->bone) {      //test to see if linked to armature
+       char *parent_str = "";
+       if( !self->bone ) {     //test to see if linked to armature
                //use python vars
-                       if (BLI_streq(self->parent, parent_str)) {
-                                       return EXPP_incr_ret  (Py_None);
-                       }else{
-                                       return PyString_FromString(self->parent);
-                       }
-       }else{
+               if( BLI_streq( self->parent, parent_str ) ) {
+                       return EXPP_incr_ret( Py_None );
+               } else {
+                       return PyString_FromString( self->parent );
+               }
+       } else {
                //use bone datastruct
-               if (self->bone->parent) {
-                               return Bone_CreatePyObject (self->bone->parent);
-               }else{
-                               return EXPP_incr_ret  (Py_None);
+               if( self->bone->parent ) {
+                       return Bone_CreatePyObject( self->bone->parent );
+               } else {
+                       return EXPP_incr_ret( Py_None );
                }
        }
 }
-//--------------- BPy_Bone.getChildren()--------------------------------------------------------------------------
-static PyObject *
-Bone_getChildren (BPy_Bone * self)
+
+//--------------- BPy_Bone.getChildren()-----------------------------
+static PyObject *Bone_getChildren( BPy_Bone * self )
 {
-  int totbones = 0;
-  Bone *current = NULL;
-  PyObject *listbones = NULL;
-  int i;
-
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-      return EXPP_incr_ret  (Py_None);
-  }else{
-         //use bone datastruct
-         current = self->bone->childbase.first;
-         for (; current; current = current->next)
-               totbones++;
-
-         /* Create a list with a bone wrapper for each bone */
-         current = self->bone->childbase.first;
-         listbones = PyList_New (totbones);
-         for (i = 0; i < totbones; i++){
-                 assert (current);
-                 PyList_SetItem (listbones, i, Bone_CreatePyObject (current));
-                 current = current->next;
-         }
-         return listbones;
-  }
+       int totbones = 0;
+       Bone *current = NULL;
+       PyObject *listbones = NULL;
+       int i;
+
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               return EXPP_incr_ret( Py_None );
+       } else {
+               //use bone datastruct
+               current = self->bone->childbase.first;
+               for( ; current; current = current->next )
+                       totbones++;
+
+               /* Create a list with a bone wrapper for each bone */
+               current = self->bone->childbase.first;
+               listbones = PyList_New( totbones );
+               for( i = 0; i < totbones; i++ ) {
+                       assert( current );
+                       PyList_SetItem( listbones, i,
+                                       Bone_CreatePyObject( current ) );
+                       current = current->next;
+               }
+               return listbones;
+       }
 }
-//--------------- BPy_Bone.setName()--------------------------------------------------------------------------
-static PyObject *
-Bone_setName (BPy_Bone * self, PyObject * args)
+
+//--------------- BPy_Bone.setName()---------------------------------
+static PyObject *Bone_setName( BPy_Bone * self, PyObject * args )
 {
-  char *name;
-
-  if (!PyArg_ParseTuple (args, "s", &name))
-               return (EXPP_ReturnPyObjError (PyExc_AttributeError,    "expected string argument"));
-
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         BLI_strncpy(self->name, name, strlen(name) + 1);
-  }else{
-         //use bone datastruct
-         BLI_strncpy(self->bone->name, name, strlen(name) + 1);
-  }
-  return EXPP_incr_ret  (Py_None);
+       char *name;
+
+       if( !PyArg_ParseTuple( args, "s", &name ) )
+               return ( EXPP_ReturnPyObjError
+                        ( PyExc_AttributeError,
+                          "expected string argument" ) );
+
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               BLI_strncpy( self->name, name, strlen( name ) + 1 );
+       } else {
+               //use bone datastruct
+               BLI_strncpy( self->bone->name, name, strlen( name ) + 1 );
+       }
+       return EXPP_incr_ret( Py_None );
 }
-//--------------- BPy_Bone.setRoll()--------------------------------------------------------------------------
-PyObject *
-Bone_setRoll (BPy_Bone * self, PyObject * args)
+
+//--------------- BPy_Bone.setRoll()--------------------------------
+PyObject *Bone_setRoll( BPy_Bone * self, PyObject * args )
 {
-  float roll;
-
-  if (!PyArg_ParseTuple (args, "f", &roll))
-    return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                  "expected float argument"));
-
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         self->roll = roll;
-  }else{
-         //use bone datastruct
-      self->bone->roll = roll;
-  }
-  return EXPP_incr_ret  (Py_None);
+       float roll;
+
+       if( !PyArg_ParseTuple( args, "f", &roll ) )
+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                               "expected float argument" ) );
+
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               self->roll = roll;
+       } else {
+               //use bone datastruct
+               self->bone->roll = roll;
+       }
+       return EXPP_incr_ret( Py_None );
 }
-//--------------- BPy_Bone.setHead()--------------------------------------------------------------------------
-static PyObject *
-Bone_setHead (BPy_Bone * self, PyObject * args)
+
+//--------------- BPy_Bone.setHead()---------------------------------
+static PyObject *Bone_setHead( BPy_Bone * self, PyObject * args )
 {
-  float f1, f2, f3;
-  int status;
+       float f1, f2, f3;
+       int status;
 
-  if (PyObject_Length (args) == 3)
-    status = PyArg_ParseTuple (args, "fff", &f1, &f2, &f3);
-  else
-    status = PyArg_ParseTuple (args, "(fff)", &f1, &f2, &f3);
+       if( PyObject_Length( args ) == 3 )
+               status = PyArg_ParseTuple( args, "fff", &f1, &f2, &f3 );
+       else
+               status = PyArg_ParseTuple( args, "(fff)", &f1, &f2, &f3 );
 
-  if (!status)
-    return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                  "expected 3 (or a list of 3) float arguments"));
+       if( !status )
+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                               "expected 3 (or a list of 3) float arguments" ) );
 
-  if (!self->bone) {   //test to see if linked to armature
+       if( !self->bone ) {     //test to see if linked to armature
                //use python vars
                self->head->vec[0] = f1;
                self->head->vec[1] = f2;
                self->head->vec[2] = f3;
-  }else{
+       } else {
                //use bone datastruct
                self->bone->head[0] = f1;
                self->bone->head[1] = f2;
                self->bone->head[2] = f3;
-  }
-  return EXPP_incr_ret  (Py_None);
-}
-//--------------- BPy_Bone.setTail()--------------------------------------------------------------------------
-static PyObject *
-Bone_setTail (BPy_Bone * self, PyObject * args)
-{
-  float f1, f2, f3;
-  int status;
-
-  if (PyObject_Length (args) == 3)
-    status = PyArg_ParseTuple (args, "fff", &f1, &f2, &f3);
-  else
-    status = PyArg_ParseTuple (args, "(fff)", &f1, &f2, &f3);
-
-  if (!status)
-    return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                  "expected 3 (or a list of 3) float arguments"));
-
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         self->tail->vec[0] = f1;
-         self->tail->vec[1] = f2;
-         self->tail->vec[2] = f3;
-  }else{
-         //use bone datastruct
-        self->bone->tail[0] = f1;
-        self->bone->tail[1] = f2;
-        self->bone->tail[2] = f3;
-  }
-  return EXPP_incr_ret  (Py_None);
+       }
+       return EXPP_incr_ret( Py_None );
 }
-//--------------- BPy_Bone.setLoc()--------------------------------------------------------------------------
-static PyObject *
-Bone_setLoc (BPy_Bone * self, PyObject * args)
+
+//--------------- BPy_Bone.setTail()---------------------------------
+static PyObject *Bone_setTail( BPy_Bone * self, PyObject * args )
 {
-  float f1, f2, f3;
-  int status;
-
-  if (PyObject_Length (args) == 3)
-    status = PyArg_ParseTuple (args, "fff", &f1, &f2, &f3);
-  else
-    status = PyArg_ParseTuple (args, "(fff)", &f1, &f2, &f3);
-
-  if (!status)
-    return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                  "expected 3 (or a list of 3) float arguments"));
-
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         self->loc->vec[0] = f1;
-         self->loc->vec[1] = f2;
-         self->loc->vec[2] = f3;
-  }else{
-         //use bone datastruct
-        self->bone->loc[0] = f1;
-        self->bone->loc[1] = f2;
-        self->bone->loc[2] = f3;
-  }
-  return EXPP_incr_ret  (Py_None);
+       float f1, f2, f3;
+       int status;
+
+       if( PyObject_Length( args ) == 3 )
+               status = PyArg_ParseTuple( args, "fff", &f1, &f2, &f3 );
+       else
+               status = PyArg_ParseTuple( args, "(fff)", &f1, &f2, &f3 );
+
+       if( !status )
+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                               "expected 3 (or a list of 3) float arguments" ) );
+
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               self->tail->vec[0] = f1;
+               self->tail->vec[1] = f2;
+               self->tail->vec[2] = f3;
+       } else {
+               //use bone datastruct
+               self->bone->tail[0] = f1;
+               self->bone->tail[1] = f2;
+               self->bone->tail[2] = f3;
+       }
+       return EXPP_incr_ret( Py_None );
 }
-//--------------- BPy_Bone.setSize()--------------------------------------------------------------------------
-static PyObject *
-Bone_setSize (BPy_Bone * self, PyObject * args)
+
+//--------------- BPy_Bone.setLoc()----------------------------------
+static PyObject *Bone_setLoc( BPy_Bone * self, PyObject * args )
 {
-  float f1, f2, f3;
-  int status;
-
-  if (PyObject_Length (args) == 3)
-    status = PyArg_ParseTuple (args, "fff", &f1, &f2, &f3);
-  else
-    status = PyArg_ParseTuple (args, "(fff)", &f1, &f2, &f3);
-
-  if (!status)
-    return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                  "expected 3 (or a list of 3) float arguments"));
-
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         self->size->vec[0] = f1;
-         self->size->vec[1] = f2;
-         self->size->vec[2] = f3;
-  }else{
-         //use bone datastruct
-        self->bone->size[0] = f1;
-        self->bone->size[1] = f2;
-        self->bone->size[2] = f3;
-  }
-   return EXPP_incr_ret  (Py_None);
+       float f1, f2, f3;
+       int status;
+
+       if( PyObject_Length( args ) == 3 )
+               status = PyArg_ParseTuple( args, "fff", &f1, &f2, &f3 );
+       else
+               status = PyArg_ParseTuple( args, "(fff)", &f1, &f2, &f3 );
+
+       if( !status )
+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                               "expected 3 (or a list of 3) float arguments" ) );
+
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               self->loc->vec[0] = f1;
+               self->loc->vec[1] = f2;
+               self->loc->vec[2] = f3;
+       } else {
+               //use bone datastruct
+               self->bone->loc[0] = f1;
+               self->bone->loc[1] = f2;
+               self->bone->loc[2] = f3;
+       }
+       return EXPP_incr_ret( Py_None );
 }
-//--------------- BPy_Bone.setQuat()--------------------------------------------------------------------------
-static PyObject *
-Bone_setQuat (BPy_Bone * self, PyObject * args)
+
+//--------------- BPy_Bone.setSize()---------------------------------
+static PyObject *Bone_setSize( BPy_Bone * self, PyObject * args )
 {
-  float f1, f2, f3, f4;
-  PyObject *argument;
-  QuaternionObject *quatOb;
-  int status;
+       float f1, f2, f3;
+       int status;
+
+       if( PyObject_Length( args ) == 3 )
+               status = PyArg_ParseTuple( args, "fff", &f1, &f2, &f3 );
+       else
+               status = PyArg_ParseTuple( args, "(fff)", &f1, &f2, &f3 );
 
-   if (!PyArg_ParseTuple(args, "O", &argument))
-       return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected quaternion or float list"));
+       if( !status )
+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                               "expected 3 (or a list of 3) float arguments" ) );
+
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               self->size->vec[0] = f1;
+               self->size->vec[1] = f2;
+               self->size->vec[2] = f3;
+       } else {
+               //use bone datastruct
+               self->bone->size[0] = f1;
+               self->bone->size[1] = f2;
+               self->bone->size[2] = f3;
+       }
+       return EXPP_incr_ret( Py_None );
+}
 
-   if(QuaternionObject_Check(argument)){
-               status = PyArg_ParseTuple(args, "O!", &quaternion_Type, &quatOb);
+//--------------- BPy_Bone.setQuat()-------------------------------
+static PyObject *Bone_setQuat( BPy_Bone * self, PyObject * args )
+{
+       float f1, f2, f3, f4;
+       PyObject *argument;
+       QuaternionObject *quatOb;
+       int status;
+
+       if( !PyArg_ParseTuple( args, "O", &argument ) )
+               return ( EXPP_ReturnPyObjError
+                        ( PyExc_TypeError,
+                          "expected quaternion or float list" ) );
+
+       if( QuaternionObject_Check( argument ) ) {
+               status = PyArg_ParseTuple( args, "O!", &quaternion_Type,
+                                          &quatOb );
                f1 = quatOb->quat[0];
                f2 = quatOb->quat[1];
                f3 = quatOb->quat[2];
                f4 = quatOb->quat[3];
-   }else{
-               status = PyArg_ParseTuple (args, "(ffff)", &f1, &f2, &f3, &f4);
-   }
-
-  if (!status)
-    return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                  "unable to parse argument"));
-
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         self->quat->quat[0] = f1;
-         self->quat->quat[1] = f2;
-         self->quat->quat[2] = f3;
-         self->quat->quat[3] = f4;
-  }else{
-         //use bone datastruct
-        self->bone->quat[0] = f1;
-        self->bone->quat[1] = f2;
-        self->bone->quat[2] = f3;
-        self->bone->quat[3] = f4;
-  }
-  return EXPP_incr_ret  (Py_None);
+       } else {
+               status = PyArg_ParseTuple( args, "(ffff)", &f1, &f2, &f3,
+                                          &f4 );
+       }
+
+       if( !status )
+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                               "unable to parse argument" ) );
+
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               self->quat->quat[0] = f1;
+               self->quat->quat[1] = f2;
+               self->quat->quat[2] = f3;
+               self->quat->quat[3] = f4;
+       } else {
+               //use bone datastruct
+               self->bone->quat[0] = f1;
+               self->bone->quat[1] = f2;
+               self->bone->quat[2] = f3;
+               self->bone->quat[3] = f4;
+       }
+       return EXPP_incr_ret( Py_None );
 }
-//--------------- BPy_Bone.setParent()-------------------------------------------------------------------------
-static PyObject *
-Bone_setParent(BPy_Bone *self, PyObject *args)
+
+//--------------- BPy_Bone.setParent()------------------------------
+static PyObject *Bone_setParent( BPy_Bone * self, PyObject * args )
 {
-       BPy_Bonepy_bone;
+       BPy_Bone *py_bone;
        float M_boneObjectspace[4][4];
        float iM_parentRest[4][4];
 
-       if (!PyArg_ParseTuple(args, "O", &py_bone))
-                       return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected bone object argument"));
+       if( !PyArg_ParseTuple( args, "O", &py_bone ) )
+               return ( EXPP_ReturnPyObjError
+                        ( PyExc_TypeError,
+                          "expected bone object argument" ) );
 
-       if (!self->bone) {      //test to see if linked to armature
+       if( !self->bone ) {     //test to see if linked to armature
                //use python vars
-               BLI_strncpy(self->parent, py_bone->name, strlen(py_bone->name) + 1);
-       }else{
+               BLI_strncpy( self->parent, py_bone->name,
+                            strlen( py_bone->name ) + 1 );
+       } else {
                //use bone datastruct
-               if(!py_bone->bone)
-                               return (EXPP_ReturnPyObjError (PyExc_TypeError, "Parent bone must be linked to armature first!"));
+               if( !py_bone->bone )
+                       return ( EXPP_ReturnPyObjError
+                                ( PyExc_TypeError,
+                                  "Parent bone must be linked to armature first!" ) );
 
-               if(py_bone->bone == self->bone)
-                       return (EXPP_ReturnPyObjError (PyExc_AttributeError, "Cannot parent to self"));
+               if( py_bone->bone == self->bone )
+                       return ( EXPP_ReturnPyObjError
+                                ( PyExc_AttributeError,
+                                  "Cannot parent to self" ) );
 
                //test to see if were creating an illegal loop by parenting to child
-               if(testChildbase(self->bone, py_bone->bone))
-                       return (EXPP_ReturnPyObjError (PyExc_AttributeError, "Cannot parent to child"));
+               if( testChildbase( self->bone, py_bone->bone ) )
+                       return ( EXPP_ReturnPyObjError
+                                ( PyExc_AttributeError,
+                                  "Cannot parent to child" ) );
 
-               //set the parent of self - in this case we are changing the parenting after this bone
+               //set the parent of self - in this case 
+                //we are changing the parenting after this bone
                //has been linked in it's armature
-               if(self->bone->parent){  //we are parenting something previously parented
+               if( self->bone->parent ) {      //we are parenting something previously parented
 
                        //remove the childbase link from the parent bone
-                       BLI_remlink(&self->bone->parent->childbase, self->bone);
+                       BLI_remlink( &self->bone->parent->childbase,
+                                    self->bone );
 
                        //now get rid of the parent transformation
-                       get_objectspace_bone_matrix(self->bone->parent, M_boneObjectspace, 0,0);
-                       Mat4MulVecfl(M_boneObjectspace, self->bone->head);
-                       Mat4MulVecfl(M_boneObjectspace, self->bone->tail);
-                       
+                       get_objectspace_bone_matrix( self->bone->parent,
+                                                    M_boneObjectspace, 0, 0 );
+                       Mat4MulVecfl( M_boneObjectspace, self->bone->head );
+                       Mat4MulVecfl( M_boneObjectspace, self->bone->tail );
+
                        //add to the childbase of new parent
-                       BLI_addtail (&py_bone->bone->childbase, self->bone);
+                       BLI_addtail( &py_bone->bone->childbase, self->bone );
 
                        //transform bone according to new parent
-                       get_objectspace_bone_matrix(py_bone->bone, M_boneObjectspace, 0,0);
-                       Mat4Invert (iM_parentRest, M_boneObjectspace);
-                       Mat4MulVecfl(iM_parentRest, self->bone->head);
-                       Mat4MulVecfl(iM_parentRest, self->bone->tail);
+                       get_objectspace_bone_matrix( py_bone->bone,
+                                                    M_boneObjectspace, 0, 0 );
+                       Mat4Invert( iM_parentRest, M_boneObjectspace );
+                       Mat4MulVecfl( iM_parentRest, self->bone->head );
+                       Mat4MulVecfl( iM_parentRest, self->bone->tail );
 
                        //set parent
                        self->bone->parent = py_bone->bone;
 
-               }else{  //not previously parented
+               } else {        //not previously parented
 
                        //add to the childbase of new parent
-                       BLI_addtail (&py_bone->bone->childbase, self->bone);
+                       BLI_addtail( &py_bone->bone->childbase, self->bone );
 
                        //transform bone according to new parent
-                       get_objectspace_bone_matrix(py_bone->bone, M_boneObjectspace, 0,0);
-                       Mat4Invert (iM_parentRest, M_boneObjectspace);
-                       Mat4MulVecfl(iM_parentRest, self->bone->head);
-                       Mat4MulVecfl(iM_parentRest, self->bone->tail);
+                       get_objectspace_bone_matrix( py_bone->bone,
+                                                    M_boneObjectspace, 0, 0 );
+                       Mat4Invert( iM_parentRest, M_boneObjectspace );
+                       Mat4MulVecfl( iM_parentRest, self->bone->head );
+                       Mat4MulVecfl( iM_parentRest, self->bone->tail );
 
                        self->bone->parent = py_bone->bone;
                }
        }
-       return EXPP_incr_ret  (Py_None);
+       return EXPP_incr_ret( Py_None );
 }
-//--------------- BPy_Bone.setWeight()-------------------------------------------------------------------------
-static PyObject *
-Bone_setWeight(BPy_Bone *self, PyObject *args)
+
+//--------------- BPy_Bone.setWeight()----------------------------
+static PyObject *Bone_setWeight( BPy_Bone * self, PyObject * args )
 {
-  float weight;
-
-  if (!PyArg_ParseTuple (args, "f", &weight))
-    return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                  "expected float argument"));
-
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         self->weight = weight;
-  }else{
-         //use bone datastruct
-        self->bone->weight = weight;
-  }  
-  return EXPP_incr_ret  (Py_None);
+       float weight;
+
+       if( !PyArg_ParseTuple( args, "f", &weight ) )
+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                               "expected float argument" ) );
+
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               self->weight = weight;
+       } else {
+               //use bone datastruct
+               self->bone->weight = weight;
+       }
+       return EXPP_incr_ret( Py_None );
 }
-//--------------- BPy_Bone.clearParent()-------------------------------------------------------------------------
-static PyObject *
-Bone_clearParent(BPy_Bone *self)
+
+//--------------- BPy_Bone.clearParent()--------------------------
+static PyObject *Bone_clearParent( BPy_Bone * self )
 {
-  bArmature *arm = NULL;
-  Bone *bone = NULL;
-  Bone *parent = NULL;
-  Bone *child = NULL;
-  Bone *childPrev = NULL;
-  int firstChild;
-  float M_boneObjectspace[4][4];
-  char *parent_str = "";
-
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-        BLI_strncpy(self->parent, parent_str, strlen(parent_str) + 1);
-  }else{
-        //use bone datastruct
-       if(self->bone->parent == NULL)
-               return EXPP_incr_ret(Py_None);
-
-       //get parent and remove link
-       parent = self->bone->parent;
-       self->bone->parent = NULL;
-
-       //remove the childbase link from the parent bone
-       firstChild = 1;
-       for(child = parent->childbase.first; child; child = child->next){       
-               if(child == self->bone && firstChild){
+       bArmature *arm = NULL;
+       Bone *bone = NULL;
+       Bone *parent = NULL;
+       Bone *child = NULL;
+       Bone *childPrev = NULL;
+       int firstChild;
+       float M_boneObjectspace[4][4];
+       char *parent_str = "";
+
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               BLI_strncpy( self->parent, parent_str,
+                            strlen( parent_str ) + 1 );
+       } else {
+               //use bone datastruct
+               if( self->bone->parent == NULL )
+                       return EXPP_incr_ret( Py_None );
+
+               //get parent and remove link
+               parent = self->bone->parent;
+               self->bone->parent = NULL;
+
+               //remove the childbase link from the parent bone
+               firstChild = 1;
+               for( child = parent->childbase.first; child;
+                    child = child->next ) {
+                       if( child == self->bone && firstChild ) {
                                parent->childbase.first = child->next;
                                child->next = NULL;
                                break;
+                       }
+                       if( child == self->bone && !firstChild ) {
+                               childPrev->next = child->next;
+                               child->next = NULL;
+                               break;
+                       }
+                       firstChild = 0;
+                       childPrev = child;
                }
-               if(child == self->bone && !firstChild){
-                       childPrev->next = child->next;
-                       child->next = NULL;
-                       break;
-               }
-               firstChild = 0;
-               childPrev = child;
-       }
 
-       //now get rid of the parent transformation
-       get_objectspace_bone_matrix(parent, M_boneObjectspace, 0,0);
+               //now get rid of the parent transformation
+               get_objectspace_bone_matrix( parent, M_boneObjectspace, 0, 0 );
 
-       //transformation of local bone
-       Mat4MulVecfl(M_boneObjectspace, self->bone->head);
-       Mat4MulVecfl(M_boneObjectspace, self->bone->tail);
+               //transformation of local bone
+               Mat4MulVecfl( M_boneObjectspace, self->bone->head );
+               Mat4MulVecfl( M_boneObjectspace, self->bone->tail );
 
-       //get the root bone
-       while(parent->parent != NULL){
-               parent = parent->parent;
-       }
+               //get the root bone
+               while( parent->parent != NULL ) {
+                       parent = parent->parent;
+               }
 
-       //add unlinked bone to the bonebase of the armature
-       for (arm = G.main->armature.first; arm; arm= arm->id.next) {
-               for(bone = arm->bonebase.first; bone; bone = bone->next){
-                       if(parent == bone){
-                               //we found the correct armature - now add it as root bone
-                               BLI_addtail (&arm->bonebase, self->bone);
-                               break;
+               //add unlinked bone to the bonebase of the armature
+               for( arm = G.main->armature.first; arm; arm = arm->id.next ) {
+                       for( bone = arm->bonebase.first; bone;
+                            bone = bone->next ) {
+                               if( parent == bone ) {
+                                       //we found the correct armature - now add it as root bone
+                                       BLI_addtail( &arm->bonebase,
+                                                    self->bone );
+                                       break;
+                               }
                        }
-               }                       
+               }
        }
-  }  
-  return EXPP_incr_ret  (Py_None);
+       return EXPP_incr_ret( Py_None );
 }
-//--------------- BPy_Bone.clearChildren()-------------------------------------------------------------------------
-static PyObject *
-Bone_clearChildren(BPy_Bone *self)
-{ 
-  Bone *root = NULL;
-  Bone *child = NULL;
-  bArmature *arm = NULL;
-  Bone *bone = NULL;
-  Bone *prev = NULL;
-  Bone *next = NULL;
-  float M_boneObjectspace[4][4];
-  int first;
-
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         return EXPP_incr_ret  (Py_None);
-  }else{
-        //use bone datastruct
-       if(self->bone->childbase.first == NULL)
-               return EXPP_incr_ret(Py_None);
+
+//--------------- BPy_Bone.clearChildren()------------------------
+static PyObject *Bone_clearChildren( BPy_Bone * self )
+{
+       Bone *root = NULL;
+       Bone *child = NULL;
+       bArmature *arm = NULL;
+       Bone *bone = NULL;
+       Bone *prev = NULL;
+       Bone *next = NULL;
+       float M_boneObjectspace[4][4];
+       int first;
+
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               return EXPP_incr_ret( Py_None );
+       } else {
+               //use bone datastruct
+               if( self->bone->childbase.first == NULL )
+                       return EXPP_incr_ret( Py_None );
 
                //is this bone a part of an armature....
                //get root bone for testing
                root = self->bone->parent;
-               if(root != NULL){
-                       while (root->parent != NULL){
+               if( root != NULL ) {
+                       while( root->parent != NULL ) {
                                root = root->parent;
                        }
-               }else{
+               } else {
                        root = self->bone;
                }
                //test armatures for root bone
-               for(arm= G.main->armature.first; arm; arm  = arm->id.next){
-                       for(bone = arm->bonebase.first; bone; bone = bone->next){
-                               if(bone == root)
+               for( arm = G.main->armature.first; arm; arm = arm->id.next ) {
+                       for( bone = arm->bonebase.first; bone;
+                            bone = bone->next ) {
+                               if( bone == root )
                                        break;
                        }
-                       if(bone == root)
+                       if( bone == root )
                                break;
                }
 
-       if(arm == NULL)
-               return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "couldn't find armature that contains this bone"));
-
-       //now get rid of the parent transformation
-       get_objectspace_bone_matrix(self->bone, M_boneObjectspace, 0,0);
-
-       //set children as root
-       first = 1;
-       for(child = self->bone->childbase.first; child; child = next){
-               //undo transformation of local bone
-               Mat4MulVecfl(M_boneObjectspace, child->head);
-               Mat4MulVecfl(M_boneObjectspace, child->tail);
-
-               //set next pointers to NULL
-               if(first){
-                       prev = child;
-                       first = 0;
-               }else{
-                       prev->next = NULL;
-                       prev = child;
-               }
-               next = child->next;
+               if( arm == NULL )
+                       return ( EXPP_ReturnPyObjError
+                                ( PyExc_RuntimeError,
+                                  "couldn't find armature that contains this bone" ) );
+
+               //now get rid of the parent transformation
+               get_objectspace_bone_matrix( self->bone, M_boneObjectspace, 0,
+                                            0 );
+
+               //set children as root
+               first = 1;
+               for( child = self->bone->childbase.first; child; child = next ) {
+                       //undo transformation of local bone
+                       Mat4MulVecfl( M_boneObjectspace, child->head );
+                       Mat4MulVecfl( M_boneObjectspace, child->tail );
+
+                       //set next pointers to NULL
+                       if( first ) {
+                               prev = child;
+                               first = 0;
+                       } else {
+                               prev->next = NULL;
+                               prev = child;
+                       }
+                       next = child->next;
 
-               //remove parenting and linking
-               child->parent = NULL;
-               BLI_remlink(&self->bone->childbase, child);
+                       //remove parenting and linking
+                       child->parent = NULL;
+                       BLI_remlink( &self->bone->childbase, child );
 
-               //add as root
-               BLI_addtail (&arm->bonebase, child);
+                       //add as root
+                       BLI_addtail( &arm->bonebase, child );
+               }
        }
-  }
-  Py_INCREF(Py_None);
-  return Py_None;
+       Py_INCREF( Py_None );
+       return Py_None;
 }
-//--------------- BPy_Bone.hide()---------------------------------------------------------------------------------
-static PyObject *
-Bone_hide(BPy_Bone *self)
+
+//--------------- BPy_Bone.hide()-----------------------------------
+static PyObject *Bone_hide( BPy_Bone * self )
 {
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         return EXPP_ReturnPyObjError (PyExc_TypeError, "link bone to armature before attempting to hide/unhide");
-  }else{
-          //use bone datastruct
-               if(!(self->bone->flag & BONE_HIDDEN))
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               return EXPP_ReturnPyObjError( PyExc_TypeError,
+                                             "link bone to armature before attempting to hide/unhide" );
+       } else {
+               //use bone datastruct
+               if( !( self->bone->flag & BONE_HIDDEN ) )
                        self->bone->flag |= BONE_HIDDEN;
-  }
-  return EXPP_incr_ret  (Py_None);
+       }
+       return EXPP_incr_ret( Py_None );
 }
-//--------------- BPy_Bone.unhide()---------------------------------------------------------------------------------
-static PyObject *
-Bone_unhide(BPy_Bone *self)
+
+//--------------- BPy_Bone.unhide()-------------------------------
+static PyObject *Bone_unhide( BPy_Bone * self )
 {
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         return EXPP_ReturnPyObjError (PyExc_TypeError, "link bone to armature before attempting to hide/unhide");
-  }else{
-        //use bone datastruct
-       if(self->bone->flag & BONE_HIDDEN)
-               self->bone->flag &= ~BONE_HIDDEN;
-  }
-  return EXPP_incr_ret  (Py_None);
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               return EXPP_ReturnPyObjError( PyExc_TypeError,
+                                             "link bone to armature before attempting to hide/unhide" );
+       } else {
+               //use bone datastruct
+               if( self->bone->flag & BONE_HIDDEN )
+                       self->bone->flag &= ~BONE_HIDDEN;
+       }
+       return EXPP_incr_ret( Py_None );
 }
-//--------------- BPy_Bone.setPose()-----------------------------------------------------------------------------------
-static PyObject *
-Bone_setPose (BPy_Bone *self, PyObject *args)
+
+//--------------- BPy_Bone.setPose()-------------------------------
+static PyObject *Bone_setPose( BPy_Bone * self, PyObject * args )
 {
        Bone *root = NULL;
        bPoseChannel *chan = NULL;
        bPoseChannel *setChan = NULL;
        bPoseChannel *test = NULL;
-       Object *object =NULL;
+       Object *object = NULL;
        bArmature *arm = NULL;
        Bone *bone = NULL;
        PyObject *flaglist = NULL;
@@ -1331,230 +1466,253 @@ Bone_setPose (BPy_Bone *self, PyObject *args)
        int flagValue = 0;
        int makeCurve = 1;
 
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         return EXPP_ReturnPyObjError (PyExc_TypeError, "cannot set pose unless bone is linked to armature");
-  }else{
-        //use bone datastruct
-        if (!PyArg_ParseTuple (args, "O!|O!", &PyList_Type, &flaglist, &Action_Type, &py_action))
-                       return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                                                                                                       "expected list of flags and optional action"));
-
-        for(x = 0; x <  PyList_Size(flaglist); x++){
-               item = PyList_GetItem(flaglist, x); 
-               if(PyInt_Check(item)){
-                       flagValue |= PyInt_AsLong(item);
-               }else{
-                       return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                                       "expected list of flags (ints)"));
-               }
-        }
-
-        //is this bone a part of an armature....
-        //get root bone for testing
-        root = self->bone->parent;
-        if(root != NULL){
-               while (root->parent != NULL){
-                       root = root->parent;
-               }
-        }else{
-               root = self->bone;
-        }
-        //test armatures for root bone
-        for(arm= G.main->armature.first; arm; arm  = arm->id.next){
-               for(bone = arm->bonebase.first; bone; bone = bone->next){
-                       if(bone == root)
-                               break;
-               }
-               if(bone == root)
-                       break;
-        }
-        if(arm == NULL)
-               return (EXPP_ReturnPyObjError (PyExc_RuntimeError, 
-                       "bone must belong to an armature to set it's pose!"));
-
-        //find if armature is object linked....
-        for(object = G.main->object.first; object; object  = object->id.next){
-               if(object->data == arm){
-                       break;
-               }
-        }
-
-        if(object == NULL)
-               return (EXPP_ReturnPyObjError (PyExc_RuntimeError, 
-                       "armature must be linked to an object to set a pose!"));
-
-        //set the active action as this one
-        if(py_action !=NULL){
-               if(py_action->action != NULL){
-                       object->action = py_action->action;
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               return EXPP_ReturnPyObjError( PyExc_TypeError,
+                                             "cannot set pose unless bone is linked to armature" );
+       } else {
+               //use bone datastruct
+               if( !PyArg_ParseTuple
+                   ( args, "O!|O!", &PyList_Type, &flaglist, &Action_Type,
+                     &py_action ) )
+                       return ( EXPP_ReturnPyObjError
+                                ( PyExc_AttributeError,
+                                  "expected list of flags and optional action" ) );
+
+               for( x = 0; x < PyList_Size( flaglist ); x++ ) {
+                       item = PyList_GetItem( flaglist, x );
+                       if( PyInt_Check( item ) ) {
+                               flagValue |= PyInt_AsLong( item );
+                       } else {
+                               return ( EXPP_ReturnPyObjError
+                                        ( PyExc_AttributeError,
+                                          "expected list of flags (ints)" ) );
+                       }
+               }
+
+               //is this bone a part of an armature....
+               //get root bone for testing
+               root = self->bone->parent;
+               if( root != NULL ) {
+                       while( root->parent != NULL ) {
+                               root = root->parent;
+                       }
+               } else {
+                       root = self->bone;
                }
-        }
-
-        //if object doesn't have a pose create one
-        if (!object->pose) 
-               object->pose = MEM_callocN(sizeof(bPose), "Pose");
-
-        //if bone does have a channel create one
-        verify_pose_channel(object->pose, self->bone->name);
-        //create temp Pose Channel
-        chan = MEM_callocN(sizeof(bPoseChannel), "PoseChannel");
-        //set the variables for this pose
-        memcpy (chan->loc, self->bone->loc, sizeof (chan->loc));
-        memcpy (chan->quat, self->bone->quat, sizeof (chan->quat));
-        memcpy (chan->size, self->bone->size, sizeof (chan->size));
-        strcpy (chan->name, self->bone->name);
-        chan->flag |= flagValue;
-        //set it to the channel
-        setChan = set_pose_channel(object->pose, chan);
-        //frees unlinked pose/bone channels from object
-        collect_pose_garbage(object);
-
-        //create an action if one not already assigned to object
-        if (!py_action && !object->action){
-               object->action = (bAction*)add_empty_action();
-               object->ipowin= ID_AC;
-        }else{
-               //test if posechannel is already in action
-               for(test = object->action->chanbase.first; test; test = test->next){
-                       if(test == setChan)
-                               makeCurve = 0; //already there
+               //test armatures for root bone
+               for( arm = G.main->armature.first; arm; arm = arm->id.next ) {
+                       for( bone = arm->bonebase.first; bone;
+                            bone = bone->next ) {
+                               if( bone == root )
+                                       break;
+                       }
+                       if( bone == root )
+                               break;
+               }
+               if( arm == NULL )
+                       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                                                       "bone must belong to an armature to set it's pose!" ) );
+
+               //find if armature is object linked....
+               for( object = G.main->object.first; object;
+                    object = object->id.next ) {
+                       if( object->data == arm ) {
+                               break;
+                       }
                }
-        }
-
-       //set action keys
-        if (setChan->flag & POSE_ROT){
-               set_action_key(object->action, setChan, AC_QUAT_X, makeCurve);
-               set_action_key(object->action, setChan, AC_QUAT_Y, makeCurve);
-               set_action_key(object->action, setChan, AC_QUAT_Z, makeCurve);
-               set_action_key(object->action, setChan, AC_QUAT_W, makeCurve);
-        }
-        if (setChan->flag & POSE_SIZE){
-               set_action_key(object->action, setChan, AC_SIZE_X, makeCurve);
-               set_action_key(object->action, setChan, AC_SIZE_Y, makeCurve);
-               set_action_key(object->action, setChan, AC_SIZE_Z, makeCurve);
-        }
-        if (setChan->flag & POSE_LOC){
-               set_action_key(object->action, setChan, AC_LOC_X, makeCurve);
-               set_action_key(object->action, setChan, AC_LOC_Y, makeCurve);
-               set_action_key(object->action, setChan, AC_LOC_Z, makeCurve);
-        }
-        //rebuild ipos
-        remake_action_ipos(object->action);
-
-        //rebuild displists
-        rebuild_all_armature_displists();
+
+               if( object == NULL )
+                       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                                                       "armature must be linked to an object to set a pose!" ) );
+
+               //set the active action as this one
+               if( py_action != NULL ) {
+                       if( py_action->action != NULL ) {
+                               object->action = py_action->action;
+                       }
+               }
+               //if object doesn't have a pose create one
+               if( !object->pose )
+                       object->pose = MEM_callocN( sizeof( bPose ), "Pose" );
+
+               //if bone does have a channel create one
+               verify_pose_channel( object->pose, self->bone->name );
+               //create temp Pose Channel
+               chan = MEM_callocN( sizeof( bPoseChannel ), "PoseChannel" );
+               //set the variables for this pose
+               memcpy( chan->loc, self->bone->loc, sizeof( chan->loc ) );
+               memcpy( chan->quat, self->bone->quat, sizeof( chan->quat ) );
+               memcpy( chan->size, self->bone->size, sizeof( chan->size ) );
+               strcpy( chan->name, self->bone->name );
+               chan->flag |= flagValue;
+               //set it to the channel
+               setChan = set_pose_channel( object->pose, chan );
+               //frees unlinked pose/bone channels from object
+               collect_pose_garbage( object );
+
+               //create an action if one not already assigned to object
+               if( !py_action && !object->action ) {
+                       object->action = ( bAction * ) add_empty_action(  );
+                       object->ipowin = ID_AC;
+               } else {
+                       //test if posechannel is already in action
+                       for( test = object->action->chanbase.first; test;
+                            test = test->next ) {
+                               if( test == setChan )
+                                       makeCurve = 0;  //already there
+                       }
+               }
+
+               //set action keys
+               if( setChan->flag & POSE_ROT ) {
+                       set_action_key( object->action, setChan, AC_QUAT_X,
+                                       makeCurve );
+                       set_action_key( object->action, setChan, AC_QUAT_Y,
+                                       makeCurve );
+                       set_action_key( object->action, setChan, AC_QUAT_Z,
+                                       makeCurve );
+                       set_action_key( object->action, setChan, AC_QUAT_W,
+                                       makeCurve );
+               }
+               if( setChan->flag & POSE_SIZE ) {
+                       set_action_key( object->action, setChan, AC_SIZE_X,
+                                       makeCurve );
+                       set_action_key( object->action, setChan, AC_SIZE_Y,
+                                       makeCurve );
+                       set_action_key( object->action, setChan, AC_SIZE_Z,
+                                       makeCurve );
+               }
+               if( setChan->flag & POSE_LOC ) {
+                       set_action_key( object->action, setChan, AC_LOC_X,
+                                       makeCurve );
+                       set_action_key( object->action, setChan, AC_LOC_Y,
+                                       makeCurve );
+                       set_action_key( object->action, setChan, AC_LOC_Z,
+                                       makeCurve );
+               }
+               //rebuild ipos
+               remake_action_ipos( object->action );
+
+               //rebuild displists
+               rebuild_all_armature_displists(  );
        }
-       return EXPP_incr_ret  (Py_None);
+       return EXPP_incr_ret( Py_None );
 }
 
-//--------------- BPy_Bone.getBoneclass()----------------------------------------------------------------------------
-static PyObject *
-Bone_getBoneclass (BPy_Bone * self)
+//--------------- BPy_Bone.getBoneclass()--------------------------
+static PyObject *Bone_getBoneclass( BPy_Bone * self )
 {
-  PyObject *attr = NULL;
-
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         attr = returnBoneclassEnum(self->boneclass);
-  }else{
-         //use bone datastruct
-      attr = returnBoneclassEnum(self->bone->boneclass);
-  }
-  if (attr)
-    return attr;
-
-  return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
-                                "couldn't get Bone.Boneclass attribute"));
+       PyObject *attr = NULL;
+
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               attr = returnBoneclassEnum( self->boneclass );
+       } else {
+               //use bone datastruct
+               attr = returnBoneclassEnum( self->bone->boneclass );
+       }
+       if( attr )
+               return attr;
+
+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                                       "couldn't get Bone.Boneclass attribute" ) );
 }
-//--------------- BPy_Bone.setBoneclass()-------------------------------------------------------------------------
-static PyObject *
-Bone_setBoneclass(BPy_Bone *self, PyObject *args)
+
+//--------------- BPy_Bone.setBoneclass()---------------------------
+static PyObject *Bone_setBoneclass( BPy_Bone * self, PyObject * args )
 {
-  int boneclass;
-
-  if (!PyArg_ParseTuple (args, "i", &boneclass))
-    return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                  "expected enum argument"));
-
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         self->boneclass = boneclass;
-  }else{
-         //use bone datastruct
-        self->bone->boneclass = boneclass;
-  }  
-  return EXPP_incr_ret  (Py_None);
+       int boneclass;
+
+       if( !PyArg_ParseTuple( args, "i", &boneclass ) )
+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                               "expected enum argument" ) );
+
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               self->boneclass = boneclass;
+       } else {
+               //use bone datastruct
+               self->bone->boneclass = boneclass;
+       }
+       return EXPP_incr_ret( Py_None );
 }
-//--------------- BPy_Bone.hasIK()----------------------------------------------------------------------------
-static PyObject *
-Bone_hasIK (BPy_Bone * self)
+
+//--------------- BPy_Bone.hasIK()-------------------------------
+static PyObject *Bone_hasIK( BPy_Bone * self )
 {
-  if (!self->bone) {   //test to see if linked to armature
-         //use python vars
-         if(self->flag & BONE_IK_TOPARENT){
-                       Py_INCREF (Py_True);
+       if( !self->bone ) {     //test to see if linked to armature
+               //use python vars
+               if( self->flag & BONE_IK_TOPARENT ) {
+                       Py_INCREF( Py_True );
                        return Py_True;
-         }else{
-                       Py_INCREF (Py_False);
+               } else {
+                       Py_INCREF( Py_False );
                        return Py_False;
-         }
-  }else{
-         //use bone datastruct
-         if(self->bone->flag & BONE_IK_TOPARENT){
-                       Py_INCREF (Py_True);
+               }
+       } else {
+               //use bone datastruct
+               if( self->bone->flag & BONE_IK_TOPARENT ) {
+                       Py_INCREF( Py_True );
                        return Py_True;
-         }else{
-                       Py_INCREF (Py_False);
+               } else {
+                       Py_INCREF( Py_False );
                        return Py_False;
-         }
-  }
-  return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
-                                "couldn't get Bone.Boneclass attribute"));
+               }
+       }
+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                                       "couldn't get Bone.Boneclass attribute" ) );
 }
-//--------------- BPy_Bone.getRestMatrix()----------------------------------------------------------------------------
-static PyObject *
-Bone_getRestMatrix(BPy_Bone * self, PyObject *args)
+
+//--------------- BPy_Bone.getRestMatrix()-------------------------
+static PyObject *Bone_getRestMatrix( BPy_Bone * self, PyObject * args )
 {
        char *local = "worldspace";
        char *bonespace = "bonespace";
        char *worldspace = "worldspace";
-    PyObject *matrix;
+       PyObject *matrix;
        float delta[3];
        float root[3];
        float p_root[3];
 
-       if (!PyArg_ParseTuple (args, "|s", &local))
-                       return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                                                                                                       "expected string"));
+       if( !PyArg_ParseTuple( args, "|s", &local ) )
+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                               "expected string" ) );
 
-       if(!BLI_streq(local, bonespace) && !BLI_streq(local, worldspace))
-               return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                                                                                                       "expected 'bonespace' or 'worldspace'"));
+       if( !BLI_streq( local, bonespace ) && !BLI_streq( local, worldspace ) )
+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                               "expected 'bonespace' or 'worldspace'" ) );
 
-       matrix = newMatrixObject(PyMem_Malloc(16 * sizeof(float)),4,4);
+       matrix = newMatrixObject( PyMem_Malloc( 16 * sizeof( float ) ), 4, 4 );
 
-       if (!self->bone) {      //test to see if linked to armature
+       if( !self->bone ) {     //test to see if linked to armature
                //use python vars
-               if(BLI_streq(local, worldspace)){
-                       VecSubf (delta, self->tail->vec, self->head->vec);
-                       make_boneMatrixvr( *((MatrixObject*)matrix)->matrix, delta, self->roll);
-               }else if(BLI_streq(local, bonespace)){
-                       return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                                                                                                       "bone not yet linked to an armature....'"));
+               if( BLI_streq( local, worldspace ) ) {
+                       VecSubf( delta, self->tail->vec, self->head->vec );
+                       make_boneMatrixvr( *( ( MatrixObject * ) matrix )->
+                                          matrix, delta, self->roll );
+               } else if( BLI_streq( local, bonespace ) ) {
+                       return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                                       "bone not yet linked to an armature....'" ) );
                }
-       }else{
+       } else {
                //use bone datastruct
-               if(BLI_streq(local, worldspace)){
-                       get_objectspace_bone_matrix (self->bone, *((MatrixObject*)matrix)->matrix, 1, 1);
-               }else if(BLI_streq(local, bonespace)){
-                       VecSubf (delta, self->bone->tail, self->bone->head);
-                       make_boneMatrixvr( *((MatrixObject*)matrix)->matrix, delta, self->bone->roll);
-                       if(self->bone->parent){
-                               get_bone_root_pos(self->bone,root,1);
-                               get_bone_root_pos(self->bone->parent,p_root,1);
-                               VecSubf(delta,root,p_root);
-                               VECCOPY(((MatrixObject*)matrix)->matrix[3], delta);
+               if( BLI_streq( local, worldspace ) ) {
+                       get_objectspace_bone_matrix( self->bone,
+                                                    *( ( MatrixObject * )
+                                                       matrix )->matrix, 1,
+                                                    1 );
+               } else if( BLI_streq( local, bonespace ) ) {
+                       VecSubf( delta, self->bone->tail, self->bone->head );
+                       make_boneMatrixvr( *( ( MatrixObject * ) matrix )->
+                                          matrix, delta, self->bone->roll );
+                       if( self->bone->parent ) {
+                               get_bone_root_pos( self->bone, root, 1 );
+                               get_bone_root_pos( self->bone->parent, p_root,
+                                                  1 );
+                               VecSubf( delta, root, p_root );
+                               VECCOPY( ( ( MatrixObject * ) matrix )->
+                                        matrix[3], delta );
                        }
                }
        }
index 06c1df3529e30adcbd151dc219e5e487be5a3707..088616da59185c249b4b7f070bccd4df69b2c7b8 100644 (file)
@@ -1,4 +1,5 @@
 /* 
+ * $Id$
  *
  * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
  *
 #include "quat.h"
 #include "matrix.h"
 
-//--------------------------Python BPy_Bone structure definition.---------------------
-typedef struct{
-       PyObject_HEAD  
-       //reference to data if bone is linked to an armature
-       Bone *bone; 
+//--------------------------Python BPy_Bone structure definition.-------
+typedef struct {
+       PyObject_HEAD
+               //reference to data if bone is linked to an armature
+       Bone * bone;
        //list of vars that define the boneclass
-       char *name;     
+       char *name;
        char *parent;
-       float roll;     
+       float roll;
        int flag;
        int boneclass;
        float dist;
        float weight;
-       VectorObject  *head;            
-       VectorObject  *tail;            
-       VectorObject  *loc;
-       VectorObject  *dloc;
-       VectorObject  *size;
-       VectorObject  *dsize;
+       VectorObject *head;
+       VectorObject *tail;
+       VectorObject *loc;
+       VectorObject *dloc;
+       VectorObject *size;
+       VectorObject *dsize;
        QuaternionObject *quat;
        QuaternionObject *dquat;
        MatrixObject *obmat;
        MatrixObject *parmat;
        MatrixObject *defmat;
        MatrixObject *irestmat;
-       MatrixObject *posemat;  
-}BPy_Bone;
+       MatrixObject *posemat;
+} BPy_Bone;
 
-//------------------------------visible prototypes----------------------------------------------
-PyObject *Bone_CreatePyObject (struct Bone *obj);
-int Bone_CheckPyObject (PyObject * py_obj);
-Bone *Bone_FromPyObject (PyObject * py_obj);
-PyObject *Bone_Init (void);
-int updateBoneData(BPy_Bone *self, Bone *parent);
+//------------------------------visible prototypes----------------------
+PyObject *Bone_CreatePyObject( struct Bone *obj );
+int Bone_CheckPyObject( PyObject * py_obj );
+Bone *Bone_FromPyObject( PyObject * py_obj );
+PyObject *Bone_Init( void );
+int updateBoneData( BPy_Bone * self, Bone * parent );
 
 #endif
index 23485cb40307d53a11a8f106d9ba9f25f017f2d8..a5c4c34219b265b2836cdc7ba6cd53118e05f82f 100644 (file)
 #include <stdio.h>
 
 /*****************************************************************************/
-/* Python BPy_Build methods table:                                             */
+/* Python BPy_Build methods table:                                           */
 /*****************************************************************************/
 static PyMethodDef BPy_Build_methods[] = {
-  {"getLen", (PyCFunction) Build_getLen,
-   METH_NOARGS, "()-Return Build len"},
-  {"setLen", (PyCFunction) Build_setLen, METH_VARARGS,
-   "()- Sets Build len"},
-  {"getSfra", (PyCFunction) Build_getSfra,
-   METH_NOARGS, "()-Return Build sfra"},
-  {"setSfra", (PyCFunction) Build_setSfra, METH_VARARGS,
-   "()- Sets Build sfra"},
-  {NULL, NULL, 0, NULL}
+       {"getLen", ( PyCFunction ) Build_getLen,
+        METH_NOARGS, "()-Return Build len"},
+       {"setLen", ( PyCFunction ) Build_setLen, METH_VARARGS,
+        "()- Sets Build len"},
+       {"getSfra", ( PyCFunction ) Build_getSfra,
+        METH_NOARGS, "()-Return Build sfra"},
+       {"setSfra", ( PyCFunction ) Build_setSfra, METH_VARARGS,
+        "()- Sets Build sfra"},
+       {NULL, NULL, 0, NULL}
 };
 
 
@@ -63,26 +63,27 @@ static PyMethodDef BPy_Build_methods[] = {
 /* Python Build_Type structure definition:                                   */
 /*****************************************************************************/
 PyTypeObject Build_Type = {
-  PyObject_HEAD_INIT (NULL) 0, /* ob_size */
-  "Build",                     /* tp_name */
-  sizeof (BPy_Build),          /* tp_basicsize */
-  0,                           /* tp_itemsize */
-  /* methods */
-  (destructor) BuildDeAlloc,   /* tp_dealloc */
-  0,                           /* tp_print */
-  (getattrfunc) BuildGetAttr,  /* tp_getattr */
-  (setattrfunc) BuildSetAttr,  /* tp_setattr */
-  0,                           /* tp_compare */
-  (reprfunc) BuildRepr,                /* tp_repr */
-  0,                           /* tp_as_number */
-  0,                           /* tp_as_sequence */
-  0,                           /* tp_as_mapping */
-  0,                           /* tp_as_hash */
-  0, 0, 0, 0, 0, 0,
-  0,                           /* tp_doc */
-  0, 0, 0, 0, 0, 0,
-  BPy_Build_methods,           /* tp_methods */
-  0,                           /* tp_members */
+       PyObject_HEAD_INIT( NULL ) 
+       0,      /* ob_size */
+       "Build",                /* tp_name */
+       sizeof( BPy_Build ),    /* tp_basicsize */
+       0,                      /* tp_itemsize */
+       /* methods */
+       ( destructor ) BuildDeAlloc,    /* tp_dealloc */
+       0,                      /* tp_print */
+       ( getattrfunc ) BuildGetAttr,   /* tp_getattr */
+       ( setattrfunc ) BuildSetAttr,   /* tp_setattr */
+       0,                      /* tp_compare */
+       ( reprfunc ) BuildRepr, /* tp_repr */
+       0,                      /* tp_as_number */
+       0,                      /* tp_as_sequence */
+       0,                      /* tp_as_mapping */
+       0,                      /* tp_as_hash */
+       0, 0, 0, 0, 0, 0,
+       0,                      /* tp_doc */
+       0, 0, 0, 0, 0, 0,
+       BPy_Build_methods,      /* tp_methods */
+       0,                      /* tp_members */
 };
 
 
@@ -108,224 +109,215 @@ static char M_Build_Get_doc[] = "Build.Get (name = None):\n\
 /* Function:              M_Build_New                                        */
 /* Python equivalent:     Blender.Effect.Build.New                           */
 /*****************************************************************************/
-PyObject *
-M_Build_New (PyObject * self, PyObject * args)
+PyObject *M_Build_New( PyObject * self, PyObject * args )
 {
-  int type = EFF_BUILD;
-  BPy_Effect *pyeffect;
-  Effect *bleffect = 0;
+       int type = EFF_BUILD;
+       BPy_Effect *pyeffect;
+       Effect *bleffect = 0;
 
 
-  bleffect = add_effect (type);
-  if (bleffect == NULL)
-    return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
-                                  "couldn't create Effect Data in Blender"));
+       bleffect = add_effect( type );
+       if( bleffect == NULL )
+               return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                                               "couldn't create Effect Data in Blender" ) );
 
-  pyeffect = (BPy_Effect *) PyObject_NEW (BPy_Effect, &Effect_Type);
+       pyeffect = ( BPy_Effect * ) PyObject_NEW( BPy_Effect, &Effect_Type );
 
 
-  if (pyeffect == NULL)
-    return (EXPP_ReturnPyObjError (PyExc_MemoryError,
-                                  "couldn't create Effect Data object"));
+       if( pyeffect == NULL )
+               return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
+                                               "couldn't create Effect Data object" ) );
 
-  pyeffect->effect = bleffect;
+       pyeffect->effect = bleffect;
 
-  return (PyObject *) pyeffect;
-  return 0;
+       return ( PyObject * ) pyeffect;
+       return 0;
 }
 
 /*****************************************************************************/
 /* Function:              M_Build_Get                                        */
 /* Python equivalent:     Blender.Effect.Build.Get                           */
 /*****************************************************************************/
-PyObject *
-M_Build_Get (PyObject * self, PyObject * args)
+PyObject *M_Build_Get( PyObject * self, PyObject * args )
 {
-  /*arguments : string object name
-     int : position of effect in the obj's effect list  */
-  char *name = 0;
-  Object *object_iter;
-  Effect *eff;
-  BPy_Build *wanted_eff;
-  int num, i;
-  if (!PyArg_ParseTuple (args, "si", &name, &num))
-    return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                  "expected string int argument"));
-
-  object_iter = G.main->object.first;
-  if (!object_iter)
-    return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                  "Scene contains no object"));
-
-  while (object_iter)
-    {
-      if (strcmp (name, object_iter->id.name + 2))
-       {
-         object_iter = object_iter->id.next;
-         continue;
+       /*arguments : string object name
+          int : position of effect in the obj's effect list  */
+       char *name = 0;
+       Object *object_iter;
+       Effect *eff;
+       BPy_Build *wanted_eff;
+       int num, i;
+       if( !PyArg_ParseTuple( args, "si", &name, &num ) )
+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                               "expected string int argument" ) );
+
+       object_iter = G.main->object.first;
+       if( !object_iter )
+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                               "Scene contains no object" ) );
+
+       while( object_iter ) {
+               if( strcmp( name, object_iter->id.name + 2 ) ) {
+                       object_iter = object_iter->id.next;
+                       continue;
+               }
+
+
+               if( object_iter->effect.first != NULL ) {
+                       eff = object_iter->effect.first;
+                       for( i = 0; i < num; i++ ) {
+                               if( eff->type != EFF_BUILD )
+                                       continue;
+                               eff = eff->next;
+                               if( !eff )
+                                       return ( EXPP_ReturnPyObjError
+                                                ( PyExc_AttributeError,
+                                                  "object not created" ) );
+                       }
+                       wanted_eff =
+                               ( BPy_Build * ) PyObject_NEW( BPy_Build,
+                                                             &Build_Type );
+                       wanted_eff->build = eff;
+                       return ( PyObject * ) wanted_eff;
+               }
+               object_iter = object_iter->id.next;
        }
-
-
-      if (object_iter->effect.first != NULL)
-       {
-         eff = object_iter->effect.first;
-         for (i = 0; i < num; i++)
-           {
-             if (eff->type != EFF_BUILD)
-               continue;
-             eff = eff->next;
-             if (!eff)
-               return (EXPP_ReturnPyObjError
-                       (PyExc_AttributeError, "object not created"));
-           }
-         wanted_eff = (BPy_Build *) PyObject_NEW (BPy_Build, &Build_Type);
-         wanted_eff->build = eff;
-         return (PyObject *) wanted_eff;
-       }
-      object_iter = object_iter->id.next;
-    }
-  Py_INCREF (Py_None);
-  return Py_None;
+       Py_INCREF( Py_None );
+       return Py_None;
 }
 
 
 
 struct PyMethodDef M_Build_methods[] = {
-  {"New", (PyCFunction) M_Build_New, METH_VARARGS, M_Build_New_doc},
-  {"Get", M_Build_Get, METH_VARARGS, M_Build_Get_doc},
-  {"get", M_Build_Get, METH_VARARGS, M_Build_Get_doc},
-  {NULL, NULL, 0, NULL}
+       {"New", ( PyCFunction ) M_Build_New, METH_VARARGS, M_Build_New_doc},
+       {"Get", M_Build_Get, METH_VARARGS, M_Build_Get_doc},
+       {"get", M_Build_Get, METH_VARARGS, M_Build_Get_doc},
+       {NULL, NULL, 0, NULL}
 };
 
 /*****************************************************************************/
 /* Function:              Build_Init                                         */
 /*****************************************************************************/
 
-PyObject *
-Build_Init (void)
+PyObject *Build_Init( void )
 {
-  PyObject *submodule;
+       PyObject *submodule;
 
-  Build_Type.ob_type = &PyType_Type;
-  submodule = Py_InitModule3 ("Blender.Build", M_Build_methods, M_Build_doc);
-  return (submodule);
+       Build_Type.ob_type = &PyType_Type;
+       submodule =
+               Py_InitModule3( "Blender.Build", M_Build_methods,
+                               M_Build_doc );
+       return ( submodule );
 }
 
 /*****************************************************************************/
-/* Python BPy_Build methods:                                                  */
+/* Python BPy_Build methods:                                                */
 /*****************************************************************************/
 
-PyObject *
-Build_getLen (BPy_Build * self)
+PyObject *Build_getLen( BPy_Build * self )
 {
-  BuildEff *ptr = (BuildEff *) self->build;
-  return PyFloat_FromDouble (ptr->len);
+       BuildEff *ptr = ( BuildEff * ) self->build;
+       return PyFloat_FromDouble( ptr->len );
 }
 
 
-PyObject *
-Build_setLen (BPy_Build * self, PyObject * args)
+PyObject *Build_setLen( BPy_Build * self, PyObject * args )
 {
-  BuildEff *ptr = (BuildEff *) self->build;
-  float val = 0;
-  if (!PyArg_ParseTuple (args, "f", &val))
-    return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                  "expected float argument"));
-  ptr->len = val;
-  Py_INCREF (Py_None);
-  return Py_None;
+       BuildEff *ptr = ( BuildEff * ) self->build;
+       float val = 0;
+       if( !PyArg_ParseTuple( args, "f", &val ) )
+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                               "expected float argument" ) );
+       ptr->len = val;
+       Py_INCREF( Py_None );
+       return Py_None;
 }
 
 
-PyObject *
-Build_getSfra (BPy_Build * self)
+PyObject *Build_getSfra( BPy_Build * self )
 {
-  BuildEff *ptr = (BuildEff *) self->build;
-  return PyFloat_FromDouble (ptr->sfra);
+       BuildEff *ptr = ( BuildEff * ) self->build;
+       return PyFloat_FromDouble( ptr->sfra );
 }
 
-PyObject *
-Build_setSfra (BPy_Build * self, PyObject * args)
+PyObject *Build_setSfra( BPy_Build * self, PyObject * args )
 {
-  BuildEff *ptr = (BuildEff *) self->build;
-  float val = 0;
-  if (!PyArg_ParseTuple (args, "f", &val))
-    return (EXPP_ReturnPyObjError
-           (PyExc_AttributeError, "expected float argument"));
-
-  ptr->sfra = val;
-  Py_INCREF (Py_None);
-  return Py_None;
+       BuildEff *ptr = ( BuildEff * ) self->build;
+       float val = 0;
+       if( !PyArg_ParseTuple( args, "f", &val ) )
+               return ( EXPP_ReturnPyObjError
+                        ( PyExc_AttributeError, "expected float argument" ) );
+
+       ptr->sfra = val;
+       Py_INCREF( Py_None );
+       return Py_None;
 }
 
 /*****************************************************************************/
 /* Function:    BuildDeAlloc                                                 */
-/* Description: This is a callback function for the BPy_Build type. It is      */
+/* Description: This is a callback function for the BPy_Build type. It is    */
 /*              the destructor function.                                     */
 /*****************************************************************************/
-void
-BuildDeAlloc (BPy_Build * self)
+void BuildDeAlloc( BPy_Build * self )
 {
-  BuildEff *ptr = (BuildEff *) self;
-  PyObject_DEL (ptr);
+       BuildEff *ptr = ( BuildEff * ) self;
+       PyObject_DEL( ptr );
 }
 
 /*****************************************************************************/
 /* Function:    BuildGetAttr                                                 */
-/* Description: This is a callback function for the BPy_Build type. It is      */
-/*              the function that accesses BPy_Build "member variables" and    */
+/* Description: This is a callback function for the BPy_Build type. It is    */
+/*              the function that accesses BPy_Build "member variables" and  */
 /*              methods.                                                     */
 /*****************************************************************************/
 
-PyObject *
-BuildGetAttr (BPy_Build * self, char *name)
+PyObject *BuildGetAttr( BPy_Build * self, char *name )
 {
-  if (!strcmp (name, "sfra"))
-    return Build_getSfra (self);
-  if (!strcmp (name, "len"))
-    return Build_getLen (self);
-  return Py_FindMethod (BPy_Build_methods, (PyObject *) self, name);
+       if( !strcmp( name, "sfra" ) )
+               return Build_getSfra( self );
+       if( !strcmp( name, "len" ) )
+               return Build_getLen( self );
+       return Py_FindMethod( BPy_Build_methods, ( PyObject * ) self, name );
 }
 
 /*****************************************************************************/
-/* Function:    BuildSetAttr                                                  */
-/* Description: This is a callback function for the BPy_Build type. It is the   */
-/*              function that sets Build Data attributes (member variables).  */
+/* Function:    BuildSetAttr                                                 */
+/* Description: This is a callback function for the BPy_Build type. It   */
+/*              sets Build Data attributes (member variables).  */
 /*****************************************************************************/
-int
-BuildSetAttr (BPy_Build * self, char *name, PyObject * value)
+int BuildSetAttr( BPy_Build * self, char *name, PyObject * value )
 {
-  PyObject *valtuple;
-  PyObject *error = NULL;
-  valtuple = Py_BuildValue ("(N)", value);
-
-  if (!valtuple)
-    return EXPP_ReturnIntError (PyExc_MemoryError,
-                               "CameraSetAttr: couldn't create PyTuple");
-
-  if (!strcmp (name, "sfra"))
-    error = Build_setSfra (self, valtuple);
-  else if (!strcmp (name, "len"))
-    error = Build_setLen (self, valtuple);
-
-  else
-    {
-      Py_DECREF (valtuple);
-      return (EXPP_ReturnIntError (PyExc_KeyError, "attribute not found"));
-    }
+       PyObject *valtuple;
+       PyObject *error = NULL;
+       valtuple = Py_BuildValue( "(N)", value );
+
+       if( !valtuple )
+               return EXPP_ReturnIntError( PyExc_MemoryError,
+                                           "CameraSetAttr: couldn't create PyTuple" );
+
+       if( !strcmp( name, "sfra" ) )
+               error = Build_setSfra( self, valtuple );
+       else if( !strcmp( name, "len" ) )
+               error = Build_setLen( self, valtuple );
+
+       else {
+               Py_DECREF( valtuple );
+               return ( EXPP_ReturnIntError
+                        ( PyExc_KeyError, "attribute not found" ) );
+       }
 
-  /*  Py_DECREF(valtuple); */
+       /*  Py_DECREF(valtuple); */
 
-  if (error != Py_None)
-    return -1;
+       if( error != Py_None )
+               return -1;
 
-  Py_DECREF (Py_None);
-  return 0;
+       Py_DECREF( Py_None );
+       return 0;
 }
 
 /*****************************************************************************/
 /* Function:    BuildPrint                                                   */
-/* Description: This is a callback function for the BPy_Build type. It         */
+/* Description: This is a callback function for the BPy_Build type. It       */
 /*              builds a meaninful string to 'print' build objects.          */
 /*****************************************************************************/
 /*
@@ -336,45 +328,40 @@ int BuildPrint(BPy_Build *self, FILE *fp, int flags)
 */
 /*****************************************************************************/
 /* Function:    BuildRepr                                                    */
-/* Description: This is a callback function for the BPy_Build type. It         */
+/* Description: This is a callback function for the BPy_Build type. It       */
 /*              builds a meaninful string to represent build objects.        */
 /*****************************************************************************/
-PyObject *
-BuildRepr (BPy_Build * self)
+PyObject *BuildRepr( BPy_Build * self )
 {
-  return PyString_FromString ("Build effect");
+       return PyString_FromString( "Build effect" );
 }
 
-PyObject *
-BuildCreatePyObject (struct Effect * build)
+PyObject *BuildCreatePyObject( struct Effect * build )
 {
-  BPy_Build *blen_object;
+       BPy_Build *blen_object;
 
 
-  blen_object = (BPy_Build *) PyObject_NEW (BPy_Build, &Build_Type);
+       blen_object = ( BPy_Build * ) PyObject_NEW( BPy_Build, &Build_Type );
 
-  if (blen_object == NULL)
-    {
-      return (NULL);
-    }
-  blen_object->build = build;
-  return ((PyObject *) blen_object);
+       if( blen_object == NULL ) {
+               return ( NULL );
+       }
+       blen_object->build = build;
+       return ( ( PyObject * ) blen_object );
 
 }
 
-int
-BuildCheckPyObject (PyObject * py_obj)
+int BuildCheckPyObject( PyObject * py_obj )
 {
-  return (py_obj->ob_type == &Build_Type);
+       return ( py_obj->ob_type == &Build_Type );
 }
 
 
-struct Build *
-BuildFromPyObject (PyObject * py_obj)
+struct Build *BuildFromPyObject( PyObject * py_obj )
 {
-  BPy_Build *blen_obj;
+       BPy_Build *blen_obj;
 
-  blen_obj = (BPy_Build *) py_obj;
-  return ((struct Build *) blen_obj->build);
+       blen_obj = ( BPy_Build * ) py_obj;
+       return ( ( struct Build * ) blen_obj->build );
 
 }
index 78485081a456fda46ebe593c3bc2b9a6d47f4d97..d98155d72698612ce7afdf25f8688bc26cb4096c 100644 (file)
@@ -1,4 +1,5 @@
 /* 
+ * $Id$
  *
  * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
  *
 /*****************************************************************************/
 /* Python API function prototypes for the Build module.                      */
 /*****************************************************************************/
-PyObject *M_Build_New (PyObject * self, PyObject * args);
-PyObject *M_Build_Get (PyObject * self, PyObject * args);
+PyObject *M_Build_New( PyObject * self, PyObject * args );
+PyObject *M_Build_Get( PyObject * self, PyObject * args );
 
 
 
 /*****************************************************************************/
-/* Python BPy_Build methods declarations:                                      */
+/* Python BPy_Build methods declarations:                                    */
 /*****************************************************************************/
-PyObject *Build_getLen (BPy_Build * self);
-PyObject *Build_setLen (BPy_Build * self, PyObject * a);
-PyObject *Build_getSfra (BPy_Build * self);
-PyObject *Build_setSfra (BPy_Build * self, PyObject * a);
+PyObject *Build_getLen( BPy_Build * self );
+PyObject *Build_setLen( BPy_Build * self, PyObject * a );
+PyObject *Build_getSfra( BPy_Build * self );
+PyObject *Build_setSfra( BPy_Build * self, PyObject * a );
 
 
 
 /*****************************************************************************/
 /* Python Build_Type callback function prototypes:                           */
 /*****************************************************************************/
-void BuildDeAlloc (BPy_Build * msh);
+void BuildDeAlloc( BPy_Build * msh );
 //int BuildPrint (BPy_Build *msh, FILE *fp, int flags);
-int BuildSetAttr (BPy_Build * msh, char *name, PyObject * v);
-PyObject *BuildGetAttr (BPy_Build * msh, char *name);
-PyObject *BuildRepr (BPy_Build * msh);
-PyObject *BuildCreatePyObject (struct Effect *build);
-int BuildCheckPyObject (PyObject * py_obj);
-struct Build *BuildFromPyObject (PyObject * py_obj);
+int BuildSetAttr( BPy_Build * msh, char *name, PyObject * v );
+PyObject *BuildGetAttr( BPy_Build * msh, char *name );
+PyObject *BuildRepr( BPy_Build * msh );
+PyObject *BuildCreatePyObject( struct Effect *build );
+int BuildCheckPyObject( PyObject * py_obj );
+struct Build *BuildFromPyObject( PyObject * py_obj );
 
 
 
-#endif /* EXPP_BUILD_H */
+#endif                         /* EXPP_BUILD_H */
index 9c12d964b1a163ef18e5088194d2bc0227b8d151..69e0152cb4cc8413d6f0bfc7eef8117400e32302 100644 (file)
@@ -48,9 +48,9 @@
 /*****************************************************************************/
 /* Python API function prototypes for the Camera module.                     */
 /*****************************************************************************/
-static PyObject *M_Camera_New (PyObject * self, PyObject * args,
-                              PyObject * keywords);
-static PyObject *M_Camera_Get (PyObject * self, PyObject * args);
+static PyObject *M_Camera_NewPyObject * self, PyObject * args,
+                              PyObject * keywords );
+static PyObject *M_Camera_Get( PyObject * self, PyObject * args );
 
 /*****************************************************************************/
 /* The following string definitions are used for documentation strings.      */
@@ -73,7 +73,7 @@ Example::\n\
   cur.setCurrentCamera(ob)     # make this camera the active";
 
 static char M_Camera_New_doc[] =
-  "Camera.New (type = 'persp', name = 'CamData'):\n\
+       "Camera.New (type = 'persp', name = 'CamData'):\n\
         Return a new Camera Data object with the given type and name.";
 
 static char M_Camera_Get_doc[] = "Camera.Get (name = None):\n\
@@ -85,336 +85,326 @@ static char M_Camera_Get_doc[] = "Camera.Get (name = None):\n\
 /* Python method structure definition for Blender.Camera module:             */
 /*****************************************************************************/
 struct PyMethodDef M_Camera_methods[] = {
-  {"New", (PyCFunction) M_Camera_New, METH_VARARGS | METH_KEYWORDS,
-   M_Camera_New_doc},
-  {"Get", M_Camera_Get, METH_VARARGS, M_Camera_Get_doc},
-  {"get", M_Camera_Get, METH_VARARGS, M_Camera_Get_doc},
-  {NULL, NULL, 0, NULL}
+       {"New", ( PyCFunction ) M_Camera_New, METH_VARARGS | METH_KEYWORDS,
+        M_Camera_New_doc},
+       {"Get", M_Camera_Get, METH_VARARGS, M_Camera_Get_doc},
+       {"get", M_Camera_Get, METH_VARARGS, M_Camera_Get_doc},
+       {NULL, NULL, 0, NULL}
 };
 
 /*****************************************************************************/
 /* Python BPy_Camera methods declarations:                                   */
 /*****************************************************************************/
-static PyObject *Camera_getIpo (BPy_Camera * self);
-static PyObject *Camera_getName (BPy_Camera * self);
-static PyObject *Camera_getType (BPy_Camera * self);
-static PyObject *Camera_getMode (BPy_Camera * self);
-static PyObject *Camera_getLens (BPy_Camera * self);
-static PyObject *Camera_getClipStart (BPy_Camera * self);
-static PyObject *Camera_getClipEnd (BPy_Camera * self);
-static PyObject *Camera_getDrawSize (BPy_Camera * self);
-static PyObject *Camera_setIpo (BPy_Camera * self, PyObject * args);
-static PyObject *Camera_clearIpo (BPy_Camera * self);
-static PyObject *Camera_setName (BPy_Camera * self, PyObject * args);
-static PyObject *Camera_setType (BPy_Camera * self, PyObject * args);
-static PyObject *Camera_setIntType (BPy_Camera * self, PyObject * args);
-static PyObject *Camera_setMode (BPy_Camera * self, PyObject * args);
-static PyObject *Camera_setIntMode (BPy_Camera * self, PyObject * args);
-static PyObject *Camera_setLens (BPy_Camera * self, PyObject * args);
-static PyObject *Camera_setClipStart (BPy_Camera * self, PyObject * args);
-static PyObject *Camera_setClipEnd (BPy_Camera * self, PyObject * args);
-static PyObject *Camera_setDrawSize (BPy_Camera * self, PyObject * args);
-static PyObject *Camera_getScriptLinks(BPy_Camera *self, PyObject *args);
-static PyObject *Camera_addScriptLink(BPy_Camera *self, PyObject *args);
-static PyObject *Camera_clearScriptLinks(BPy_Camera *self);
+static PyObject *Camera_getIpo( BPy_Camera * self );
+static PyObject *Camera_getName( BPy_Camera * self );
+static PyObject *Camera_getType( BPy_Camera * self );
+static PyObject *Camera_getMode( BPy_Camera * self );
+static PyObject *Camera_getLens( BPy_Camera * self );
+static PyObject *Camera_getClipStart( BPy_Camera * self );
+static PyObject *Camera_getClipEnd( BPy_Camera * self );
+static PyObject *Camera_getDrawSize( BPy_Camera * self );
+static PyObject *Camera_setIpo( BPy_Camera * self, PyObject * args );
+static PyObject *Camera_clearIpo( BPy_Camera * self );
+static PyObject *Camera_setName( BPy_Camera * self, PyObject * args );
+static PyObject *Camera_setType( BPy_Camera * self, PyObject * args );
+static PyObject *Camera_setIntType( BPy_Camera * self, PyObject * args );
+static PyObject *Camera_setMode( BPy_Camera * self, PyObject * args );
+static PyObject *Camera_setIntMode( BPy_Camera * self, PyObject * args );
+static PyObject *Camera_setLens( BPy_Camera * self, PyObject * args );
+static PyObject *Camera_setClipStart( BPy_Camera * self, PyObject * args );
+static PyObject *Camera_setClipEnd( BPy_Camera * self, PyObject * args );
+static PyObject *Camera_setDrawSize( BPy_Camera * self, PyObject * args );
+static PyObject *Camera_getScriptLinks( BPy_Camera * self, PyObject * args );
+static PyObject *Camera_addScriptLink( BPy_Camera * self, PyObject * args );
+static PyObject *Camera_clearScriptLinks( BPy_Camera * self );
 
 /*****************************************************************************/
 /* Python BPy_Camera methods table:                                          */
 /*****************************************************************************/
 static PyMethodDef BPy_Camera_methods[] = {
-  /* name, method, flags, doc */
-  {"getIpo", (PyCFunction) Camera_getIpo, METH_NOARGS,
-   "() - Return Camera Data Ipo"},
-  {"getName", (PyCFunction) Camera_getName, METH_NOARGS,
-   "() - Return Camera Data name"},
-  {"getType", (PyCFunction) Camera_getType, METH_NOARGS,
-   "() - Return Camera type - 'persp':0, 'ortho':1"},
-  {"getMode", (PyCFunction) Camera_getMode, METH_NOARGS,
-   "() - Return Camera mode flags (or'ed value) -\n"
-   "     'showLimits':1, 'showMist':2"},
-  {"getLens", (PyCFunction) Camera_getLens, METH_NOARGS,
-   "() - Return Camera lens value"},
-  {"getClipStart", (PyCFunction) Camera_getClipStart, METH_NOARGS,
-   "() - Return Camera clip start value"},
-  {"getClipEnd", (PyCFunction) Camera_getClipEnd, METH_NOARGS,
-   "() - Return Camera clip end value"},
-  {"getDrawSize", (PyCFunction) Camera_getDrawSize, METH_NOARGS,
-   "() - Return Camera draw size value"},
-  {"setIpo", (PyCFunction) Camera_setIpo, METH_VARARGS,
-   "(Blender Ipo) - Set Camera Ipo"},
-  {"clearIpo", (PyCFunction) Camera_clearIpo, METH_NOARGS,
-   "() - Unlink Ipo from this Camera."},
-  {"setName", (PyCFunction) Camera_setName, METH_VARARGS,
-   "(s) - Set Camera Data name"},
-  {"setType", (PyCFunction) Camera_setType, METH_VARARGS,
-   "(s) - Set Camera type, which can be 'persp' or 'ortho'"},
-  {"setMode", (PyCFunction) Camera_setMode, METH_VARARGS,
-   "(<s<,s>>) - Set Camera mode flag(s): 'showLimits' and 'showMist'"},
-  {"setLens", (PyCFunction) Camera_setLens, METH_VARARGS,
-   "(f) - Set Camera lens value"},
-  {"setClipStart", (PyCFunction) Camera_setClipStart, METH_VARARGS,
-   "(f) - Set Camera clip start value"},
-  {"setClipEnd", (PyCFunction) Camera_setClipEnd, METH_VARARGS,
-   "(f) - Set Camera clip end value"},
-  {"setDrawSize", (PyCFunction) Camera_setDrawSize, METH_VARARGS,
-   "(f) - Set Camera draw size value"},
-       {"getScriptLinks", (PyCFunction)Camera_getScriptLinks, METH_VARARGS,
-                       "(eventname) - Get a list of this camera's scriptlinks (Text names) "
-                       "of the given type\n"
-       "(eventname) - string: FrameChanged or Redraw."},
-       {"addScriptLink", (PyCFunction)Camera_addScriptLink, METH_VARARGS,
-                       "(text, evt) - Add a new camera scriptlink.\n"
-       "(text) - string: an existing Blender Text name;\n"
-       "(evt) string: FrameChanged or Redraw."},
-       {"clearScriptLinks", (PyCFunction)Camera_clearScriptLinks, METH_NOARGS,
-                       "() - Delete all scriptlinks from this camera."},
-  {NULL, NULL, 0, NULL}
+       /* name, method, flags, doc */
+       {"getIpo", ( PyCFunction ) Camera_getIpo, METH_NOARGS,
+        "() - Return Camera Data Ipo"},
+       {"getName", ( PyCFunction ) Camera_getName, METH_NOARGS,
+        "() - Return Camera Data name"},
+       {"getType", ( PyCFunction ) Camera_getType, METH_NOARGS,
+        "() - Return Camera type - 'persp':0, 'ortho':1"},
+       {"getMode", ( PyCFunction ) Camera_getMode, METH_NOARGS,
+        "() - Return Camera mode flags (or'ed value) -\n"
+        "     'showLimits':1, 'showMist':2"},
+       {"getLens", ( PyCFunction ) Camera_getLens, METH_NOARGS,
+        "() - Return Camera lens value"},
+       {"getClipStart", ( PyCFunction ) Camera_getClipStart, METH_NOARGS,
+        "() - Return Camera clip start value"},
+       {"getClipEnd", ( PyCFunction ) Camera_getClipEnd, METH_NOARGS,
+        "() - Return Camera clip end value"},
+       {"getDrawSize", ( PyCFunction ) Camera_getDrawSize, METH_NOARGS,
+        "() - Return Camera draw size value"},
+       {"setIpo", ( PyCFunction ) Camera_setIpo, METH_VARARGS,
+        "(Blender Ipo) - Set Camera Ipo"},
+       {"clearIpo", ( PyCFunction ) Camera_clearIpo, METH_NOARGS,
+        "() - Unlink Ipo from this Camera."},
+       {"setName", ( PyCFunction ) Camera_setName, METH_VARARGS,
+        "(s) - Set Camera Data name"},
+       {"setType", ( PyCFunction ) Camera_setType, METH_VARARGS,
+        "(s) - Set Camera type, which can be 'persp' or 'ortho'"},
+       {"setMode", ( PyCFunction ) Camera_setMode, METH_VARARGS,
+        "(<s<,s>>) - Set Camera mode flag(s): 'showLimits' and 'showMist'"},
+       {"setLens", ( PyCFunction ) Camera_setLens, METH_VARARGS,
+        "(f) - Set Camera lens value"},
+       {"setClipStart", ( PyCFunction ) Camera_setClipStart, METH_VARARGS,
+        "(f) - Set Camera clip start value"},
+       {"setClipEnd", ( PyCFunction ) Camera_setClipEnd, METH_VARARGS,
+        "(f) - Set Camera clip end value"},
+       {"setDrawSize", ( PyCFunction ) Camera_setDrawSize, METH_VARARGS,
+        "(f) - Set Camera draw size value"},
+       {"getScriptLinks", ( PyCFunction ) Camera_getScriptLinks, METH_VARARGS,
+        "(eventname) - Get a list of this camera's scriptlinks (Text names) "
+        "of the given type\n"
+        "(eventname) - string: FrameChanged or Redraw."},
+       {"addScriptLink", ( PyCFunction ) Camera_addScriptLink, METH_VARARGS,
+        "(text, evt) - Add a new camera scriptlink.\n"
+        "(text) - string: an existing Blender Text name;\n"
+        "(evt) string: FrameChanged or Redraw."},
+       {"clearScriptLinks", ( PyCFunction ) Camera_clearScriptLinks,
+        METH_NOARGS,
+        "() - Delete all scriptlinks from this camera."},
+       {NULL, NULL, 0, NULL}
 };
 
 /*****************************************************************************/
 /* Python Camera_Type callback function prototypes:                          */
 /*****************************************************************************/
-static void Camera_dealloc (BPy_Camera * self);
-static int Camera_setAttr (BPy_Camera * self, char *name, PyObject * v);
-static int Camera_compare (BPy_Camera * a, BPy_Camera * b);
-static PyObject *Camera_getAttr (BPy_Camera * self, char *name);
-static PyObject *Camera_repr (BPy_Camera * self);
+static void Camera_dealloc( BPy_Camera * self );
+static int Camera_setAttr( BPy_Camera * self, char *name, PyObject * v );
+static int Camera_compare( BPy_Camera * a, BPy_Camera * b );
+static PyObject *Camera_getAttr( BPy_Camera * self, char *name );
+static PyObject *Camera_repr( BPy_Camera * self );
 
 
 /*****************************************************************************/
-/* Python Camera_Type structure definition:                                                                                                                                     */
+/* Python Camera_Type structure definition:                                 */
 /*****************************************************************************/
 PyTypeObject Camera_Type = {
-  PyObject_HEAD_INIT (NULL) 0, /* ob_size */
-  "Blender Camera",            /* tp_name */
-  sizeof (BPy_Camera),         /* tp_basicsize */
-  0,                           /* tp_itemsize */
-  /* methods */
-  (destructor) Camera_dealloc, /* tp_dealloc */
-  0,                           /* tp_print */
-  (getattrfunc) Camera_getAttr,        /* tp_getattr */
-  (setattrfunc) Camera_setAttr,        /* tp_setattr */
-  (cmpfunc) Camera_compare,    /* tp_compare */
-  (reprfunc) Camera_repr,      /* tp_repr */
-  0,                           /* tp_as_number */
-  0,                           /* tp_as_sequence */
-  0,                           /* tp_as_mapping */
-  0,                           /* tp_as_hash */
-  0, 0, 0, 0, 0, 0,
-  0,                           /* tp_doc */
-  0, 0, 0, 0, 0, 0,
-  BPy_Camera_methods,          /* tp_methods */
-  0,                           /* tp_members */
+       PyObject_HEAD_INIT( NULL ) /* required macro */ 
+       0,      /* ob_size */
+       "Blender Camera",       /* tp_name */
+       sizeof( BPy_Camera ),   /* tp_basicsize */
+       0,                      /* tp_itemsize */
+       /* methods */
+       ( destructor ) Camera_dealloc,  /* tp_dealloc */
+       0,                      /* tp_print */
+       ( getattrfunc ) Camera_getAttr, /* tp_getattr */
+       ( setattrfunc ) Camera_setAttr, /* tp_setattr */
+       ( cmpfunc ) Camera_compare,     /* tp_compare */
+       ( reprfunc ) Camera_repr,       /* tp_repr */
+       0,                      /* tp_as_number */
+       0,                      /* tp_as_sequence */
+       0,                      /* tp_as_mapping */
+       0,                      /* tp_as_hash */
+       0, 0, 0, 0, 0, 0,
+       0,                      /* tp_doc */
+       0, 0, 0, 0, 0, 0,
+       BPy_Camera_methods,     /* tp_methods */
+       0,                      /* tp_members */
 };
 
-static PyObject *
-M_Camera_New (PyObject * self, PyObject * args, PyObject * kwords)
-{
-  char *type_str = "persp";    /* "persp" is type 0, "ortho" is type 1 */
-  char *name_str = "CamData";
-  static char *kwlist[] = { "type_str", "name_str", NULL };
-  PyObject *pycam;             /* for Camera Data object wrapper in Python */
-  Camera *blcam;               /* for actual Camera Data we create in Blender */
-  char buf[21];
-
-  /* Parse the arguments passed in by the Python interpreter */
-  if (!PyArg_ParseTupleAndKeywords (args, kwords, "|ss", kwlist,
-                                   &type_str, &name_str))
-    /* We expected string(s) (or nothing) as argument, but we didn't get that. */
-    return EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                 "expected zero, one or two strings as arguments");
-
-  blcam = add_camera ();       /* first create the Camera Data in Blender */
-
-  if (blcam)                   /* now create the wrapper obj in Python */
-    pycam = Camera_CreatePyObject (blcam);
-  else
-    return EXPP_ReturnPyObjError (PyExc_RuntimeError,
-                                 "couldn't create Camera Data in Blender");
-
-  /* let's return user count to zero, because ... */
-  blcam->id.us = 0;            /* ... add_camera() incref'ed it */
-  /* XXX XXX Do this in other modules, too */
-
-  if (pycam == NULL)
-    return EXPP_ReturnPyObjError (PyExc_MemoryError,
-                                 "couldn't create Camera PyObject");
-
-  if (strcmp (type_str, "persp") == 0) /* default, no need to set, so */
-    /*blcam->type = (short)EXPP_CAM_TYPE_PERSP */ ;
-  /* we comment this line */
-  else if (strcmp (type_str, "ortho") == 0)
-    blcam->type = (short) EXPP_CAM_TYPE_ORTHO;
-  else
-    return EXPP_ReturnPyObjError (PyExc_AttributeError,
-                                 "unknown camera type");
-
-  if (strcmp (name_str, "CamData") == 0)
-    return pycam;
-  else
-    {                          /* user gave us a name for the camera, use it */
-      PyOS_snprintf (buf, sizeof (buf), "%s", name_str);
-      rename_id (&blcam->id, buf);     /* proper way in Blender */
-    }
+static PyObject *M_Camera_New( PyObject * self, PyObject * args,
+                              PyObject * kwords )
+{
+       char *type_str = "persp";       /* "persp" is type 0, "ortho" is type 1 */
+       char *name_str = "CamData";
+       static char *kwlist[] = { "type_str", "name_str", NULL };
+       PyObject *pycam;        /* for Camera Data object wrapper in Python */
+       Camera *blcam;          /* for actual Camera Data we create in Blender */
+       char buf[21];
+
+       /* Parse the arguments passed in by the Python interpreter */
+       if( !PyArg_ParseTupleAndKeywords( args, kwords, "|ss", kwlist,
+                                         &type_str, &name_str ) )
+               /* We expected string(s) (or nothing) as argument, but we didn't get that. */
+               return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                                             "expected zero, one or two strings as arguments" );
+
+       blcam = add_camera(  ); /* first create the Camera Data in Blender */
+
+       if( blcam )             /* now create the wrapper obj in Python */
+               pycam = Camera_CreatePyObject( blcam );
+       else
+               return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+                                             "couldn't create Camera Data in Blender" );
+
+       /* let's return user count to zero, because ... */
+       blcam->id.us = 0;       /* ... add_camera() incref'ed it */
+       /* XXX XXX Do this in other modules, too */
+
+       if( pycam == NULL )
+               return EXPP_ReturnPyObjError( PyExc_MemoryError,
+                                             "couldn't create Camera PyObject" );
+
+       if( strcmp( type_str, "persp" ) == 0 )
+               /* default, no need to set, so */
+               /*blcam->type =