diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c
index b9557b86b8a50f37873176f4796d46c5367ba99f..dd93e4114b0750106ee6daada07d8630171d3ab3 100644
--- a/source/blender/python/api2_2x/Object.c
+++ b/source/blender/python/api2_2x/Object.c
@@ -17,7 +17,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Inc., 59 Temple Place - Suite 330, Boston, MA	02111-1307, USA.
  *
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
@@ -35,7 +35,7 @@
 #include "Object.h"
 
 /*****************************************************************************/
-/* Python API function prototypes for the Blender module.                    */
+/* Python API function prototypes for the Blender module.										 */
 /*****************************************************************************/
 static PyObject *M_Object_New(PyObject *self, PyObject *args);
 PyObject *M_Object_Get(PyObject *self, PyObject *args);
@@ -44,9 +44,9 @@ static PyObject *M_Object_GetSelected (PyObject *self, PyObject *args);
 static PyObject *M_Object_getSelected (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.Object.__doc__                                                    */
+/* The following string definitions are used for documentation strings.			 */
+/* In Python these will be written to the console when doing a							 */
+/* Blender.Object.__doc__																										 */
 /*****************************************************************************/
 char M_Object_doc[] =
 "The Blender Object module\n\n\
@@ -57,33 +57,33 @@ char M_Object_New_doc[] =
 
 char M_Object_Get_doc[] =
 "(name) - return the object with the name 'name', returns None if not\
-    found.\n\
-    If 'name' is not specified, it returns a list of all objects in the\n\
-    current scene.";
+		found.\n\
+		If 'name' is not specified, it returns a list of all objects in the\n\
+		current scene.";
 
 char M_Object_GetSelected_doc[] =
 "() - Returns a list of selected Objects in the active layer(s)\n\
 The active object is the first in the list, if visible";
 
 /*****************************************************************************/
-/* Python method structure definition for Blender.Object module:             */
+/* Python method structure definition for Blender.Object module:						 */
 /*****************************************************************************/
 struct PyMethodDef M_Object_methods[] = {
-    {"New",         (PyCFunction)M_Object_New,         METH_VARARGS,
-                    M_Object_New_doc},
-    {"Get",         (PyCFunction)M_Object_Get,         METH_VARARGS,
-                    M_Object_Get_doc},
-    {"get",         (PyCFunction)M_Object_get,         METH_VARARGS,
-                    M_Object_Get_doc},
-    {"GetSelected", (PyCFunction)M_Object_GetSelected, METH_VARARGS,
-                    M_Object_GetSelected_doc},
-    {"getSelected", (PyCFunction)M_Object_getSelected, METH_VARARGS,
-                    M_Object_GetSelected_doc},
-    {NULL, NULL, 0, NULL}
+		{"New",					(PyCFunction)M_Object_New,				 METH_VARARGS,
+										M_Object_New_doc},
+		{"Get",					(PyCFunction)M_Object_Get,				 METH_VARARGS,
+										M_Object_Get_doc},
+		{"get",					(PyCFunction)M_Object_get,				 METH_VARARGS,
+										M_Object_Get_doc},
+		{"GetSelected", (PyCFunction)M_Object_GetSelected, METH_VARARGS,
+										M_Object_GetSelected_doc},
+		{"getSelected", (PyCFunction)M_Object_getSelected, METH_VARARGS,
+										M_Object_GetSelected_doc},
+		{NULL, NULL, 0, NULL}
 };
 
 /*****************************************************************************/
-/* Python BPy_Object methods declarations:                                     */
+/* Python BPy_Object methods declarations:																		 */
 /*****************************************************************************/
 static PyObject *Object_buildParts (BPy_Object *self);
 static PyObject *Object_clrParent (BPy_Object *self, PyObject *args);
@@ -115,1552 +115,1566 @@ static PyObject *Object_setName (BPy_Object *self, PyObject *args);
 static PyObject *Object_shareFrom (BPy_Object *self, PyObject *args);
 
 /*****************************************************************************/
-/* Python BPy_Object methods table:                                            */
+/* Python BPy_Object methods table:																						 */
 /*****************************************************************************/
 static PyMethodDef BPy_Object_methods[] = {
-    /* name, method, flags, doc */
-    {"buildParts",        (PyCFunction)Object_buildParts,        METH_NOARGS,
-        "Recalcs particle system (if any) "},  
-{"clrParent",        (PyCFunction)Object_clrParent,        METH_VARARGS,
-        "Clears parent object. Optionally specify:\n\
+		/* name, method, flags, doc */
+		{"buildParts",				(PyCFunction)Object_buildParts,				 METH_NOARGS,
+				"Recalcs particle system (if any) "},  
+{"clrParent",				 (PyCFunction)Object_clrParent,				 METH_VARARGS,
+				"Clears parent object. Optionally specify:\n\
 mode\n\t2: Keep object transform\nfast\n\t>0: Don't update scene \
 hierarchy (faster)"},
-    {"getData",          (PyCFunction)Object_getData,          METH_NOARGS,
-        "Returns the datablock object containing the object's data, \
+		{"getData",					 (PyCFunction)Object_getData,					 METH_NOARGS,
+				"Returns the datablock object containing the object's data, \
 e.g. Mesh"},
-    {"getDeltaLocation", (PyCFunction)Object_getDeltaLocation, METH_NOARGS,
-        "Returns the object's delta location (x, y, z)"},
-    {"getDrawMode",      (PyCFunction)Object_getDrawMode,      METH_NOARGS,
-        "Returns the object draw modes"},
-    {"getDrawType",      (PyCFunction)Object_getDrawType,      METH_NOARGS,
-        "Returns the object draw type"},
-    {"getEuler",         (PyCFunction)Object_getEuler,         METH_NOARGS,
-        "Returns the object's rotation as Euler rotation vector\n\
+		{"getDeltaLocation", (PyCFunction)Object_getDeltaLocation, METH_NOARGS,
+				"Returns the object's delta location (x, y, z)"},
+		{"getDrawMode",			 (PyCFunction)Object_getDrawMode,			 METH_NOARGS,
+				"Returns the object draw modes"},
+		{"getDrawType",			 (PyCFunction)Object_getDrawType,			 METH_NOARGS,
+				"Returns the object draw type"},
+		{"getEuler",				 (PyCFunction)Object_getEuler,				 METH_NOARGS,
+				"Returns the object's rotation as Euler rotation vector\n\
 (rotX, rotY, rotZ)"},
-    {"getInverseMatrix", (PyCFunction)Object_getInverseMatrix, METH_NOARGS,
-        "Returns the object's inverse matrix"},
-    {"getLocation",      (PyCFunction)Object_getLocation,      METH_VARARGS,
-        "Returns the object's location (x, y, z)"},
-    {"getMaterials",     (PyCFunction)Object_getMaterials,     METH_NOARGS,
-        "Returns list of materials assigned to the object"},
-    {"getMatrix",        (PyCFunction)Object_getMatrix,        METH_NOARGS,
-        "Returns the object matrix"},
-    {"getName",          (PyCFunction)Object_getName,          METH_NOARGS,
-        "Returns the name of the object"},
-    {"getParent",        (PyCFunction)Object_getParent,        METH_NOARGS,
-        "Returns the object's parent object"},
-    {"getTracked",       (PyCFunction)Object_getTracked,       METH_NOARGS,
-        "Returns the object's tracked object"},
-    {"getType",          (PyCFunction)Object_getType,          METH_NOARGS,
-        "Returns type of string of Object"},
-    {"getBoundBox",      (PyCFunction)Object_getBoundBox,      METH_NOARGS,
-        "Returns the object's bounding box"},
-    {"makeDisplayList",  (PyCFunction)Object_makeDisplayList,  METH_NOARGS,
-        "Update this object's Display List. Some changes like turning \n\
+		{"getInverseMatrix", (PyCFunction)Object_getInverseMatrix, METH_NOARGS,
+				"Returns the object's inverse matrix"},
+		{"getLocation",			 (PyCFunction)Object_getLocation,			 METH_VARARGS,
+				"Returns the object's location (x, y, z)"},
+		{"getMaterials",		 (PyCFunction)Object_getMaterials,		 METH_NOARGS,
+				"Returns list of materials assigned to the object"},
+		{"getMatrix",				 (PyCFunction)Object_getMatrix,				 METH_NOARGS,
+				"Returns the object matrix"},
+		{"getName",					 (PyCFunction)Object_getName,					 METH_NOARGS,
+				"Returns the name of the object"},
+		{"getParent",				 (PyCFunction)Object_getParent,				 METH_NOARGS,
+				"Returns the object's parent object"},
+		{"getTracked",			 (PyCFunction)Object_getTracked,			 METH_NOARGS,
+				"Returns the object's tracked object"},
+		{"getType",					 (PyCFunction)Object_getType,					 METH_NOARGS,
+				"Returns type of string of Object"},
+		{"getBoundBox",			 (PyCFunction)Object_getBoundBox,			 METH_NOARGS,
+				"Returns the object's bounding box"},
+		{"makeDisplayList",  (PyCFunction)Object_makeDisplayList,  METH_NOARGS,
+				"Update this object's Display List. Some changes like turning \n\
 'SubSurf' on for a mesh need this method (followed by a Redraw) to \n\
 show the changes on the 3d window."},
-    {"link",             (PyCFunction)Object_link,             METH_VARARGS,
-        "Links Object with data provided in the argument. The data must \n\
+		{"link",						 (PyCFunction)Object_link,						 METH_VARARGS,
+				"Links Object with data provided in the argument. The data must \n\
 match the Object's type, so you cannot link a Lamp to a Mesh type object."},
-    {"makeParent",       (PyCFunction)Object_makeParent,       METH_VARARGS,
-        "Makes the object the parent of the objects provided in the \n\
+		{"makeParent",			 (PyCFunction)Object_makeParent,			 METH_VARARGS,
+				"Makes the object the parent of the objects provided in the \n\
 argument which must be a list of valid Objects. Optional extra arguments:\n\
 mode:\n\t0: make parent with inverse\n\t1: without inverse\n\
 fase:\n\t0: update scene hierarchy automatically\n\t\
 don't update scene hierarchy (faster). In this case, you must\n\t\
 explicitely update the Scene hierarchy."},
-    {"materialUsage",    (PyCFunction)Object_materialUsage,    METH_VARARGS,
-        "Determines the way the material is used and returs status.\n\
+		{"materialUsage",		 (PyCFunction)Object_materialUsage,		 METH_VARARGS,
+				"Determines the way the material is used and returs status.\n\
 Possible arguments (provide as strings):\n\
-\tData:   Materials assigned to the object's data are shown. (default)\n\
+\tData:		Materials assigned to the object's data are shown. (default)\n\
 \tObject: Materials assigned to the object are shown."},
-    {"setDeltaLocation", (PyCFunction)Object_setDeltaLocation, METH_VARARGS,
-        "Sets the object's delta location which must be a vector triple."},
-    {"setDrawMode",      (PyCFunction)Object_setDrawMode,      METH_VARARGS,
-        "Sets the object's drawing mode. The argument can be a sum of:\n\
-2:  axis\n4:  texspace\n8:  drawname\n16: drawimage\n32: drawwire"},
-    {"setDrawType",      (PyCFunction)Object_setDrawType,      METH_VARARGS,
-        "Sets the object's drawing type. The argument must be one of:\n\
+		{"setDeltaLocation", (PyCFunction)Object_setDeltaLocation, METH_VARARGS,
+				"Sets the object's delta location which must be a vector triple."},
+		{"setDrawMode",			 (PyCFunction)Object_setDrawMode,			 METH_VARARGS,
+				"Sets the object's drawing mode. The argument can be a sum of:\n\
+2:	axis\n4:	texspace\n8:	drawname\n16: drawimage\n32: drawwire"},
+		{"setDrawType",			 (PyCFunction)Object_setDrawType,			 METH_VARARGS,
+				"Sets the object's drawing type. The argument must be one of:\n\
 1: Bounding box\n2: Wire\n3: Solid\n4: Shaded\n5: Textured"},
-    {"setEuler",         (PyCFunction)Object_setEuler,         METH_VARARGS,
-        "Set the object's rotation according to the specified Euler\n\
+		{"setEuler",				 (PyCFunction)Object_setEuler,				 METH_VARARGS,
+				"Set the object's rotation according to the specified Euler\n\
 angles. The argument must be a vector triple"},
-    {"setLocation",      (PyCFunction)Object_setLocation,      METH_VARARGS,
-        "Set the object's location. The first argument must be a vector\n\
+		{"setLocation",			 (PyCFunction)Object_setLocation,			 METH_VARARGS,
+				"Set the object's location. The first argument must be a vector\n\
 triple."},
-    {"setMaterials",     (PyCFunction)Object_setMaterials,     METH_VARARGS,
-        "Sets materials. The argument must be a list of valid material\n\
+		{"setMaterials",		 (PyCFunction)Object_setMaterials,		 METH_VARARGS,
+				"Sets materials. The argument must be a list of valid material\n\
 objects."},
-    {"setName",          (PyCFunction)Object_setName,          METH_VARARGS,
-        "Sets the name of the object"},
-    {"shareFrom",        (PyCFunction)Object_shareFrom,        METH_VARARGS,
-        "Link data of self with object specified in the argument. This\n\
+		{"setName",					 (PyCFunction)Object_setName,					 METH_VARARGS,
+				"Sets the name of the object"},
+		{"shareFrom",				 (PyCFunction)Object_shareFrom,				 METH_VARARGS,
+				"Link data of self with object specified in the argument. This\n\
 works only if self and the object specified are of the same type."},
-    {0}
+		{0}
 };
 
 /*****************************************************************************/
-/* PythonTypeObject callback function prototypes                             */
+/* PythonTypeObject callback function prototypes														 */
 /*****************************************************************************/
-static void      Object_dealloc (BPy_Object *obj);
+static void			 Object_dealloc (BPy_Object *obj);
 static PyObject* Object_getAttr (BPy_Object *obj, char *name);
-static int       Object_setAttr (BPy_Object *obj, char *name, PyObject *v);
-static PyObject* Object_repr    (BPy_Object *obj);
-static int       Object_compare (BPy_Object *a, BPy_Object *b);
+static int			 Object_setAttr (BPy_Object *obj, char *name, PyObject *v);
+static PyObject* Object_repr		(BPy_Object *obj);
+static int			 Object_compare (BPy_Object *a, BPy_Object *b);
 
 /*****************************************************************************/
-/* Python TypeObject structure definition.                                   */
+/* Python TypeObject structure definition.																	 */
 /*****************************************************************************/
 PyTypeObject Object_Type =
 {
-    PyObject_HEAD_INIT(NULL)
-    0,                                /* ob_size */
-    "Blender Object",                 /* tp_name */
-    sizeof (BPy_Object),              /* tp_basicsize */
-    0,                                /* tp_itemsize */
-    /* methods */
-    (destructor)Object_dealloc,       /* tp_dealloc */
-    0,                                /* tp_print */
-    (getattrfunc)Object_getAttr,      /* tp_getattr */
-    (setattrfunc)Object_setAttr,      /* tp_setattr */
-    (cmpfunc)Object_compare,          /* tp_compare */
-    (reprfunc)Object_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_Object_methods,               /* tp_methods */
-    0,                                /* tp_members */
+		PyObject_HEAD_INIT(NULL)
+		0,																/* ob_size */
+		"Blender Object",									/* tp_name */
+		sizeof (BPy_Object),							/* tp_basicsize */
+		0,																/* tp_itemsize */
+		/* methods */
+		(destructor)Object_dealloc,				/* tp_dealloc */
+		0,																/* tp_print */
+		(getattrfunc)Object_getAttr,			/* tp_getattr */
+		(setattrfunc)Object_setAttr,			/* tp_setattr */
+		(cmpfunc)Object_compare,					/* tp_compare */
+		(reprfunc)Object_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_Object_methods,								/* tp_methods */
+		0,																/* tp_members */
 };
 
 /*****************************************************************************/
-/* Function:              M_Object_New                                       */
-/* Python equivalent:     Blender.Object.New                                 */
+/* Function:							M_Object_New																			 */
+/* Python equivalent:			Blender.Object.New																 */
 /*****************************************************************************/
 PyObject *M_Object_New(PyObject *self, PyObject *args)
 {
-    struct Object   * object;
-    BPy_Object      * blen_object;
-    int               type;
-    char            * str_type;
-    char            * name = NULL;
-
-    if (!PyArg_ParseTuple(args, "s|s", &str_type, &name))
-    {
-        PythonReturnErrorObject (PyExc_TypeError,
-                    "string expected as argument");
-        return (NULL);
-    }
-
-    if (strcmp (str_type, "Armature") == 0)     type = OB_ARMATURE;
-    else if (strcmp (str_type, "Camera") == 0)  type = OB_CAMERA;
-    else if (strcmp (str_type, "Curve") == 0)   type = OB_CURVE;
-/*    else if (strcmp (str_type, "Text") == 0)    type = OB_FONT; */
-/*    else if (strcmp (str_type, "Ika") == 0)     type = OB_IKA; */
-    else if (strcmp (str_type, "Lamp") == 0)    type = OB_LAMP;
-/*    else if (strcmp (str_type, "Lattice") == 0) type = OB_LATTICE; */
-/*    else if (strcmp (str_type, "Mball") == 0)   type = OB_MBALL; */
-    else if (strcmp (str_type, "Mesh") == 0)    type = OB_MESH;
-/*    else if (strcmp (str_type, "Surf") == 0)    type = OB_SURF; */
-/*    else if (strcmp (str_type, "Wave") == 0)    type = OB_WAVE; */
-    else if (strcmp (str_type, "Empty") == 0)   type = OB_EMPTY;
-    else
-    {
-        return (PythonReturnErrorObject (PyExc_AttributeError,
-            "Unknown type specified"));
-    }
-
-    /* Create a new object. */
-    if (name == NULL)
-    {
-        /* No name is specified, set the name to the type of the object. */
-        name = str_type;
-    }
-    object = alloc_libblock (&(G.main->object), ID_OB, name);
-
-    object->flag = 0;
-    object->type = type;
-
-    /* transforms */
-    QuatOne(object->quat);
-    QuatOne(object->dquat);
-    
-    object->col[3]= 1.0;    // alpha 
-
-    object->size[0] = object->size[1] = object->size[2] = 1.0;
-    object->loc[0] = object->loc[1] = object->loc[2] = 0.0;
-    Mat4One(object->parentinv);
-    Mat4One(object->obmat);
-    object->dt = OB_SHADED; // drawtype
-
-    if (U.flag & MAT_ON_OB)
-    {
-        object->colbits = -1;
-    }
-    switch (object->type)
-    {
-        case OB_CAMERA: /* fall through. */
-        case OB_LAMP:
-            object->trackflag = OB_NEGZ;
-            object->upflag = OB_POSY;
-            break;
-        default:
-            object->trackflag = OB_POSY;
-            object->upflag = OB_POSZ;
-    }
-    object->ipoflag = OB_OFFS_OB + OB_OFFS_PARENT;
-
-    /* duplivert settings */
-    object->dupon = 1;
-    object->dupoff = 0;
-    object->dupsta = 1;
-    object->dupend = 100;
-
-    /* Gameengine defaults*/
-    object->mass = 1.0;
-    object->inertia = 1.0;
-    object->formfactor = 0.4;
-    object->damping = 0.04;
-    object->rdamping = 0.1;
-    object->anisotropicFriction[0] = 1.0;
-    object->anisotropicFriction[1] = 1.0;
-    object->anisotropicFriction[2] = 1.0;
-    object->gameflag = OB_PROP;
-    
-    object->lay = 1; // Layer, by default visible
-    G.totobj++;
+		struct Object		* object;
+		BPy_Object			* blen_object;
+		int								type;
+		char						* str_type;
+		char						* name = NULL;
+
+		if (!PyArg_ParseTuple(args, "s|s", &str_type, &name))
+		{
+				PythonReturnErrorObject (PyExc_TypeError,
+										"string expected as argument");
+				return (NULL);
+		}
+
+		if (strcmp (str_type, "Armature") == 0)			type = OB_ARMATURE;
+		else if (strcmp (str_type, "Camera") == 0)	type = OB_CAMERA;
+		else if (strcmp (str_type, "Curve") == 0)		type = OB_CURVE;
+/*		else if (strcmp (str_type, "Text") == 0)		type = OB_FONT; */
+/*		else if (strcmp (str_type, "Ika") == 0)			type = OB_IKA; */
+		else if (strcmp (str_type, "Lamp") == 0)		type = OB_LAMP;
+/*		else if (strcmp (str_type, "Lattice") == 0) type = OB_LATTICE; */
+/*		else if (strcmp (str_type, "Mball") == 0)		type = OB_MBALL; */
+		else if (strcmp (str_type, "Mesh") == 0)		type = OB_MESH;
+/*		else if (strcmp (str_type, "Surf") == 0)		type = OB_SURF; */
+/*		else if (strcmp (str_type, "Wave") == 0)		type = OB_WAVE; */
+		else if (strcmp (str_type, "Empty") == 0)		type = OB_EMPTY;
+		else
+		{
+				return (PythonReturnErrorObject (PyExc_AttributeError,
+						"Unknown type specified"));
+		}
+
+		/* Create a new object. */
+		if (name == NULL)
+		{
+				/* No name is specified, set the name to the type of the object. */
+				name = str_type;
+		}
+		object = alloc_libblock (&(G.main->object), ID_OB, name);
+
+		object->flag = 0;
+		object->type = type;
+
+		/* transforms */
+		QuatOne(object->quat);
+		QuatOne(object->dquat);
+		
+		object->col[3]= 1.0;		// alpha 
+
+		object->size[0] = object->size[1] = object->size[2] = 1.0;
+		object->loc[0] = object->loc[1] = object->loc[2] = 0.0;
+		Mat4One(object->parentinv);
+		Mat4One(object->obmat);
+		object->dt = OB_SHADED; // drawtype
+
+		if (U.flag & MAT_ON_OB)
+		{
+				object->colbits = -1;
+		}
+		switch (object->type)
+		{
+				case OB_CAMERA: /* fall through. */
+				case OB_LAMP:
+						object->trackflag = OB_NEGZ;
+						object->upflag = OB_POSY;
+						break;
+				default:
+						object->trackflag = OB_POSY;
+						object->upflag = OB_POSZ;
+		}
+		object->ipoflag = OB_OFFS_OB + OB_OFFS_PARENT;
+
+		/* duplivert settings */
+		object->dupon = 1;
+		object->dupoff = 0;
+		object->dupsta = 1;
+		object->dupend = 100;
+
+		/* Gameengine defaults*/
+		object->mass = 1.0;
+		object->inertia = 1.0;
+		object->formfactor = 0.4;
+		object->damping = 0.04;
+		object->rdamping = 0.1;
+		object->anisotropicFriction[0] = 1.0;
+		object->anisotropicFriction[1] = 1.0;
+		object->anisotropicFriction[2] = 1.0;
+		object->gameflag = OB_PROP;
+		
+		object->lay = 1; // Layer, by default visible
+		G.totobj++;
 
 		object->data = NULL;
 
-    /* Create a Python object from it. */
-    blen_object = (BPy_Object*)PyObject_NEW (BPy_Object, &Object_Type); 
-    blen_object->object = object;
+		/* Create a Python object from it. */
+		blen_object = (BPy_Object*)PyObject_NEW (BPy_Object, &Object_Type); 
+		blen_object->object = object;
 
-    return ((PyObject*)blen_object);
+		return ((PyObject*)blen_object);
 }
 
 /*****************************************************************************/
-/* Function:              M_Object_Get                                       */
-/* Python equivalent:     Blender.Object.Get                                 */
+/* Function:							M_Object_Get																			 */
+/* Python equivalent:			Blender.Object.Get																 */
 /*****************************************************************************/
 PyObject *M_Object_Get(PyObject *self, PyObject *args)
 {
-    struct Object   * object;
-    BPy_Object      * blen_object;
-    char            * name = NULL;
-
-    PyArg_ParseTuple(args, "|s", &name);
-
-    if (name != NULL)
-    {
-        object = GetObjectByName (name);
-
-        if (object == NULL)
-        {
-            /* No object exists with the name specified in the argument name. */
-            return (PythonReturnErrorObject (PyExc_AttributeError,
-                        "Unknown object specified."));
-        }
-        blen_object = (BPy_Object*)PyObject_NEW (BPy_Object, &Object_Type); 
-        blen_object->object = object;
-
-        return ((PyObject*)blen_object);
-    }
-    else
-    {
-        /* No argument has been given. Return a list of all objects. */
-        PyObject    * obj_list;
-        Link        * link;
-        int           index;
-
-        obj_list = PyList_New (BLI_countlist (&(G.main->object)));
-
-        if (obj_list == NULL)
-        {
-            return (PythonReturnErrorObject (PyExc_SystemError,
-                    "List creation failed."));
-        }
-
-        link = G.main->object.first;
-        index = 0;
-        while (link)
-        {
-            object = (Object*)link;
-            blen_object = (BPy_Object*)PyObject_NEW (BPy_Object, &Object_Type);
-            blen_object->object = object;
-
-            PyList_SetItem (obj_list, index, (PyObject*)blen_object);
-            index++;
-            link = link->next;
-        }
-        return (obj_list);
-    }
+		struct Object		* object;
+		BPy_Object			* blen_object;
+		char						* name = NULL;
+
+		PyArg_ParseTuple(args, "|s", &name);
+
+		if (name != NULL)
+		{
+				object = GetObjectByName (name);
+
+				if (object == NULL)
+				{
+						/* No object exists with the name specified in the argument name. */
+						return (PythonReturnErrorObject (PyExc_AttributeError,
+												"Unknown object specified."));
+				}
+				blen_object = (BPy_Object*)PyObject_NEW (BPy_Object, &Object_Type); 
+				blen_object->object = object;
+
+				return ((PyObject*)blen_object);
+		}
+		else
+		{
+				/* No argument has been given. Return a list of all objects. */
+				PyObject		* obj_list;
+				Link				* link;
+				int						index;
+
+				obj_list = PyList_New (BLI_countlist (&(G.main->object)));
+
+				if (obj_list == NULL)
+				{
+						return (PythonReturnErrorObject (PyExc_SystemError,
+										"List creation failed."));
+				}
+
+				link = G.main->object.first;
+				index = 0;
+				while (link)
+				{
+						object = (Object*)link;
+						blen_object = (BPy_Object*)PyObject_NEW (BPy_Object, &Object_Type);
+						blen_object->object = object;
+
+						PyList_SetItem (obj_list, index, (PyObject*)blen_object);
+						index++;
+						link = link->next;
+				}
+				return (obj_list);
+		}
 }
 
 /*****************************************************************************/
-/* Function:              M_Object_get                                       */
-/* Python equivalent:     Blender.Object.get                                 */
+/* Function:							M_Object_get																			 */
+/* Python equivalent:			Blender.Object.get																 */
 /*****************************************************************************/
 PyObject *M_Object_get(PyObject *self, PyObject *args)
 {
-    PyErr_Warn (PyExc_DeprecationWarning,
-                "The Object.get() function will be removed in Blender 2.29\n" \
-                "Please update the script to use Object.Get");
-    return (M_Object_Get (self, args));
+		PyErr_Warn (PyExc_DeprecationWarning,
+								"The Object.get() function will be removed in Blender 2.29\n" \
+								"Please update the script to use Object.Get");
+		return (M_Object_Get (self, args));
 }
 
 /*****************************************************************************/
-/* Function:              M_Object_GetSelected                               */
-/* Python equivalent:     Blender.Object.getSelected                         */
+/* Function:							M_Object_GetSelected															 */
+/* Python equivalent:			Blender.Object.getSelected												 */
 /*****************************************************************************/
 static PyObject *M_Object_GetSelected (PyObject *self, PyObject *args)
 {
-    BPy_Object        * blen_object;
-    PyObject        * list;
-    Base            * base_iter;
-
-    list = PyList_New (0);
-    if ((G.scene->basact) &&
-        ((G.scene->basact->flag & SELECT) &&
-         (G.scene->basact->lay & G.vd->lay)))
-    {
-        /* Active object is first in the list. */
-        blen_object = (BPy_Object*)PyObject_NEW (BPy_Object, &Object_Type); 
-        if (blen_object == NULL)
-        {
-            Py_DECREF (list);
-            Py_INCREF (Py_None);
-            return (Py_None);
-        }
-        blen_object->object = G.scene->basact->object;
-        PyList_Append (list, (PyObject*)blen_object);
-    }
-
-    base_iter = G.scene->base.first;
-    while (base_iter)
-    {
-        if (((base_iter->flag & SELECT) &&
-             (base_iter->lay & G.vd->lay)) &&
-            (base_iter != G.scene->basact))
-        {
-            blen_object = (BPy_Object*)PyObject_NEW (BPy_Object, &Object_Type); 
-            if (blen_object == NULL)
-            {
-                Py_DECREF (list);
-                Py_INCREF (Py_None);
-                return (Py_None);
-            }
-            blen_object->object = base_iter->object;
-            PyList_Append (list, (PyObject*)blen_object);
-        }
-        base_iter = base_iter->next;
-    }
-    return (list);
+		BPy_Object				* blen_object;
+		PyObject				* list;
+		Base						* base_iter;
+
+		list = PyList_New (0);
+		if ((G.scene->basact) &&
+				((G.scene->basact->flag & SELECT) &&
+				 (G.scene->basact->lay & G.vd->lay)))
+		{
+				/* Active object is first in the list. */
+				blen_object = (BPy_Object*)PyObject_NEW (BPy_Object, &Object_Type); 
+				if (blen_object == NULL)
+				{
+						Py_DECREF (list);
+						Py_INCREF (Py_None);
+						return (Py_None);
+				}
+				blen_object->object = G.scene->basact->object;
+				PyList_Append (list, (PyObject*)blen_object);
+		}
+
+		base_iter = G.scene->base.first;
+		while (base_iter)
+		{
+				if (((base_iter->flag & SELECT) &&
+						 (base_iter->lay & G.vd->lay)) &&
+						(base_iter != G.scene->basact))
+				{
+						blen_object = (BPy_Object*)PyObject_NEW (BPy_Object, &Object_Type); 
+						if (blen_object == NULL)
+						{
+								Py_DECREF (list);
+								Py_INCREF (Py_None);
+								return (Py_None);
+						}
+						blen_object->object = base_iter->object;
+						PyList_Append (list, (PyObject*)blen_object);
+				}
+				base_iter = base_iter->next;
+		}
+		return (list);
 }
 
 /*****************************************************************************/
-/* Function:              M_Object_getSelected                               */
-/* Python equivalent:     Blender.Object.getSelected                         */
+/* Function:							M_Object_getSelected															 */
+/* Python equivalent:			Blender.Object.getSelected												 */
 /*****************************************************************************/
 static PyObject *M_Object_getSelected (PyObject *self, PyObject *args)
 {
-    PyErr_Warn (PyExc_DeprecationWarning,
-                "The Object.getSelected() function will be removed in "\
-                "Blender 2.29\n" \
-                "Please update the script to use Object.GetSelected");
-    return (M_Object_GetSelected (self, args));
+		PyErr_Warn (PyExc_DeprecationWarning,
+								"The Object.getSelected() function will be removed in "\
+								"Blender 2.29\n" \
+								"Please update the script to use Object.GetSelected");
+		return (M_Object_GetSelected (self, args));
 }
 
 /*****************************************************************************/
-/* Function:              initObject                                         */
+/* Function:							initObject																				 */
 /*****************************************************************************/
 PyObject *Object_Init (void)
 {
-    PyObject    * module;
+		PyObject		* module;
 
-    Object_Type.ob_type = &PyType_Type;
+		Object_Type.ob_type = &PyType_Type;
 
-    module = Py_InitModule3("Blender.Object", M_Object_methods, M_Object_doc);
+		module = Py_InitModule3("Blender.Object", M_Object_methods, M_Object_doc);
 
-    return (module);
+		return (module);
 }
 
 /*****************************************************************************/
-/* Python BPy_Object methods:                                                  */
+/* Python BPy_Object methods:																									 */
 /*****************************************************************************/
 
 
 static PyObject *Object_buildParts (BPy_Object *self)
 {
 void build_particle_system(Object *ob);
-  struct Object *obj = self->object;
-  build_particle_system( obj);
-  Py_INCREF (Py_None);
-            return (Py_None);
+	struct Object *obj = self->object;
+	build_particle_system( obj);
+	Py_INCREF (Py_None);
+						return (Py_None);
 }
 
 static PyObject *Object_clrParent (BPy_Object *self, PyObject *args)
 {
-    int       mode=0;
-    int       fast=0;
-
-    if (!PyArg_ParseTuple (args, "|ii", &mode, &fast))
-    {
-        return (PythonReturnErrorObject (PyExc_AttributeError,
-            "expected one or two integers as arguments"));
-    }
-
-    /* Remove the link only, the object is still in the scene. */
-    self->object->parent = NULL;
-
-    if (mode == 2)
-    {
-        /* Keep transform */
-        apply_obmat (self->object);
-    }
-
-    if (!fast)
-    {
-        sort_baselist (G.scene);
-    }
-
-    Py_INCREF (Py_None);
-    return (Py_None);
+		int				mode=0;
+		int				fast=0;
+
+		if (!PyArg_ParseTuple (args, "|ii", &mode, &fast))
+		{
+				return (PythonReturnErrorObject (PyExc_AttributeError,
+						"expected one or two integers as arguments"));
+		}
+
+		/* Remove the link only, the object is still in the scene. */
+		self->object->parent = NULL;
+
+		if (mode == 2)
+		{
+				/* Keep transform */
+				apply_obmat (self->object);
+		}
+
+		if (!fast)
+		{
+				sort_baselist (G.scene);
+		}
+
+		Py_INCREF (Py_None);
+		return (Py_None);
+}
+
+/* adds object data to a Blender object, if object->data = NULL */
+int EXPP_add_obdata(struct Object *object)
+{
+	if (object->data != NULL) return -1;
+
+	switch(object->type)
+	{
+		case OB_ARMATURE:
+		/* TODO: Do we need to add something to G? (see the OB_LAMP case) */
+			object->data = add_armature();
+			break;
+		case OB_CAMERA:
+			/* TODO: Do we need to add something to G? (see the OB_LAMP case) */
+			object->data = add_camera();
+			break;
+		case OB_CURVE:
+			object->data = add_curve(OB_CURVE);
+			G.totcurve++;
+			break;
+		case OB_LAMP:
+			object->data = add_lamp();
+			G.totlamp++;
+			break;
+		case OB_MESH:
+			object->data = add_mesh();
+			G.totmesh++;
+			break;
+
+		/* TODO the following types will be supported later
+		case OB_SURF:
+			object->data = add_curve(OB_SURF);
+			G.totcurve++;
+			break;
+		case OB_FONT:
+			object->data = add_curve(OB_FONT);
+			break;
+		case OB_MBALL:
+			object->data = add_mball();
+			break;
+		case OB_IKA:
+			object->data = add_ika();
+			object->dt = OB_WIRE;
+			break;
+		case OB_LATTICE:
+			object->data = (void *)add_lattice();
+			object->dt = OB_WIRE;
+			break;
+		case OB_WAVE:
+			object->data = add_wave();
+			break;
+		*/
+		default:
+			break;
+	}
+
+	if (!object->data) return -1;
+
+	return 0;
 }
 
 static PyObject *Object_getData (BPy_Object *self)
 {
-    PyObject  * data_object;
-    Object * object = self->object;
-
-    /* If there's no data associated to the Object, then there's nothing to */
-    /* return. */
-    if (object->data == NULL)
-    {
-      switch(object->type)
-      {
-        case OB_ARMATURE:
-        /* TODO: Do we need to add something to G? (see the OB_LAMP case) */
-            object->data = add_armature();
-            break;
-        case OB_CAMERA:
-        /* TODO: Do we need to add something to G? (see the OB_LAMP case) */
-            object->data = add_camera();
-            break;
-        case OB_CURVE:
-            object->data = add_curve(OB_CURVE);
-            G.totcurve++;
-            break;
-        case OB_LAMP:
-            object->data = add_lamp();
-            G.totlamp++;
-            break;
-        case OB_MESH:
-            object->data = add_mesh();
-            G.totmesh++;
-            break;
-
-      /* TODO the following types will be supported later
-        case OB_SURF:
-            object->data = add_curve(OB_SURF);
-            G.totcurve++;
-            break;
-        case OB_FONT:
-            object->data = add_curve(OB_FONT);
-            break;
-        case OB_MBALL:
-            object->data = add_mball();
-            break;
-        case OB_IKA:
-            object->data = add_ika();
-            object->dt = OB_WIRE;
-            break;
-        case OB_LATTICE:
-            object->data = (void *)add_lattice();
-            object->dt = OB_WIRE;
-            break;
-        case OB_WAVE:
-            object->data = add_wave();
-            break;
-      */
-        default:
-          Py_INCREF (Py_None);
-          return (Py_None);
-      }
-    }
-
-    data_object = NULL;
-
-    switch (object->type)
-    {
-        case OB_ARMATURE:
-            data_object = Armature_CreatePyObject (object->data);
-            break;
-        case OB_CAMERA:
-            data_object = Camera_CreatePyObject (object->data);
-            break;
-        case OB_CURVE:
-            data_object = Curve_CreatePyObject (object->data);
-            break;
-        case ID_IM:
-            data_object = Image_CreatePyObject (object->data);
-            break;
-        case ID_IP:
-            data_object = Ipo_CreatePyObject (object->data);
-            break;
-        case OB_LAMP:
-            data_object = Lamp_CreatePyObject (object->data);
-            break;
-        case ID_MA:
-            break;
-        case OB_MESH:
-            data_object = NMesh_CreatePyObject (object->data, object);
-            break;
-        case ID_OB:
-            data_object = Object_CreatePyObject (object->data);
-            break;
-        case ID_SCE:
-            break;
-        case ID_TXT:
-            data_object = Text_CreatePyObject (object->data);
-            break;
-        case ID_WO:
-            break;
-        default:
-            break;
-    }
-    if (data_object == NULL)
-    {
-        Py_INCREF (Py_None);
-        return (Py_None);
-    }
-    else
-    {
-        return (data_object);
-    }
+		PyObject	* data_object;
+		Object * object = self->object;
+
+		/* if there's no obdata, try to create it */
+		if (object->data == NULL)
+		{
+			if (EXPP_add_obdata(object) != 0)
+			{ /* couldn't create obdata */
+				Py_INCREF (Py_None);
+				return (Py_None);
+			}
+		}
+
+		data_object = NULL;
+
+		switch (object->type)
+		{
+				case OB_ARMATURE:
+						data_object = Armature_CreatePyObject (object->data);
+						break;
+				case OB_CAMERA:
+						data_object = Camera_CreatePyObject (object->data);
+						break;
+				case OB_CURVE:
+						data_object = Curve_CreatePyObject (object->data);
+						break;
+				case ID_IM:
+						data_object = Image_CreatePyObject (object->data);
+						break;
+				case ID_IP:
+						data_object = Ipo_CreatePyObject (object->data);
+						break;
+				case OB_LAMP:
+						data_object = Lamp_CreatePyObject (object->data);
+						break;
+				case ID_MA:
+						break;
+				case OB_MESH:
+						data_object = NMesh_CreatePyObject (object->data, object);
+						break;
+				case ID_OB:
+						data_object = Object_CreatePyObject (object->data);
+						break;
+				case ID_SCE:
+						break;
+				case ID_TXT:
+						data_object = Text_CreatePyObject (object->data);
+						break;
+				case ID_WO:
+						break;
+				default:
+						break;
+		}
+		if (data_object == NULL)
+		{
+				Py_INCREF (Py_None);
+				return (Py_None);
+		}
+		else
+		{
+				return (data_object);
+		}
 }
 
 static PyObject *Object_getDeltaLocation (BPy_Object *self)
 {
-    PyObject *attr = Py_BuildValue ("fff",
-                                    self->object->dloc[0],
-                                    self->object->dloc[1],
-                                    self->object->dloc[2]);
+		PyObject *attr = Py_BuildValue ("fff",
+																		self->object->dloc[0],
+																		self->object->dloc[1],
+																		self->object->dloc[2]);
 
-    if (attr) return (attr);
+		if (attr) return (attr);
 
-    return (PythonReturnErrorObject (PyExc_RuntimeError,
-            "couldn't get Object.dloc attributes"));
+		return (PythonReturnErrorObject (PyExc_RuntimeError,
+						"couldn't get Object.dloc attributes"));
 }
 
 static PyObject *Object_getDrawMode (BPy_Object *self)
 {
-    PyObject *attr = Py_BuildValue ("b", self->object->dtx);
+		PyObject *attr = Py_BuildValue ("b", self->object->dtx);
 
-    if (attr) return (attr);
+		if (attr) return (attr);
 
-    return (PythonReturnErrorObject (PyExc_RuntimeError,
-            "couldn't get Object.drawMode attribute"));
+		return (PythonReturnErrorObject (PyExc_RuntimeError,
+						"couldn't get Object.drawMode attribute"));
 }
 
 static PyObject *Object_getDrawType (BPy_Object *self)
 {
-    PyObject *attr = Py_BuildValue ("b", self->object->dt);
+		PyObject *attr = Py_BuildValue ("b", self->object->dt);
 
-    if (attr) return (attr);
+		if (attr) return (attr);
 
-    return (PythonReturnErrorObject (PyExc_RuntimeError,
-            "couldn't get Object.drawType attribute"));
+		return (PythonReturnErrorObject (PyExc_RuntimeError,
+						"couldn't get Object.drawType attribute"));
 }
 
 static PyObject *Object_getEuler (BPy_Object *self)
 {
-    PyObject *attr = Py_BuildValue ("fff",
-                                    self->object->rot[0],
-                                    self->object->rot[1],
-                                    self->object->rot[2]);
+		PyObject *attr = Py_BuildValue ("fff",
+																		self->object->rot[0],
+																		self->object->rot[1],
+																		self->object->rot[2]);
 
-    if (attr) return (attr);
+		if (attr) return (attr);
 
-    return (PythonReturnErrorObject (PyExc_RuntimeError,
-            "couldn't get Object.drot attributes"));
+		return (PythonReturnErrorObject (PyExc_RuntimeError,
+						"couldn't get Object.drot attributes"));
 }
 
 static PyObject *Object_getInverseMatrix (BPy_Object *self)
 {
-    MatrixObject *inverse = (MatrixObject *)newMatrixObject (NULL);
-    
-    Mat4Invert (inverse->mem, self->object->obmat);
+		MatrixObject *inverse = (MatrixObject *)newMatrixObject (NULL);
+		
+		Mat4Invert (inverse->mem, self->object->obmat);
 
-    return ((PyObject *)inverse);
+		return ((PyObject *)inverse);
 }
 
 static PyObject *Object_getLocation (BPy_Object *self, PyObject *args)
 {
-    PyObject *attr = Py_BuildValue ("fff",
-                                    self->object->loc[0],
-                                    self->object->loc[1],
-                                    self->object->loc[2]);
+		PyObject *attr = Py_BuildValue ("fff",
+																		self->object->loc[0],
+																		self->object->loc[1],
+																		self->object->loc[2]);
 
-    if (attr) return (attr);
+		if (attr) return (attr);
 
-    return (PythonReturnErrorObject (PyExc_RuntimeError,
-            "couldn't get Object.loc attributes"));
+		return (PythonReturnErrorObject (PyExc_RuntimeError,
+						"couldn't get Object.loc attributes"));
 }
 
 static PyObject *Object_getMaterials (BPy_Object *self)
 {
-    return (EXPP_PyList_fromMaterialList (self->object->mat,
-                                          self->object->totcol));
+		return (EXPP_PyList_fromMaterialList (self->object->mat,
+																					self->object->totcol));
 }
 
 static PyObject *Object_getMatrix (BPy_Object *self)
 {
-    Object  * ob;
+		Object	* ob;
 
-    ob = self->object;
+		ob = self->object;
 
-    return (newMatrixObject (ob->obmat));
+		return (newMatrixObject (ob->obmat));
 }
 
 static PyObject *Object_getName (BPy_Object *self)
 {
-    PyObject *attr = Py_BuildValue ("s", self->object->id.name+2);
+		PyObject *attr = Py_BuildValue ("s", self->object->id.name+2);
 
-    if (attr) return (attr);
+		if (attr) return (attr);
 
-    return (PythonReturnErrorObject (PyExc_RuntimeError,
-            "couldn't get the name of the Object"));
+		return (PythonReturnErrorObject (PyExc_RuntimeError,
+						"couldn't get the name of the Object"));
 }
 
 static PyObject *Object_getParent (BPy_Object *self)
 {
-    PyObject *attr;
+		PyObject *attr;
 
-    if (self->object->parent == NULL)
-        return EXPP_incr_ret (Py_None);
+		if (self->object->parent == NULL)
+				return EXPP_incr_ret (Py_None);
 
-    attr = Object_CreatePyObject (self->object->parent);
+		attr = Object_CreatePyObject (self->object->parent);
 
-    if (attr)
-    {
-        return (attr);
-    }
+		if (attr)
+		{
+				return (attr);
+		}
 
-    return (PythonReturnErrorObject (PyExc_RuntimeError,
-            "couldn't get Object.parent attribute"));
+		return (PythonReturnErrorObject (PyExc_RuntimeError,
+						"couldn't get Object.parent attribute"));
 }
 
 static PyObject *Object_getTracked (BPy_Object *self)
 {
-    PyObject    *attr;
+		PyObject		*attr;
 
-    if (self->object->track == NULL)
-        return EXPP_incr_ret (Py_None);
-    
-    attr = Object_CreatePyObject (self->object->track);
+		if (self->object->track == NULL)
+				return EXPP_incr_ret (Py_None);
+		
+		attr = Object_CreatePyObject (self->object->track);
 
-    if (attr)
-    {
-        return (attr);
-    }
+		if (attr)
+		{
+				return (attr);
+		}
 
-    return (PythonReturnErrorObject (PyExc_RuntimeError,
-            "couldn't get Object.track attribute"));
+		return (PythonReturnErrorObject (PyExc_RuntimeError,
+						"couldn't get Object.track attribute"));
 }
 
 static PyObject *Object_getType (BPy_Object *self)
 {
-    switch (self->object->type)
-    {
-        case OB_ARMATURE:   return (Py_BuildValue ("s", "Armature"));
-        case OB_CAMERA:     return (Py_BuildValue ("s", "Camera"));
-        case OB_CURVE:      return (Py_BuildValue ("s", "Curve"));
-        case OB_EMPTY:      return (Py_BuildValue ("s", "Empty"));
-        case OB_FONT:       return (Py_BuildValue ("s", "Text"));
-        case OB_IKA:        return (Py_BuildValue ("s", "Ika"));
-        case OB_LAMP:       return (Py_BuildValue ("s", "Lamp"));
-        case OB_LATTICE:    return (Py_BuildValue ("s", "Lattice"));
-        case OB_MBALL:      return (Py_BuildValue ("s", "MBall"));
-        case OB_MESH:       return (Py_BuildValue ("s", "Mesh"));
-        case OB_SURF:       return (Py_BuildValue ("s", "Surf"));
-        case OB_WAVE:       return (Py_BuildValue ("s", "Wave"));
-        default:            return (Py_BuildValue ("s", "unknown"));
-    }
+		switch (self->object->type)
+		{
+				case OB_ARMATURE:		return (Py_BuildValue ("s", "Armature"));
+				case OB_CAMERA:			return (Py_BuildValue ("s", "Camera"));
+				case OB_CURVE:			return (Py_BuildValue ("s", "Curve"));
+				case OB_EMPTY:			return (Py_BuildValue ("s", "Empty"));
+				case OB_FONT:				return (Py_BuildValue ("s", "Text"));
+				case OB_IKA:				return (Py_BuildValue ("s", "Ika"));
+				case OB_LAMP:				return (Py_BuildValue ("s", "Lamp"));
+				case OB_LATTICE:		return (Py_BuildValue ("s", "Lattice"));
+				case OB_MBALL:			return (Py_BuildValue ("s", "MBall"));
+				case OB_MESH:				return (Py_BuildValue ("s", "Mesh"));
+				case OB_SURF:				return (Py_BuildValue ("s", "Surf"));
+				case OB_WAVE:				return (Py_BuildValue ("s", "Wave"));
+				default:						return (Py_BuildValue ("s", "unknown"));
+		}
 }
 
 static PyObject *Object_getBoundBox (BPy_Object *self)
 {
-  int i;
-  float *vec = NULL;
-  PyObject *vector, *bbox;
-
-  if (!self->object->data)
-    return EXPP_ReturnPyObjError (PyExc_AttributeError,
-      "This object isn't linked to any object data (mesh, curve, etc) yet");
-
-  if (!self->object->bb) {
-    Mesh *me;
-    Curve *curve;
-    switch (self->object->type) {
-      case OB_MESH:
-        me = self->object->data;
-        if (!me->bb) tex_space_mesh(me);
-        vec = (float *)me->bb->vec;
-        break;
-      case OB_CURVE:
-      case OB_FONT:
-      case OB_SURF:
-        curve = self->object->data;
-        if (!curve->bb) tex_space_curve(curve);
-        vec = (float *)curve->bb->vec;
-        break;
-      default:
-        Py_INCREF (Py_None);
-        return Py_None;
-    }
-  }
-  else vec = (float *)self->object->bb->vec;
-
-  if (!vec)
-    return EXPP_ReturnPyObjError (PyExc_RuntimeError,
-          "couldn't retrieve bounding box data");
-
-  bbox = PyList_New(8);
-
-  if (!bbox)
-    return EXPP_ReturnPyObjError (PyExc_MemoryError,
-          "couldn't create pylist");
-
-  for (i = 0; i < 8; i++) {
-    vector = newVectorObject(vec, 3);
-    PyList_SET_ITEM(bbox, i, vector);
-    vec += 3;
-  }
-
-  return bbox;
+	int i;
+	float *vec = NULL;
+	PyObject *vector, *bbox;
+
+	if (!self->object->data)
+		return EXPP_ReturnPyObjError (PyExc_AttributeError,
+			"This object isn't linked to any object data (mesh, curve, etc) yet");
+
+	if (!self->object->bb) {
+		Mesh *me;
+		Curve *curve;
+		switch (self->object->type) {
+			case OB_MESH:
+				me = self->object->data;
+				if (!me->bb) tex_space_mesh(me);
+				vec = (float *)me->bb->vec;
+				break;
+			case OB_CURVE:
+			case OB_FONT:
+			case OB_SURF:
+				curve = self->object->data;
+				if (!curve->bb) tex_space_curve(curve);
+				vec = (float *)curve->bb->vec;
+				break;
+			default:
+				Py_INCREF (Py_None);
+				return Py_None;
+		}
+	}
+	else vec = (float *)self->object->bb->vec;
+
+	if (!vec)
+		return EXPP_ReturnPyObjError (PyExc_RuntimeError,
+					"couldn't retrieve bounding box data");
+
+	bbox = PyList_New(8);
+
+	if (!bbox)
+		return EXPP_ReturnPyObjError (PyExc_MemoryError,
+					"couldn't create pylist");
+
+	for (i = 0; i < 8; i++) {
+		vector = newVectorObject(vec, 3);
+		PyList_SET_ITEM(bbox, i, vector);
+		vec += 3;
+	}
+
+	return bbox;
 }
 
 static PyObject *Object_makeDisplayList (BPy_Object *self)
 {
-  Object *ob = self->object;
+	Object *ob = self->object;
 
-  if (ob->type == OB_FONT) text_to_curve(ob, 0);
+	if (ob->type == OB_FONT) text_to_curve(ob, 0);
 
-  makeDispList(ob);
+	makeDispList(ob);
 
-  Py_INCREF (Py_None);
-  return Py_None;
+	Py_INCREF (Py_None);
+	return Py_None;
 }
 
 static PyObject *Object_link (BPy_Object *self, PyObject *args)
 {
-    PyObject    * py_data;
-    ID          * id;
-    ID          * oldid;
-    int           obj_id;
-    void        * data = NULL;
-
-    if (!PyArg_ParseTuple (args, "O", &py_data))
-    {
-        return (PythonReturnErrorObject (PyExc_AttributeError,
-            "expected an object as argument"));
-    }
-    if (Camera_CheckPyObject (py_data))
-        data = (void *)Camera_FromPyObject (py_data);
-    if (Lamp_CheckPyObject (py_data))
-        data = (void *)Lamp_FromPyObject (py_data);
-    if (Curve_CheckPyObject (py_data))
-        data = (void *)Curve_FromPyObject (py_data);
-    if (NMesh_CheckPyObject (py_data))
-        data = (void *)Mesh_FromPyObject (py_data, self->object);
-
-    /* have we set data to something good? */
-    if( !data )
-    {
-        return (PythonReturnErrorObject (PyExc_AttributeError,
-            "link argument type is not supported "));
-    }
-
-    oldid = (ID*) self->object->data;
-    id = (ID*) data;
-    obj_id = MAKE_ID2 (id->name[0], id->name[1]);
-
-    switch (obj_id)
-    {
-        case ID_CA:
-            if (self->object->type != OB_CAMERA)
-            {
-                return (PythonReturnErrorObject (PyExc_AttributeError,
-                    "The 'link' object is incompatible with the base object"));
-            }
-            break;
-        case ID_LA:
-            if (self->object->type != OB_LAMP)
-            {
-                return (PythonReturnErrorObject (PyExc_AttributeError,
-                    "The 'link' object is incompatible with the base object"));
-            }
-            break;
-        case ID_ME:
-            if (self->object->type != OB_MESH)
-            {
-                return (PythonReturnErrorObject (PyExc_AttributeError,
-                    "The 'link' object is incompatible with the base object"));
-            }
-            break;
-        case ID_CU:
-            if (self->object->type != OB_CURVE)
-            {
-                return (PythonReturnErrorObject (PyExc_AttributeError,
-                    "The 'link' object is incompatible with the base object"));
-            }
-            break;
-        default:
-            return (PythonReturnErrorObject (PyExc_AttributeError,
-                "Linking this object type is not supported"));
-    }
-    self->object->data = data;
-    id_us_plus (id);
-    if (oldid)
-    {
-        if (oldid->us > 0)
-        {
-            oldid->us--;
-        }
-        else
-        {
-            return (PythonReturnErrorObject (PyExc_RuntimeError,
-                "old object reference count below 0"));
-        }
-    }
-    return (Py_None);
+		PyObject		* py_data;
+		ID					* id;
+		ID					* oldid;
+		int						obj_id;
+		void				* data = NULL;
+
+		if (!PyArg_ParseTuple (args, "O", &py_data))
+		{
+				return (PythonReturnErrorObject (PyExc_AttributeError,
+						"expected an object as argument"));
+		}
+		if (Camera_CheckPyObject (py_data))
+				data = (void *)Camera_FromPyObject (py_data);
+		if (Lamp_CheckPyObject (py_data))
+				data = (void *)Lamp_FromPyObject (py_data);
+		if (Curve_CheckPyObject (py_data))
+				data = (void *)Curve_FromPyObject (py_data);
+		if (NMesh_CheckPyObject (py_data))
+				data = (void *)Mesh_FromPyObject (py_data, self->object);
+
+		/* have we set data to something good? */
+		if( !data )
+		{
+				return (PythonReturnErrorObject (PyExc_AttributeError,
+						"link argument type is not supported "));
+		}
+
+		oldid = (ID*) self->object->data;
+		id = (ID*) data;
+		obj_id = MAKE_ID2 (id->name[0], id->name[1]);
+
+		switch (obj_id)
+		{
+				case ID_CA:
+						if (self->object->type != OB_CAMERA)
+						{
+								return (PythonReturnErrorObject (PyExc_AttributeError,
+										"The 'link' object is incompatible with the base object"));
+						}
+						break;
+				case ID_LA:
+						if (self->object->type != OB_LAMP)
+						{
+								return (PythonReturnErrorObject (PyExc_AttributeError,
+										"The 'link' object is incompatible with the base object"));
+						}
+						break;
+				case ID_ME:
+						if (self->object->type != OB_MESH)
+						{
+								return (PythonReturnErrorObject (PyExc_AttributeError,
+										"The 'link' object is incompatible with the base object"));
+						}
+						break;
+				case ID_CU:
+						if (self->object->type != OB_CURVE)
+						{
+								return (PythonReturnErrorObject (PyExc_AttributeError,
+										"The 'link' object is incompatible with the base object"));
+						}
+						break;
+				default:
+						return (PythonReturnErrorObject (PyExc_AttributeError,
+								"Linking this object type is not supported"));
+		}
+		self->object->data = data;
+		id_us_plus (id);
+		if (oldid)
+		{
+				if (oldid->us > 0)
+				{
+						oldid->us--;
+				}
+				else
+				{
+						return (PythonReturnErrorObject (PyExc_RuntimeError,
+								"old object reference count below 0"));
+				}
+		}
+		return (Py_None);
 }
 
 static PyObject *Object_makeParent (BPy_Object *self, PyObject *args)
 {
-    PyObject    * list;
-    PyObject    * py_child;
-    BPy_Object    * py_obj_child;
-    Object      * child;
-    Object      * parent;
-    int           noninverse = 0;
-    int           fast = 0;
-    int           i;
-
-    /* Check if the arguments passed to makeParent are valid. */
-    if (!PyArg_ParseTuple (args, "O|ii", &list, &noninverse, &fast))
-    {
-        return (PythonReturnErrorObject (PyExc_AttributeError,
-            "expected a list of objects and one or two integers as arguments"));
-    }
-    if (!PySequence_Check (list))
-    {
-        return (PythonReturnErrorObject (PyExc_TypeError,
-            "expected a list of objects"));
-    }
-
-    /* Check if the PyObject passed in list is a Blender object. */
-    for (i=0 ; i<PySequence_Length (list) ; i++)
-    {
-        child = NULL;
-        py_child = PySequence_GetItem (list, i);
-        if (Object_CheckPyObject (py_child))
-            child = (Object*) Object_FromPyObject (py_child);
-
-        if (child == NULL)
-        {
-            return (PythonReturnErrorObject (PyExc_TypeError,
-                "Object Type expected"));
-        }
-
-        parent = (Object*)self->object;
-        if (test_parent_loop (parent, child))
-        {
-            return (PythonReturnErrorObject (PyExc_RuntimeError,
-                "parenting loop detected - parenting failed"));
-        }
-        child->partype = PAROBJECT;
-        py_obj_child = (BPy_Object *) py_child;
-        if (noninverse == 1)
-        {
-            /* Parent inverse = unity */
-            child->loc[0] = 0.0;
-            child->loc[1] = 0.0;
-            child->loc[2] = 0.0;
-        }
-        else
-        {
-            what_does_parent (child);
-            Mat4Invert (child->parentinv, parent->obmat);
-        }
-
-        if (!fast)
-        {
-            sort_baselist (G.scene);
-        }
-
-        /* We don't need the child object anymore. */
-        Py_DECREF ((PyObject *) child);
-    }
-    return (Py_None);
+		PyObject		* list;
+		PyObject		* py_child;
+		BPy_Object		* py_obj_child;
+		Object			* child;
+		Object			* parent;
+		int						noninverse = 0;
+		int						fast = 0;
+		int						i;
+
+		/* Check if the arguments passed to makeParent are valid. */
+		if (!PyArg_ParseTuple (args, "O|ii", &list, &noninverse, &fast))
+		{
+				return (PythonReturnErrorObject (PyExc_AttributeError,
+						"expected a list of objects and one or two integers as arguments"));
+		}
+		if (!PySequence_Check (list))
+		{
+				return (PythonReturnErrorObject (PyExc_TypeError,
+						"expected a list of objects"));
+		}
+
+		/* Check if the PyObject passed in list is a Blender object. */
+		for (i=0 ; i<PySequence_Length (list) ; i++)
+		{
+				child = NULL;
+				py_child = PySequence_GetItem (list, i);
+				if (Object_CheckPyObject (py_child))
+						child = (Object*) Object_FromPyObject (py_child);
+
+				if (child == NULL)
+				{
+						return (PythonReturnErrorObject (PyExc_TypeError,
+								"Object Type expected"));
+				}
+
+				parent = (Object*)self->object;
+				if (test_parent_loop (parent, child))
+				{
+						return (PythonReturnErrorObject (PyExc_RuntimeError,
+								"parenting loop detected - parenting failed"));
+				}
+				child->partype = PAROBJECT;
+				py_obj_child = (BPy_Object *) py_child;
+				if (noninverse == 1)
+				{
+						/* Parent inverse = unity */
+						child->loc[0] = 0.0;
+						child->loc[1] = 0.0;
+						child->loc[2] = 0.0;
+				}
+				else
+				{
+						what_does_parent (child);
+						Mat4Invert (child->parentinv, parent->obmat);
+				}
+
+				if (!fast)
+				{
+						sort_baselist (G.scene);
+				}
+
+				/* We don't need the child object anymore. */
+				Py_DECREF ((PyObject *) child);
+		}
+		return (Py_None);
 }
 
 static PyObject *Object_materialUsage (BPy_Object *self, PyObject *args)
 {
-    return (PythonReturnErrorObject (PyExc_NotImplementedError,
-            "materialUsage: not yet implemented"));
+		return (PythonReturnErrorObject (PyExc_NotImplementedError,
+						"materialUsage: not yet implemented"));
 }
 
 static PyObject *Object_setDeltaLocation (BPy_Object *self, PyObject *args)
 {
-    float   dloc1;
-    float   dloc2;
-    float   dloc3;
-    int     status;
-
-    if (PyObject_Length (args) == 3)
-        status = PyArg_ParseTuple (args, "fff", &dloc1, &dloc2, &dloc3);
-    else
-        status = PyArg_ParseTuple (args, "(fff)", &dloc1, &dloc2, &dloc3);
-
-    if (!status)
-        return EXPP_ReturnPyObjError (PyExc_AttributeError,
-                "expected list argument of 3 floats");
-
-    self->object->dloc[0] = dloc1;
-    self->object->dloc[1] = dloc2;
-    self->object->dloc[2] = dloc3;
-
-    Py_INCREF (Py_None);
-    return (Py_None);
+		float		dloc1;
+		float		dloc2;
+		float		dloc3;
+		int			status;
+
+		if (PyObject_Length (args) == 3)
+				status = PyArg_ParseTuple (args, "fff", &dloc1, &dloc2, &dloc3);
+		else
+				status = PyArg_ParseTuple (args, "(fff)", &dloc1, &dloc2, &dloc3);
+
+		if (!status)
+				return EXPP_ReturnPyObjError (PyExc_AttributeError,
+								"expected list argument of 3 floats");
+
+		self->object->dloc[0] = dloc1;
+		self->object->dloc[1] = dloc2;
+		self->object->dloc[2] = dloc3;
+
+		Py_INCREF (Py_None);
+		return (Py_None);
 }
 
 static PyObject *Object_setDrawMode (BPy_Object *self, PyObject *args)
 {
-    char    dt;
+		char		dt;
 
-    if (!PyArg_ParseTuple (args, "b", &dt))
-    {
-        return (PythonReturnErrorObject (PyExc_AttributeError,
-                "expected an integer as argument"));
-    }
-    self->object->dt = dt;
+		if (!PyArg_ParseTuple (args, "b", &dt))
+		{
+				return (PythonReturnErrorObject (PyExc_AttributeError,
+								"expected an integer as argument"));
+		}
+		self->object->dt = dt;
 
-    Py_INCREF (Py_None);
-    return (Py_None);
+		Py_INCREF (Py_None);
+		return (Py_None);
 }
 
 static PyObject *Object_setDrawType (BPy_Object *self, PyObject *args)
 { 
-    char    dtx;
+		char		dtx;
 
-    if (!PyArg_ParseTuple (args, "b", &dtx))
-    {
-        return (PythonReturnErrorObject (PyExc_AttributeError,
-                "expected an integer as argument"));
-    }
-    self->object->dtx = dtx;
+		if (!PyArg_ParseTuple (args, "b", &dtx))
+		{
+				return (PythonReturnErrorObject (PyExc_AttributeError,
+								"expected an integer as argument"));
+		}
+		self->object->dtx = dtx;
 
-    Py_INCREF (Py_None);
-    return (Py_None);
+		Py_INCREF (Py_None);
+		return (Py_None);
 }
 
 static PyObject *Object_setEuler (BPy_Object *self, PyObject *args)
 {
-    float   rot1;
-    float   rot2;
-    float   rot3;
-    int     status;
-
-    if (PyObject_Length (args) == 3)
-        status = PyArg_ParseTuple (args, "fff", &rot1, &rot2, &rot3);
-    else
-        status = PyArg_ParseTuple (args, "(fff)", &rot1, &rot2, &rot3);
-
-    if (!status)
-        return EXPP_ReturnPyObjError (PyExc_AttributeError,
-                "expected list argument of 3 floats");
-
-    self->object->rot[0] = rot1;
-    self->object->rot[1] = rot2;
-    self->object->rot[2] = rot3;
-
-    Py_INCREF (Py_None);
-    return (Py_None);
+		float		rot1;
+		float		rot2;
+		float		rot3;
+		int			status;
+
+		if (PyObject_Length (args) == 3)
+				status = PyArg_ParseTuple (args, "fff", &rot1, &rot2, &rot3);
+		else
+				status = PyArg_ParseTuple (args, "(fff)", &rot1, &rot2, &rot3);
+
+		if (!status)
+				return EXPP_ReturnPyObjError (PyExc_AttributeError,
+								"expected list argument of 3 floats");
+
+		self->object->rot[0] = rot1;
+		self->object->rot[1] = rot2;
+		self->object->rot[2] = rot3;
+
+		Py_INCREF (Py_None);
+		return (Py_None);
 }
 
 static PyObject *Object_setLocation (BPy_Object *self, PyObject *args)
 {
-    float   loc1;
-    float   loc2;
-    float   loc3;
-    int     status;
-
-    if (PyObject_Length (args) == 3)
-        status = PyArg_ParseTuple (args, "fff", &loc1, &loc2, &loc3);
-    else
-        status = PyArg_ParseTuple (args, "(fff)", &loc1, &loc2, &loc3);
-
-    if (!status)
-        return EXPP_ReturnPyObjError (PyExc_AttributeError,
-                "expected list argument of 3 floats");
-
-    self->object->loc[0] = loc1;
-    self->object->loc[1] = loc2;
-    self->object->loc[2] = loc3;
-
-    Py_INCREF (Py_None);
-    return (Py_None);
+		float		loc1;
+		float		loc2;
+		float		loc3;
+		int			status;
+
+		if (PyObject_Length (args) == 3)
+				status = PyArg_ParseTuple (args, "fff", &loc1, &loc2, &loc3);
+		else
+				status = PyArg_ParseTuple (args, "(fff)", &loc1, &loc2, &loc3);
+
+		if (!status)
+				return EXPP_ReturnPyObjError (PyExc_AttributeError,
+								"expected list argument of 3 floats");
+
+		self->object->loc[0] = loc1;
+		self->object->loc[1] = loc2;
+		self->object->loc[2] = loc3;
+
+		Py_INCREF (Py_None);
+		return (Py_None);
 }
 
 static PyObject *Object_setMaterials (BPy_Object *self, PyObject *args)
 {
-    PyObject     * list;
-    int            len;
-    int            i;
-    Material    ** matlist;
-
-    if (!PyArg_ParseTuple (args, "O", &list))
-    {
-        return (PythonReturnErrorObject (PyExc_AttributeError,
-                "expected a list of materials as argument"));
-    }
-
-    len = PySequence_Length (list);
-    if (len > 0)
-    {
-        matlist = EXPP_newMaterialList_fromPyList (list);
-        if (!matlist)
-        {
-            return (PythonReturnErrorObject (PyExc_AttributeError,
-                "material list must be a list of valid materials!"));
-        }
-        if ((len < 0) || (len > MAXMAT))
-        {
-            return (PythonReturnErrorObject (PyExc_RuntimeError,
-                "illegal material index!"));
-        }
-
-        if (self->object->mat)
-        {
-            EXPP_releaseMaterialList (self->object->mat, len);
-        }
-        /* Increase the user count on all materials */
-        for (i=0 ; i<len ; i++)
-        {
-            id_us_plus ((ID *) matlist[i]);
-        }
-        self->object->mat = matlist;
-        self->object->totcol = len;
-        self->object->actcol = -1;
-
-        switch (self->object->type)
-        {
-            case OB_CURVE:  /* fall through */
-            case OB_FONT:   /* fall through */
-            case OB_MESH:   /* fall through */
-            case OB_MBALL:  /* fall through */
-            case OB_SURF:
-                EXPP_synchronizeMaterialLists (self->object,
-                                               self->object->data);
-                break;
-            default:
-                break;
-        }
-    }
-    return (Py_None);
+		PyObject		 * list;
+		int						 len;
+		int						 i;
+		Material		** matlist;
+
+		if (!PyArg_ParseTuple (args, "O", &list))
+		{
+				return (PythonReturnErrorObject (PyExc_AttributeError,
+								"expected a list of materials as argument"));
+		}
+
+		len = PySequence_Length (list);
+		if (len > 0)
+		{
+				matlist = EXPP_newMaterialList_fromPyList (list);
+				if (!matlist)
+				{
+						return (PythonReturnErrorObject (PyExc_AttributeError,
+								"material list must be a list of valid materials!"));
+				}
+				if ((len < 0) || (len > MAXMAT))
+				{
+						return (PythonReturnErrorObject (PyExc_RuntimeError,
+								"illegal material index!"));
+				}
+
+				if (self->object->mat)
+				{
+						EXPP_releaseMaterialList (self->object->mat, len);
+				}
+				/* Increase the user count on all materials */
+				for (i=0 ; i<len ; i++)
+				{
+						id_us_plus ((ID *) matlist[i]);
+				}
+				self->object->mat = matlist;
+				self->object->totcol = len;
+				self->object->actcol = -1;
+
+				switch (self->object->type)
+				{
+						case OB_CURVE:	/* fall through */
+						case OB_FONT:		/* fall through */
+						case OB_MESH:		/* fall through */
+						case OB_MBALL:	/* fall through */
+						case OB_SURF:
+								EXPP_synchronizeMaterialLists (self->object,
+																							 self->object->data);
+								break;
+						default:
+								break;
+				}
+		}
+		return (Py_None);
 }
 
 static PyObject *Object_setName (BPy_Object *self, PyObject *args)
 {
-    char  * name;
-    char    buf[21];
+		char	* name;
+		char		buf[21];
 
-    if (!PyArg_ParseTuple (args, "s", &name))
-    {
-        return (PythonReturnErrorObject (PyExc_AttributeError,
-                "expected a String as argument"));
-    }
+		if (!PyArg_ParseTuple (args, "s", &name))
+		{
+				return (PythonReturnErrorObject (PyExc_AttributeError,
+								"expected a String as argument"));
+		}
 
-    PyOS_snprintf(buf, sizeof(buf), "%s", name);
+		PyOS_snprintf(buf, sizeof(buf), "%s", name);
 
-    rename_id(&self->object->id, buf);
+		rename_id(&self->object->id, buf);
 
-    Py_INCREF (Py_None);
-    return (Py_None);
+		Py_INCREF (Py_None);
+		return (Py_None);
 }
 
 static PyObject *Object_shareFrom (BPy_Object *self, PyObject *args)
 {
-    BPy_Object      * object;
-    ID              * id;
-    ID              * oldid;
-
-    if (!PyArg_ParseTuple (args, "O", &object))
-    {
-        PythonReturnErrorObject (PyExc_AttributeError,
-                "expected an object argument");
-        return (NULL);
-    }
-    if (!Object_CheckPyObject ((PyObject*)object))
-    {
-        PythonReturnErrorObject (PyExc_TypeError,
-                "argument 1 is not of type 'Object'");
-        return (NULL);
-    }
-
-    if (self->object->type != object->object->type)
-    {
-        PythonReturnErrorObject (PyExc_TypeError,
-                "objects are not of same data type");
-        return (NULL);
-    }
-    switch (self->object->type)
-    {
-        case OB_MESH:
-            oldid = (ID*) self->object->data;
-            id = (ID*) object->object->data;
-            self->object->data = object->object->data;
-
-            id_us_plus (id);
-            if (oldid)
-            {
-                if (oldid->us > 0)
-                {
-                    oldid->us--;
-                }
-                else
-                {
-                    return (PythonReturnErrorObject (PyExc_RuntimeError,
-                            "old object reference count below 0"));
-                }
-            }
-            Py_INCREF (Py_None);
-            return (Py_None);
-        default:
-            PythonReturnErrorObject (PyExc_TypeError,
-                    "type not supported");
-            return (NULL);
-    }
-
-    Py_INCREF (Py_None);
-    return (Py_None);
+		BPy_Object			* object;
+		ID							* id;
+		ID							* oldid;
+
+		if (!PyArg_ParseTuple (args, "O", &object))
+		{
+				PythonReturnErrorObject (PyExc_AttributeError,
+								"expected an object argument");
+				return (NULL);
+		}
+		if (!Object_CheckPyObject ((PyObject*)object))
+		{
+				PythonReturnErrorObject (PyExc_TypeError,
+								"argument 1 is not of type 'Object'");
+				return (NULL);
+		}
+
+		if (self->object->type != object->object->type)
+		{
+				PythonReturnErrorObject (PyExc_TypeError,
+								"objects are not of same data type");
+				return (NULL);
+		}
+		switch (self->object->type)
+		{
+				case OB_MESH:
+						oldid = (ID*) self->object->data;
+						id = (ID*) object->object->data;
+						self->object->data = object->object->data;
+
+						id_us_plus (id);
+						if (oldid)
+						{
+								if (oldid->us > 0)
+								{
+										oldid->us--;
+								}
+								else
+								{
+										return (PythonReturnErrorObject (PyExc_RuntimeError,
+														"old object reference count below 0"));
+								}
+						}
+						Py_INCREF (Py_None);
+						return (Py_None);
+				default:
+						PythonReturnErrorObject (PyExc_TypeError,
+										"type not supported");
+						return (NULL);
+		}
+
+		Py_INCREF (Py_None);
+		return (Py_None);
 }
 
 /*****************************************************************************/
-/* Function:    Object_CreatePyObject                                        */
+/* Function:		Object_CreatePyObject																				 */
 /* Description: This function will create a new BlenObject from an existing  */
-/*              Object structure.                                            */
+/*							Object structure.																						 */
 /*****************************************************************************/
 PyObject* Object_CreatePyObject (struct Object *obj)
 {
-    BPy_Object    * blen_object;
+		BPy_Object		* blen_object;
 
-    blen_object = (BPy_Object*)PyObject_NEW (BPy_Object, &Object_Type);
+		blen_object = (BPy_Object*)PyObject_NEW (BPy_Object, &Object_Type);
 
-    if (blen_object == NULL)
-    {
-        return (NULL);
-    }
-    blen_object->object = obj;
-    return ((PyObject*)blen_object);
+		if (blen_object == NULL)
+		{
+				return (NULL);
+		}
+		blen_object->object = obj;
+		return ((PyObject*)blen_object);
 }
 
 /*****************************************************************************/
-/* Function:    Object_CheckPyObject                                         */
+/* Function:		Object_CheckPyObject																				 */
 /* Description: This function returns true when the given PyObject is of the */
-/*              type Object. Otherwise it will return false.                 */
+/*							type Object. Otherwise it will return false.								 */
 /*****************************************************************************/
 int Object_CheckPyObject (PyObject *py_obj)
 {
-    return (py_obj->ob_type == &Object_Type);
+		return (py_obj->ob_type == &Object_Type);
 }
 
 /*****************************************************************************/
-/* Function:    Object_FromPyObject                                          */
-/* Description: This function returns the Blender object from the given      */
-/*              PyObject.                                                    */
+/* Function:		Object_FromPyObject																					 */
+/* Description: This function returns the Blender object from the given			 */
+/*							PyObject.																										 */
 /*****************************************************************************/
 struct Object* Object_FromPyObject (PyObject *py_obj)
 {
-    BPy_Object    * blen_obj;
+		BPy_Object		* blen_obj;
 
-    blen_obj = (BPy_Object*)py_obj;
-    return (blen_obj->object);
+		blen_obj = (BPy_Object*)py_obj;
+		return (blen_obj->object);
 }
 
 /*****************************************************************************/
-/* Description: Returns the object with the name specified by the argument   */
-/*              name. Note that the calling function has to remove the first */
-/*              two characters of the object name. These two characters      */
-/*              specify the type of the object (OB, ME, WO, ...)             */
-/*              The function will return NULL when no object with the given  */
-/*              name is found.                                               */
+/* Description: Returns the object with the name specified by the argument	 */
+/*							name. Note that the calling function has to remove the first */
+/*							two characters of the object name. These two characters			 */
+/*							specify the type of the object (OB, ME, WO, ...)						 */
+/*							The function will return NULL when no object with the given  */
+/*							name is found.																							 */
 /*****************************************************************************/
 Object * GetObjectByName (char * name)
 {
-  Object  * obj_iter;
-
-  obj_iter = G.main->object.first;
-  while (obj_iter)
-  {
-    if (StringEqual (name, GetIdName (&(obj_iter->id))))
-    {
-      return (obj_iter);
-    }
-    obj_iter = obj_iter->id.next;
-  }
-
-  /* There is no object with the given name */
-  return (NULL);
+	Object	* obj_iter;
+
+	obj_iter = G.main->object.first;
+	while (obj_iter)
+	{
+		if (StringEqual (name, GetIdName (&(obj_iter->id))))
+		{
+			return (obj_iter);
+		}
+		obj_iter = obj_iter->id.next;
+	}
+
+	/* There is no object with the given name */
+	return (NULL);
 }
 
 /*****************************************************************************/
-/* Function:    Object_dealloc                                               */
-/* Description: This is a callback function for the BlenObject type. It is   */
-/*              the destructor function.                                     */
+/* Function:		Object_dealloc																							 */
+/* Description: This is a callback function for the BlenObject type. It is	 */
+/*							the destructor function.																		 */
 /*****************************************************************************/
 static void Object_dealloc (BPy_Object *obj)
 {
-    PyObject_DEL (obj);
+		PyObject_DEL (obj);
 }
 
 /*****************************************************************************/
-/* Function:    Object_getAttr                                               */
-/* Description: This is a callback function for the BlenObject type. It is   */
-/*              the function that retrieves any value from Blender and       */
-/*              passes it to Python.                                         */
+/* Function:		Object_getAttr																							 */
+/* Description: This is a callback function for the BlenObject type. It is	 */
+/*							the function that retrieves any value from Blender and			 */
+/*							passes it to Python.																				 */
 /*****************************************************************************/
 static PyObject* Object_getAttr (BPy_Object *obj, char *name)
 {
-    struct Object   * object;
-    struct Ika      * ika;
-
-    object = obj->object;
-    if (StringEqual (name, "LocX"))
-        return (PyFloat_FromDouble(object->loc[0]));
-    if (StringEqual (name, "LocY"))
-        return (PyFloat_FromDouble(object->loc[1]));
-    if (StringEqual (name, "LocZ"))
-        return (PyFloat_FromDouble(object->loc[2]));
-    if (StringEqual (name, "loc"))
-        return (Py_BuildValue ("fff", object->loc[0], object->loc[1],
-                               object->loc[2]));
-    if (StringEqual (name, "dLocX"))
-        return (PyFloat_FromDouble(object->dloc[0]));
-    if (StringEqual (name, "dLocY"))
-        return (PyFloat_FromDouble(object->dloc[1]));
-    if (StringEqual (name, "dLocZ"))
-        return (PyFloat_FromDouble(object->dloc[2]));
-    if (StringEqual (name, "dloc"))
-        return (Py_BuildValue ("fff", object->dloc[0], object->dloc[1],
-                               object->dloc[2]));
-    if (StringEqual (name, "RotX"))
-        return (PyFloat_FromDouble(object->rot[0]));
-    if (StringEqual (name, "RotY"))
-        return (PyFloat_FromDouble(object->rot[1]));
-    if (StringEqual (name, "RotZ"))
-        return (PyFloat_FromDouble(object->rot[2]));
-    if (StringEqual (name, "rot"))
-        return (Py_BuildValue ("fff", object->rot[0], object->rot[1],
-                               object->rot[2]));
-    if (StringEqual (name, "dRotX"))
-        return (PyFloat_FromDouble(object->drot[0]));
-    if (StringEqual (name, "dRotY"))
-        return (PyFloat_FromDouble(object->drot[1]));
-    if (StringEqual (name, "dRotZ"))
-        return (PyFloat_FromDouble(object->drot[2]));
-    if (StringEqual (name, "drot"))
-        return (Py_BuildValue ("fff", object->drot[0], object->drot[1],
-                               object->drot[2]));
-    if (StringEqual (name, "SizeX"))
-        return (PyFloat_FromDouble(object->size[0]));
-    if (StringEqual (name, "SizeY"))
-        return (PyFloat_FromDouble(object->size[1]));
-    if (StringEqual (name, "SizeZ"))
-        return (PyFloat_FromDouble(object->size[2]));
-    if (StringEqual (name, "size"))
-        return (Py_BuildValue ("fff", object->size[0], object->size[1],
-                               object->size[2]));
-    if (StringEqual (name, "dSizeX"))
-        return (PyFloat_FromDouble(object->dsize[0]));
-    if (StringEqual (name, "dSizeY"))
-        return (PyFloat_FromDouble(object->dsize[1]));
-    if (StringEqual (name, "dSizeZ"))
-        return (PyFloat_FromDouble(object->dsize[2]));
-    if (StringEqual (name, "dsize"))
-        return (Py_BuildValue ("fff", object->dsize[0], object->dsize[1],
-                               object->dsize[2]));
-    if (strncmp (name,"Eff", 3) == 0)
-    {
-        if ( (object->type == OB_IKA) && (object->data != NULL) )
-        {
-            ika = object->data;
-            switch (name[3])
-            {
-                case 'X':
-                    return (PyFloat_FromDouble (ika->effg[0]));
-                case 'Y':
-                    return (PyFloat_FromDouble (ika->effg[1]));
-                case 'Z':
-                    return (PyFloat_FromDouble (ika->effg[2]));
-                default:
-                /* Do we need to display a sensible error message here? */
-                    return (NULL);
-            }
-        }
-        return (NULL);
-    }
-    if (StringEqual (name, "Layer"))
-      return (PyInt_FromLong(object->lay));
-    if (StringEqual (name, "parent"))
-    {
-        if (object->parent)
-            return (Object_CreatePyObject (object->parent));
-        else 
-    {
-      Py_INCREF (Py_None);
-      return (Py_None);
-    }
-    }
-
-    if (StringEqual (name, "track"))
-      return (Object_CreatePyObject (object->track));
-    if (StringEqual (name, "data"))
-      return (Object_getData (obj));
-    if (StringEqual (name, "ipo"))
-    {
-        if (object->ipo == NULL)
-        {
-            /* There's no ipo linked to the object, return Py_None. */
-            Py_INCREF (Py_None);
-            return (Py_None);
-        }
-        return (Ipo_CreatePyObject (object->ipo));
-    }
-    if (StringEqual (name, "mat"))
-        return (Object_getMatrix (obj));
-    if (StringEqual (name, "matrix"))
-        return (Object_getMatrix (obj));
-    if (StringEqual (name, "colbits"))
-        return (Py_BuildValue ("h", object->colbits));
-    if (StringEqual (name, "drawType"))
-        return (Py_BuildValue ("b", object->dt));
-    if (StringEqual (name, "drawMode"))
-        return (Py_BuildValue ("b", object->dtx));
-    if (StringEqual (name, "name"))
-        return (Py_BuildValue ("s", object->id.name+2));
-
-    /* not an attribute, search the methods table */
-    return Py_FindMethod(BPy_Object_methods, (PyObject *)obj, name);
+		struct Object		* object;
+		struct Ika			* ika;
+
+		object = obj->object;
+		if (StringEqual (name, "LocX"))
+				return (PyFloat_FromDouble(object->loc[0]));
+		if (StringEqual (name, "LocY"))
+				return (PyFloat_FromDouble(object->loc[1]));
+		if (StringEqual (name, "LocZ"))
+				return (PyFloat_FromDouble(object->loc[2]));
+		if (StringEqual (name, "loc"))
+				return (Py_BuildValue ("fff", object->loc[0], object->loc[1],
+															 object->loc[2]));
+		if (StringEqual (name, "dLocX"))
+				return (PyFloat_FromDouble(object->dloc[0]));
+		if (StringEqual (name, "dLocY"))
+				return (PyFloat_FromDouble(object->dloc[1]));
+		if (StringEqual (name, "dLocZ"))
+				return (PyFloat_FromDouble(object->dloc[2]));
+		if (StringEqual (name, "dloc"))
+				return (Py_BuildValue ("fff", object->dloc[0], object->dloc[1],
+															 object->dloc[2]));
+		if (StringEqual (name, "RotX"))
+				return (PyFloat_FromDouble(object->rot[0]));
+		if (StringEqual (name, "RotY"))
+				return (PyFloat_FromDouble(object->rot[1]));
+		if (StringEqual (name, "RotZ"))
+				return (PyFloat_FromDouble(object->rot[2]));
+		if (StringEqual (name, "rot"))
+				return (Py_BuildValue ("fff", object->rot[0], object->rot[1],
+															 object->rot[2]));
+		if (StringEqual (name, "dRotX"))
+				return (PyFloat_FromDouble(object->drot[0]));
+		if (StringEqual (name, "dRotY"))
+				return (PyFloat_FromDouble(object->drot[1]));
+		if (StringEqual (name, "dRotZ"))
+				return (PyFloat_FromDouble(object->drot[2]));
+		if (StringEqual (name, "drot"))
+				return (Py_BuildValue ("fff", object->drot[0], object->drot[1],
+															 object->drot[2]));
+		if (StringEqual (name, "SizeX"))
+				return (PyFloat_FromDouble(object->size[0]));
+		if (StringEqual (name, "SizeY"))
+				return (PyFloat_FromDouble(object->size[1]));
+		if (StringEqual (name, "SizeZ"))
+				return (PyFloat_FromDouble(object->size[2]));
+		if (StringEqual (name, "size"))
+				return (Py_BuildValue ("fff", object->size[0], object->size[1],
+															 object->size[2]));
+		if (StringEqual (name, "dSizeX"))
+				return (PyFloat_FromDouble(object->dsize[0]));
+		if (StringEqual (name, "dSizeY"))
+				return (PyFloat_FromDouble(object->dsize[1]));
+		if (StringEqual (name, "dSizeZ"))
+				return (PyFloat_FromDouble(object->dsize[2]));
+		if (StringEqual (name, "dsize"))
+				return (Py_BuildValue ("fff", object->dsize[0], object->dsize[1],
+															 object->dsize[2]));
+		if (strncmp (name,"Eff", 3) == 0)
+		{
+				if ( (object->type == OB_IKA) && (object->data != NULL) )
+				{
+						ika = object->data;
+						switch (name[3])
+						{
+								case 'X':
+										return (PyFloat_FromDouble (ika->effg[0]));
+								case 'Y':
+										return (PyFloat_FromDouble (ika->effg[1]));
+								case 'Z':
+										return (PyFloat_FromDouble (ika->effg[2]));
+								default:
+								/* Do we need to display a sensible error message here? */
+										return (NULL);
+						}
+				}
+				return (NULL);
+		}
+		if (StringEqual (name, "Layer"))
+			return (PyInt_FromLong(object->lay));
+		if (StringEqual (name, "parent"))
+		{
+				if (object->parent)
+						return (Object_CreatePyObject (object->parent));
+				else 
+		{
+			Py_INCREF (Py_None);
+			return (Py_None);
+		}
+		}
+
+		if (StringEqual (name, "track"))
+			return (Object_CreatePyObject (object->track));
+		if (StringEqual (name, "data"))
+			return (Object_getData (obj));
+		if (StringEqual (name, "ipo"))
+		{
+				if (object->ipo == NULL)
+				{
+						/* There's no ipo linked to the object, return Py_None. */
+						Py_INCREF (Py_None);
+						return (Py_None);
+				}
+				return (Ipo_CreatePyObject (object->ipo));
+		}
+		if (StringEqual (name, "mat"))
+				return (Object_getMatrix (obj));
+		if (StringEqual (name, "matrix"))
+				return (Object_getMatrix (obj));
+		if (StringEqual (name, "colbits"))
+				return (Py_BuildValue ("h", object->colbits));
+		if (StringEqual (name, "drawType"))
+				return (Py_BuildValue ("b", object->dt));
+		if (StringEqual (name, "drawMode"))
+				return (Py_BuildValue ("b", object->dtx));
+		if (StringEqual (name, "name"))
+				return (Py_BuildValue ("s", object->id.name+2));
+
+		/* not an attribute, search the methods table */
+		return Py_FindMethod(BPy_Object_methods, (PyObject *)obj, name);
 }
 
 /*****************************************************************************/
-/* Function:    Object_setAttr                                               */
-/* Description: This is a callback function for the BlenObject type. It is   */
-/*              the function that retrieves any value from Python and sets   */
-/*              it accordingly in Blender.                                   */
+/* Function:		Object_setAttr																							 */
+/* Description: This is a callback function for the BlenObject type. It is	 */
+/*							the function that retrieves any value from Python and sets	 */
+/*							it accordingly in Blender.																	 */
 /*****************************************************************************/
 static int Object_setAttr (BPy_Object *obj, char *name, PyObject *value)
 {
-    PyObject        * valtuple;
-    struct Object   * object;
-    struct Ika      * ika;
-
-    /* First put the value(s) in a tuple. For some variables, we want to */
-    /* pass the values to a function, and these functions only accept */
-    /* PyTuples. */
-    valtuple = Py_BuildValue ("(O)", value);
-    if (!valtuple)
-    {
-        return EXPP_ReturnIntError(PyExc_MemoryError,
-                         "Object_setAttr: couldn't create PyTuple");
-    }
-
-    object = obj->object;
-    if (StringEqual (name, "LocX"))
-        return (!PyArg_Parse (value, "f", &(object->loc[0])));
-    if (StringEqual (name, "LocY"))
-        return (!PyArg_Parse (value, "f", &(object->loc[1])));
-    if (StringEqual (name, "LocZ"))
-        return (!PyArg_Parse (value, "f", &(object->loc[2])));
-    if (StringEqual (name, "loc"))
-    {
-        if (Object_setLocation (obj, valtuple) != Py_None)
-            return (-1);
-        else
-            return (0);
-    }
-    if (StringEqual (name, "dLocX"))
-        return (!PyArg_Parse (value, "f", &(object->dloc[0])));
-    if (StringEqual (name, "dLocY"))
-        return (!PyArg_Parse (value, "f", &(object->dloc[1])));
-    if (StringEqual (name, "dLocZ"))
-        return (!PyArg_Parse (value, "f", &(object->dloc[2])));
-    if (StringEqual (name, "dloc"))
-    {
-        if (Object_setDeltaLocation (obj, valtuple) != Py_None)
-            return (-1);
-        else
-            return (0);
-    }
-    if (StringEqual (name, "RotX"))
-        return (!PyArg_Parse (value, "f", &(object->rot[0])));
-    if (StringEqual (name, "RotY"))
-        return (!PyArg_Parse (value, "f", &(object->rot[1])));
-    if (StringEqual (name, "RotZ"))
-        return (!PyArg_Parse (value, "f", &(object->rot[2])));
-    if (StringEqual (name, "rot"))
-    {
-        if (Object_setEuler (obj, valtuple) != Py_None)
-            return (-1);
-        else
-            return (0);
-    }
-    if (StringEqual (name, "dRotX"))
-        return (!PyArg_Parse (value, "f", &(object->drot[0])));
-    if (StringEqual (name, "dRotY"))
-        return (!PyArg_Parse (value, "f", &(object->drot[1])));
-    if (StringEqual (name, "dRotZ"))
-        return (!PyArg_Parse (value, "f", &(object->drot[2])));
-    if (StringEqual (name, "drot"))
-        return (!PyArg_Parse (value, "fff", &(object->drot[0]),
-                              &(object->drot[1]), &(object->drot[2])));
-    if (StringEqual (name, "SizeX"))
-        return (!PyArg_Parse (value, "f", &(object->size[0])));
-    if (StringEqual (name, "SizeY"))
-        return (!PyArg_Parse (value, "f", &(object->size[1])));
-    if (StringEqual (name, "SizeZ"))
-        return (!PyArg_Parse (value, "f", &(object->size[2])));
-    if (StringEqual (name, "size"))
-        return (!PyArg_Parse (value, "fff", &(object->size[0]),
-                              &(object->size[1]), &(object->size[2])));
-    if (StringEqual (name, "dSizeX"))
-        return (!PyArg_Parse (value, "f", &(object->dsize[0])));
-    if (StringEqual (name, "dSizeY"))
-        return (!PyArg_Parse (value, "f", &(object->dsize[1])));
-    if (StringEqual (name, "dSizeZ"))
-        return (!PyArg_Parse (value, "f", &(object->dsize[2])));
-    if (StringEqual (name, "dsize"))
-        return (!PyArg_Parse (value, "fff", &(object->dsize[0]),
-                              &(object->dsize[1]), &(object->dsize[2])));
-    if (strncmp (name,"Eff", 3) == 0)
-    {
-        if ( (object->type == OB_IKA) && (object->data != NULL) )
-        {
-            ika = object->data;
-            switch (name[3])
-            {
-                case 'X':
-                    return (!PyArg_Parse (value, "f", &(ika->effg[0])));
-                case 'Y':
-                    return (!PyArg_Parse (value, "f", &(ika->effg[1])));
-                case 'Z':
-                    return (!PyArg_Parse (value, "f", &(ika->effg[2])));
-                default:
-                    /* Do we need to display a sensible error message here? */
-                    return (0);
-            }
-        }
-        return (0);
-    }
-    if (StringEqual (name, "Layer"))
-        return (!PyArg_Parse (value, "i", &(object->lay)));
-    if (StringEqual (name, "parent"))
-    {
-        /* This is not allowed. */
-        PythonReturnErrorObject (PyExc_AttributeError,
-                    "Setting the parent is not allowed.");
-        return (0);
-    }
-    if (StringEqual (name, "track"))
-    {
-        /* This is not allowed. */
-        PythonReturnErrorObject (PyExc_AttributeError,
-                    "Setting the track is not allowed.");
-        return (0);
-    }
-    if (StringEqual (name, "data"))
-    {
-        /* This is not allowed. */
-        PythonReturnErrorObject (PyExc_AttributeError,
-                    "Setting the data is not allowed.");
-        return (0);
-    }
-    if (StringEqual (name, "ipo"))
-    {
-        /* This is not allowed. */
-        PythonReturnErrorObject (PyExc_AttributeError,
-                    "Setting the ipo is not allowed.");
-        return (0);
-    }
-    if (StringEqual (name, "mat"))
-    {
-        /* This is not allowed. */
-        PythonReturnErrorObject (PyExc_AttributeError,
-                    "Setting the matrix is not allowed.");
-        return (0);
-    }
-    if (StringEqual (name, "matrix"))
-    {
-        /* This is not allowed. */
-        PythonReturnErrorObject (PyExc_AttributeError,
-                    "Setting the matrix is not allowed.");
-        return (0);
-    }
-    if (StringEqual (name, "colbits"))
-        return (!PyArg_Parse (value, "h", &(object->colbits)));
-    if (StringEqual (name, "drawType"))
-    {
-        if (Object_setDrawType (obj, valtuple) != Py_None)
-            return (-1);
-        else
-            return (0);
-    }
-    if (StringEqual (name, "drawMode"))
-    {
-        if (Object_setDrawMode (obj, valtuple) != Py_None)
-            return (-1);
-        else
-            return (0);
-    }
-    if (StringEqual (name, "name"))
-    {
-        if (Object_setName (obj, valtuple) != Py_None)
-            return (-1);
-        else
-            return (0);
-    }
-
-    printf ("Unknown variable.\n");
-    return (0);
+		PyObject				* valtuple;
+		struct Object		* object;
+		struct Ika			* ika;
+
+		/* First put the value(s) in a tuple. For some variables, we want to */
+		/* pass the values to a function, and these functions only accept */
+		/* PyTuples. */
+		valtuple = Py_BuildValue ("(O)", value);
+		if (!valtuple)
+		{
+				return EXPP_ReturnIntError(PyExc_MemoryError,
+												 "Object_setAttr: couldn't create PyTuple");
+		}
+
+		object = obj->object;
+		if (StringEqual (name, "LocX"))
+				return (!PyArg_Parse (value, "f", &(object->loc[0])));
+		if (StringEqual (name, "LocY"))
+				return (!PyArg_Parse (value, "f", &(object->loc[1])));
+		if (StringEqual (name, "LocZ"))
+				return (!PyArg_Parse (value, "f", &(object->loc[2])));
+		if (StringEqual (name, "loc"))
+		{
+				if (Object_setLocation (obj, valtuple) != Py_None)
+						return (-1);
+				else
+						return (0);
+		}
+		if (StringEqual (name, "dLocX"))
+				return (!PyArg_Parse (value, "f", &(object->dloc[0])));
+		if (StringEqual (name, "dLocY"))
+				return (!PyArg_Parse (value, "f", &(object->dloc[1])));
+		if (StringEqual (name, "dLocZ"))
+				return (!PyArg_Parse (value, "f", &(object->dloc[2])));
+		if (StringEqual (name, "dloc"))
+		{
+				if (Object_setDeltaLocation (obj, valtuple) != Py_None)
+						return (-1);
+				else
+						return (0);
+		}
+		if (StringEqual (name, "RotX"))
+				return (!PyArg_Parse (value, "f", &(object->rot[0])));
+		if (StringEqual (name, "RotY"))
+				return (!PyArg_Parse (value, "f", &(object->rot[1])));
+		if (StringEqual (name, "RotZ"))
+				return (!PyArg_Parse (value, "f", &(object->rot[2])));
+		if (StringEqual (name, "rot"))
+		{
+				if (Object_setEuler (obj, valtuple) != Py_None)
+						return (-1);
+				else
+						return (0);
+		}
+		if (StringEqual (name, "dRotX"))
+				return (!PyArg_Parse (value, "f", &(object->drot[0])));
+		if (StringEqual (name, "dRotY"))
+				return (!PyArg_Parse (value, "f", &(object->drot[1])));
+		if (StringEqual (name, "dRotZ"))
+				return (!PyArg_Parse (value, "f", &(object->drot[2])));
+		if (StringEqual (name, "drot"))
+				return (!PyArg_Parse (value, "fff", &(object->drot[0]),
+															&(object->drot[1]), &(object->drot[2])));
+		if (StringEqual (name, "SizeX"))
+				return (!PyArg_Parse (value, "f", &(object->size[0])));
+		if (StringEqual (name, "SizeY"))
+				return (!PyArg_Parse (value, "f", &(object->size[1])));
+		if (StringEqual (name, "SizeZ"))
+				return (!PyArg_Parse (value, "f", &(object->size[2])));
+		if (StringEqual (name, "size"))
+				return (!PyArg_Parse (value, "fff", &(object->size[0]),
+															&(object->size[1]), &(object->size[2])));
+		if (StringEqual (name, "dSizeX"))
+				return (!PyArg_Parse (value, "f", &(object->dsize[0])));
+		if (StringEqual (name, "dSizeY"))
+				return (!PyArg_Parse (value, "f", &(object->dsize[1])));
+		if (StringEqual (name, "dSizeZ"))
+				return (!PyArg_Parse (value, "f", &(object->dsize[2])));
+		if (StringEqual (name, "dsize"))
+				return (!PyArg_Parse (value, "fff", &(object->dsize[0]),
+															&(object->dsize[1]), &(object->dsize[2])));
+		if (strncmp (name,"Eff", 3) == 0)
+		{
+				if ( (object->type == OB_IKA) && (object->data != NULL) )
+				{
+						ika = object->data;
+						switch (name[3])
+						{
+								case 'X':
+										return (!PyArg_Parse (value, "f", &(ika->effg[0])));
+								case 'Y':
+										return (!PyArg_Parse (value, "f", &(ika->effg[1])));
+								case 'Z':
+										return (!PyArg_Parse (value, "f", &(ika->effg[2])));
+								default:
+										/* Do we need to display a sensible error message here? */
+										return (0);
+						}
+				}
+				return (0);
+		}
+		if (StringEqual (name, "Layer"))
+				return (!PyArg_Parse (value, "i", &(object->lay)));
+		if (StringEqual (name, "parent"))
+		{
+				/* This is not allowed. */
+				PythonReturnErrorObject (PyExc_AttributeError,
+										"Setting the parent is not allowed.");
+				return (0);
+		}
+		if (StringEqual (name, "track"))
+		{
+				/* This is not allowed. */
+				PythonReturnErrorObject (PyExc_AttributeError,
+										"Setting the track is not allowed.");
+				return (0);
+		}
+		if (StringEqual (name, "data"))
+		{
+				/* This is not allowed. */
+				PythonReturnErrorObject (PyExc_AttributeError,
+										"Setting the data is not allowed.");
+				return (0);
+		}
+		if (StringEqual (name, "ipo"))
+		{
+				/* This is not allowed. */
+				PythonReturnErrorObject (PyExc_AttributeError,
+										"Setting the ipo is not allowed.");
+				return (0);
+		}
+		if (StringEqual (name, "mat"))
+		{
+				/* This is not allowed. */
+				PythonReturnErrorObject (PyExc_AttributeError,
+										"Setting the matrix is not allowed.");
+				return (0);
+		}
+		if (StringEqual (name, "matrix"))
+		{
+				/* This is not allowed. */
+				PythonReturnErrorObject (PyExc_AttributeError,
+										"Setting the matrix is not allowed.");
+				return (0);
+		}
+		if (StringEqual (name, "colbits"))
+				return (!PyArg_Parse (value, "h", &(object->colbits)));
+		if (StringEqual (name, "drawType"))
+		{
+				if (Object_setDrawType (obj, valtuple) != Py_None)
+						return (-1);
+				else
+						return (0);
+		}
+		if (StringEqual (name, "drawMode"))
+		{
+				if (Object_setDrawMode (obj, valtuple) != Py_None)
+						return (-1);
+				else
+						return (0);
+		}
+		if (StringEqual (name, "name"))
+		{
+				if (Object_setName (obj, valtuple) != Py_None)
+						return (-1);
+				else
+						return (0);
+		}
+
+		printf ("Unknown variable.\n");
+		return (0);
 }
 
 /*****************************************************************************/
-/* Function:    Object_compare                                               */
-/* Description: This is a callback function for the BPy_Object type. It      */
-/*              compares two Object_Type objects. Only the "==" and "!="     */
-/*              comparisons are meaninful. Returns 0 for equality and -1 if  */
-/*              they don't point to the same Blender Object struct.          */
-/*              In Python it becomes 1 if they are equal, 0 otherwise.       */
+/* Function:		Object_compare																							 */
+/* Description: This is a callback function for the BPy_Object type. It			 */
+/*							compares two Object_Type objects. Only the "==" and "!="		 */
+/*							comparisons are meaninful. Returns 0 for equality and -1 if  */
+/*							they don't point to the same Blender Object struct.					 */
+/*							In Python it becomes 1 if they are equal, 0 otherwise.			 */
 /*****************************************************************************/
 static int Object_compare (BPy_Object *a, BPy_Object *b)
 {
-  Object *pa = a->object, *pb = b->object;
-  return (pa == pb) ? 0:-1;
+	Object *pa = a->object, *pb = b->object;
+	return (pa == pb) ? 0:-1;
 }
 
 /*****************************************************************************/
-/* Function:    Object_repr                                                  */
-/* Description: This is a callback function for the BPy_Object type. It      */
-/*              builds a meaninful string to represent object objects.       */
+/* Function:		Object_repr																									 */
+/* Description: This is a callback function for the BPy_Object type. It			 */
+/*							builds a meaninful string to represent object objects.			 */
 /*****************************************************************************/
 static PyObject *Object_repr (BPy_Object *self)
 {
-  return PyString_FromFormat("[Object \"%s\"]", self->object->id.name+2);
+	return PyString_FromFormat("[Object \"%s\"]", self->object->id.name+2);
 }
 
diff --git a/source/blender/python/api2_2x/Object.h b/source/blender/python/api2_2x/Object.h
index 43ef17caef5f58254355f069ec5940e5a50f912f..b00e40f36e2111272b933cc36bd1cc3e0cef1e80 100644
--- a/source/blender/python/api2_2x/Object.h
+++ b/source/blender/python/api2_2x/Object.h
@@ -73,4 +73,6 @@ typedef struct {
     struct Object   * object;
 } BPy_Object;
 
+int EXPP_add_obdata(struct Object *object);
+
 #endif /* EXPP_OBJECT_H */
diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c
index 919fb1fb7a4cce9a4f6e52a7629fd4da0069b4e1..53bbf9f18fc0e55ccf328bba712451f233bd5ed4 100644
--- a/source/blender/python/api2_2x/Scene.c
+++ b/source/blender/python/api2_2x/Scene.c
@@ -17,7 +17,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Inc., 59 Temple Place - Suite 330, Boston, MA	02111-1307, USA.
  *
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
@@ -35,10 +35,10 @@
 #include <BKE_library.h>
 #include <BLI_blenlib.h>
 #include <BSE_headerbuttons.h> /* for copy_scene */
-#include <BIF_drawscene.h>     /* for set_scene */
-#include <BIF_space.h>         /* for copy_view3d_lock() */
+#include <BIF_drawscene.h>		 /* for set_scene */
+#include <BIF_space.h>				 /* for copy_view3d_lock() */
 #include <MEM_guardedalloc.h>  /* for MEM_callocN */
-#include <mydevice.h>          /* for #define REDRAW */
+#include <mydevice.h>					 /* for #define REDRAW */
 
 #include "Object.h"
 #include "bpy_types.h"
@@ -49,25 +49,25 @@ static Base *EXPP_Scene_getObjectBase (Scene *scene, Object *object);
 PyObject *M_Object_Get (PyObject *self, PyObject *args); /* from Object.c */
 
 /*****************************************************************************/
-/* Python BPy_Scene defaults:                                                */
+/* Python BPy_Scene defaults:																								 */
 /*****************************************************************************/
 #define EXPP_SCENE_FRAME_MAX 18000
 #define EXPP_SCENE_RENDER_WINRESOLUTION_MIN 4
 #define EXPP_SCENE_RENDER_WINRESOLUTION_MAX 10000
 
 /*****************************************************************************/
-/* Python API function prototypes for the Scene module.                      */
+/* Python API function prototypes for the Scene module.											 */
 /*****************************************************************************/
 static PyObject *M_Scene_New (PyObject *self, PyObject *args,
-                               PyObject *keywords);
+															 PyObject *keywords);
 static PyObject *M_Scene_Get (PyObject *self, PyObject *args);
 static PyObject *M_Scene_GetCurrent (PyObject *self);
 static PyObject *M_Scene_Unlink (PyObject *self, PyObject *arg);
 
 /*****************************************************************************/
-/* The following string definitions are used for documentation strings.      */
-/* In Python these will be written to the console when doing a               */
-/* Blender.Scene.__doc__                                                     */
+/* The following string definitions are used for documentation strings.			 */
+/* In Python these will be written to the console when doing a							 */
+/* Blender.Scene.__doc__																										 */
 /*****************************************************************************/
 static char M_Scene_doc[] =
 "The Blender.Scene submodule";
@@ -77,7 +77,7 @@ static char M_Scene_New_doc[] =
 
 static char M_Scene_Get_doc[] =
 "(name = None) - Return the scene called 'name'.\n\
-	         If 'name' is None, return a list with all Scenes.";
+					 If 'name' is None, return a list with all Scenes.";
 
 static char M_Scene_GetCurrent_doc[] =
 "() - Return the currently active Scene in Blender.";
@@ -87,24 +87,24 @@ static char M_Scene_Unlink_doc[] =
 (scene) is of type Blender scene.";
 
 /*****************************************************************************/
-/* Python method structure definition for Blender.Scene module:              */
+/* Python method structure definition for Blender.Scene module:							 */
 /*****************************************************************************/
 struct PyMethodDef M_Scene_methods[] = {
-  {"New",(PyCFunction)M_Scene_New, METH_VARARGS|METH_KEYWORDS,
-          M_Scene_New_doc},
-  {"Get",         M_Scene_Get,         METH_VARARGS, M_Scene_Get_doc},
-  {"get",         M_Scene_Get,         METH_VARARGS, M_Scene_Get_doc},
-  {"GetCurrent",(PyCFunction)M_Scene_GetCurrent,
-                             METH_NOARGS,  M_Scene_GetCurrent_doc},
-  {"getCurrent",(PyCFunction)M_Scene_GetCurrent,
-                             METH_NOARGS,  M_Scene_GetCurrent_doc},
-  {"Unlink",      M_Scene_Unlink,      METH_VARARGS, M_Scene_Unlink_doc},
-  {"unlink",      M_Scene_Unlink,      METH_VARARGS, M_Scene_Unlink_doc},
-  {NULL, NULL, 0, NULL}
+	{"New",(PyCFunction)M_Scene_New, METH_VARARGS|METH_KEYWORDS,
+					M_Scene_New_doc},
+	{"Get",					M_Scene_Get,				 METH_VARARGS, M_Scene_Get_doc},
+	{"get",					M_Scene_Get,				 METH_VARARGS, M_Scene_Get_doc},
+	{"GetCurrent",(PyCFunction)M_Scene_GetCurrent,
+														 METH_NOARGS,  M_Scene_GetCurrent_doc},
+	{"getCurrent",(PyCFunction)M_Scene_GetCurrent,
+														 METH_NOARGS,  M_Scene_GetCurrent_doc},
+	{"Unlink",			M_Scene_Unlink,			 METH_VARARGS, M_Scene_Unlink_doc},
+	{"unlink",			M_Scene_Unlink,			 METH_VARARGS, M_Scene_Unlink_doc},
+	{NULL, NULL, 0, NULL}
 };
 
 /*****************************************************************************/
-/* Python BPy_Scene methods declarations:                                    */
+/* Python BPy_Scene methods declarations:																		 */
 /*****************************************************************************/
 static PyObject *Scene_getName(BPy_Scene *self);
 static PyObject *Scene_setName(BPy_Scene *self, PyObject *arg);
@@ -126,61 +126,61 @@ static PyObject *Scene_getCurrentCamera(BPy_Scene *self);
 static PyObject *Scene_setCurrentCamera(BPy_Scene *self, PyObject *args);
 
 /*****************************************************************************/
-/* Python BPy_Scene methods table:                                           */
+/* Python BPy_Scene methods table:																					 */
 /*****************************************************************************/
 static PyMethodDef BPy_Scene_methods[] = {
  /* name, method, flags, doc */
-  {"getName", (PyCFunction)Scene_getName, METH_NOARGS,
-      "() - Return Scene name"},
-  {"setName", (PyCFunction)Scene_setName, METH_VARARGS,
-          "(str) - Change Scene name"},
-  {"getWinSize", (PyCFunction)Scene_getWinSize, METH_NOARGS,
-      "() - Return Render window [x,y] dimensions"},
-  {"setWinSize", (PyCFunction)Scene_setWinSize, METH_VARARGS,
-          "(str) - Change Render window [x,y] dimensions"},
-  {"copy",    (PyCFunction)Scene_copy, METH_VARARGS,
-          "(duplicate_objects = 1) - Return a copy of this scene\n"
-  "The optional argument duplicate_objects defines how the scene\n"
-  "children are duplicated:\n\t0: Link Objects\n\t1: Link Object Data"
-  "\n\t2: Full copy\n"},
-  {"startFrame", (PyCFunction)Scene_startFrame, METH_VARARGS,
-          "(frame) - If frame is given, the start frame is set and"
-                  "\nreturned in any case"},
-  {"endFrame", (PyCFunction)Scene_endFrame, METH_VARARGS,
-          "(frame) - If frame is given, the end frame is set and"
-                  "\nreturned in any case"},
-  {"currentFrame", (PyCFunction)Scene_currentFrame, METH_VARARGS,
-          "(frame) - If frame is given, the current frame is set and"
-                  "\nreturned in any case"},
-  {"frameSettings", (PyCFunction)Scene_frameSettings, METH_VARARGS,
-          "(start, end, current) - Sets or retrieves the Scene's frame"
+	{"getName", (PyCFunction)Scene_getName, METH_NOARGS,
+			"() - Return Scene name"},
+	{"setName", (PyCFunction)Scene_setName, METH_VARARGS,
+					"(str) - Change Scene name"},
+	{"getWinSize", (PyCFunction)Scene_getWinSize, METH_NOARGS,
+			"() - Return Render window [x,y] dimensions"},
+	{"setWinSize", (PyCFunction)Scene_setWinSize, METH_VARARGS,
+					"(str) - Change Render window [x,y] dimensions"},
+	{"copy",		(PyCFunction)Scene_copy, METH_VARARGS,
+					"(duplicate_objects = 1) - Return a copy of this scene\n"
+	"The optional argument duplicate_objects defines how the scene\n"
+	"children are duplicated:\n\t0: Link Objects\n\t1: Link Object Data"
+	"\n\t2: Full copy\n"},
+	{"startFrame", (PyCFunction)Scene_startFrame, METH_VARARGS,
+					"(frame) - If frame is given, the start frame is set and"
+									"\nreturned in any case"},
+	{"endFrame", (PyCFunction)Scene_endFrame, METH_VARARGS,
+					"(frame) - If frame is given, the end frame is set and"
+									"\nreturned in any case"},
+	{"currentFrame", (PyCFunction)Scene_currentFrame, METH_VARARGS,
+					"(frame) - If frame is given, the current frame is set and"
+									"\nreturned in any case"},
+	{"frameSettings", (PyCFunction)Scene_frameSettings, METH_VARARGS,
+					"(start, end, current) - Sets or retrieves the Scene's frame"
 					" settings.\nIf the frame arguments are specified, they are set. "
 					"A tuple (start, end, current) is returned in any case."},
-  {"makeCurrent", (PyCFunction)Scene_makeCurrent, METH_NOARGS,
-          "() - Make self the current scene"},
-  {"update", (PyCFunction)Scene_update, METH_VARARGS,
-          "(full = 0) - Update scene self.\n"
+	{"makeCurrent", (PyCFunction)Scene_makeCurrent, METH_NOARGS,
+					"() - Make self the current scene"},
+	{"update", (PyCFunction)Scene_update, METH_VARARGS,
+					"(full = 0) - Update scene self.\n"
 					"full = 0: sort the base list of objects."
 					"full = 1: full update -- also regroups, does ipos, ikas, keys"},
-  {"link", (PyCFunction)Scene_link, METH_VARARGS,
-          "(obj) - Link Object obj to this scene"},
-  {"unlink", (PyCFunction)Scene_unlink, METH_VARARGS,
-          "(obj) - Unlink Object obj from this scene"},
-  {"getRenderdir", (PyCFunction)Scene_getRenderdir, METH_NOARGS,
-          "() - Return directory where rendered images are saved to"},
-  {"getBackbufdir", (PyCFunction)Scene_getBackbufdir, METH_NOARGS,
-          "() - Return location of the backbuffer image"},
-  {"getChildren", (PyCFunction)Scene_getChildren, METH_NOARGS,
-          "() - Return list of all objects linked to scene self"},
-  {"getCurrentCamera", (PyCFunction)Scene_getCurrentCamera, METH_NOARGS,
-          "() - Return current active Camera"},
-  {"setCurrentCamera", (PyCFunction)Scene_setCurrentCamera, METH_VARARGS,
-          "() - Set the currently active Camera"},
-  {0}
+	{"link", (PyCFunction)Scene_link, METH_VARARGS,
+					"(obj) - Link Object obj to this scene"},
+	{"unlink", (PyCFunction)Scene_unlink, METH_VARARGS,
+					"(obj) - Unlink Object obj from this scene"},
+	{"getRenderdir", (PyCFunction)Scene_getRenderdir, METH_NOARGS,
+					"() - Return directory where rendered images are saved to"},
+	{"getBackbufdir", (PyCFunction)Scene_getBackbufdir, METH_NOARGS,
+					"() - Return location of the backbuffer image"},
+	{"getChildren", (PyCFunction)Scene_getChildren, METH_NOARGS,
+					"() - Return list of all objects linked to scene self"},
+	{"getCurrentCamera", (PyCFunction)Scene_getCurrentCamera, METH_NOARGS,
+					"() - Return current active Camera"},
+	{"setCurrentCamera", (PyCFunction)Scene_setCurrentCamera, METH_VARARGS,
+					"() - Set the currently active Camera"},
+	{0}
 };
 
 /*****************************************************************************/
-/* Python Scene_Type callback function prototypes:                           */
+/* Python Scene_Type callback function prototypes:													 */
 /*****************************************************************************/
 static void Scene_dealloc (BPy_Scene *self);
 static int Scene_setAttr (BPy_Scene *self, char *name, PyObject *v);
@@ -189,189 +189,189 @@ static PyObject *Scene_getAttr (BPy_Scene *self, char *name);
 static PyObject *Scene_repr (BPy_Scene *self);
 
 /*****************************************************************************/
-/* Python Scene_Type structure definition:                                   */
+/* Python Scene_Type structure definition:																	 */
 /*****************************************************************************/
 PyTypeObject Scene_Type =
 {
-  PyObject_HEAD_INIT(NULL)
-  0,                                      /* ob_size */
-  "Scene",                                /* tp_name */
-  sizeof (BPy_Scene),                     /* tp_basicsize */
-  0,                                      /* tp_itemsize */
-  /* methods */
-  (destructor)Scene_dealloc,              /* tp_dealloc */
-  0,                                      /* tp_print */
-  (getattrfunc)Scene_getAttr,             /* tp_getattr */
-  (setattrfunc)Scene_setAttr,             /* tp_setattr */
-  (cmpfunc)Scene_compare,                 /* tp_compare */
-  (reprfunc)Scene_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_Scene_methods,                      /* tp_methods */
-  0,                                      /* tp_members */
+	PyObject_HEAD_INIT(NULL)
+	0,																			/* ob_size */
+	"Scene",																/* tp_name */
+	sizeof (BPy_Scene),											/* tp_basicsize */
+	0,																			/* tp_itemsize */
+	/* methods */
+	(destructor)Scene_dealloc,							/* tp_dealloc */
+	0,																			/* tp_print */
+	(getattrfunc)Scene_getAttr,							/* tp_getattr */
+	(setattrfunc)Scene_setAttr,							/* tp_setattr */
+	(cmpfunc)Scene_compare,									/* tp_compare */
+	(reprfunc)Scene_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_Scene_methods,											/* tp_methods */
+	0,																			/* tp_members */
 };
 
 static PyObject *M_Scene_New(PyObject *self, PyObject *args, PyObject *kword)
 {
-  char     *name = "Scene";
-  char     *kw[] = {"name", NULL};
-  PyObject *pyscene; /* for the Scene object wrapper in Python */
-  Scene    *blscene; /* for the actual Scene we create in Blender */
+	char		 *name = "Scene";
+	char		 *kw[] = {"name", NULL};
+	PyObject *pyscene; /* for the Scene object wrapper in Python */
+	Scene		 *blscene; /* for the actual Scene we create in Blender */
 
-  if (!PyArg_ParseTupleAndKeywords(args, kword, "|s", kw, &name))
-    return (EXPP_ReturnPyObjError (PyExc_AttributeError,
-            "expected a string or an empty argument list"));
+	if (!PyArg_ParseTupleAndKeywords(args, kword, "|s", kw, &name))
+		return (EXPP_ReturnPyObjError (PyExc_AttributeError,
+						"expected a string or an empty argument list"));
 
-  blscene = add_scene(name); /* first create the Scene in Blender */
+	blscene = add_scene(name); /* first create the Scene in Blender */
 
-  if (blscene) /* now create the wrapper obj in Python */
-    pyscene = Scene_CreatePyObject (blscene);
-  else
-    return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
-                            "couldn't create Scene obj in Blender"));
+	if (blscene) /* now create the wrapper obj in Python */
+		pyscene = Scene_CreatePyObject (blscene);
+	else
+		return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
+														"couldn't create Scene obj in Blender"));
 
-  if (pyscene == NULL)
-    return (EXPP_ReturnPyObjError (PyExc_MemoryError,
-                            "couldn't create Scene PyObject"));
+	if (pyscene == NULL)
+		return (EXPP_ReturnPyObjError (PyExc_MemoryError,
+														"couldn't create Scene PyObject"));
 
-  return pyscene;
+	return pyscene;
 }
 
 static PyObject *M_Scene_Get(PyObject *self, PyObject *args)
 {
-  char  *name = NULL;
-  Scene *scene_iter;
+	char	*name = NULL;
+	Scene *scene_iter;
 
-  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)"));
 
-  scene_iter = G.main->scene.first;
+	scene_iter = G.main->scene.first;
 
-  if (name) { /* (name) - Search scene by name */
+	if (name) { /* (name) - Search scene by name */
 
-    PyObject *wanted_scene = NULL;
+		PyObject *wanted_scene = NULL;
 
-    while ((scene_iter) && (wanted_scene == NULL)) {
+		while ((scene_iter) && (wanted_scene == NULL)) {
 
-      if (strcmp (name, scene_iter->id.name+2) == 0)
-        wanted_scene = Scene_CreatePyObject (scene_iter);
+			if (strcmp (name, scene_iter->id.name+2) == 0)
+				wanted_scene = Scene_CreatePyObject (scene_iter);
 
-      scene_iter = scene_iter->id.next;
-    }
+			scene_iter = scene_iter->id.next;
+		}
 
-    if (wanted_scene == NULL) { /* Requested scene doesn't exist */
-      char error_msg[64];
-      PyOS_snprintf(error_msg, sizeof(error_msg),
-                      "Scene \"%s\" not found", name);
-      return (EXPP_ReturnPyObjError (PyExc_NameError, error_msg));
-    }
+		if (wanted_scene == NULL) { /* Requested scene doesn't exist */
+			char error_msg[64];
+			PyOS_snprintf(error_msg, sizeof(error_msg),
+											"Scene \"%s\" not found", name);
+			return (EXPP_ReturnPyObjError (PyExc_NameError, error_msg));
+		}
 
-    return wanted_scene;
-  }
+		return wanted_scene;
+	}
 
-  else { /* () - return a list with wrappers for all scenes in Blender */
-    int index = 0;
-    PyObject *sce_pylist, *pyobj;
+	else { /* () - return a list with wrappers for all scenes in Blender */
+		int index = 0;
+		PyObject *sce_pylist, *pyobj;
 
-    sce_pylist = PyList_New (BLI_countlist (&(G.main->scene)));
+		sce_pylist = PyList_New (BLI_countlist (&(G.main->scene)));
 
-    if (sce_pylist == NULL)
-      return (PythonReturnErrorObject (PyExc_MemoryError,
-              "couldn't create PyList"));
+		if (sce_pylist == NULL)
+			return (PythonReturnErrorObject (PyExc_MemoryError,
+							"couldn't create PyList"));
 
-    while (scene_iter) {
-      pyobj = Scene_CreatePyObject (scene_iter);
+		while (scene_iter) {
+			pyobj = Scene_CreatePyObject (scene_iter);
 
-      if (!pyobj)
-        return (PythonReturnErrorObject (PyExc_MemoryError,
-                  "couldn't create PyString"));
+			if (!pyobj)
+				return (PythonReturnErrorObject (PyExc_MemoryError,
+									"couldn't create PyString"));
 
-      PyList_SET_ITEM (sce_pylist, index, pyobj);
+			PyList_SET_ITEM (sce_pylist, index, pyobj);
 
-      scene_iter = scene_iter->id.next;
-      index++;
-    }
+			scene_iter = scene_iter->id.next;
+			index++;
+		}
 
-    return sce_pylist;
-  }
+		return sce_pylist;
+	}
 }
 
 static PyObject *M_Scene_GetCurrent (PyObject *self)
 {
-  return Scene_CreatePyObject ((Scene *)G.scene);
+	return Scene_CreatePyObject ((Scene *)G.scene);
 }
 
 static PyObject *M_Scene_Unlink (PyObject *self, PyObject *args)
 { 
-  PyObject *pyobj;
-  Scene    *scene;
+	PyObject *pyobj;
+	Scene		 *scene;
 
-  if (!PyArg_ParseTuple (args, "O!", &Scene_Type, &pyobj))
-        return EXPP_ReturnPyObjError (PyExc_TypeError,
-                "expected Scene PyType object");
+	if (!PyArg_ParseTuple (args, "O!", &Scene_Type, &pyobj))
+				return EXPP_ReturnPyObjError (PyExc_TypeError,
+								"expected Scene PyType object");
 
-  scene = ((BPy_Scene *)pyobj)->scene;
+	scene = ((BPy_Scene *)pyobj)->scene;
 
-  if (scene == G.scene)
-        return EXPP_ReturnPyObjError (PyExc_SystemError,
-                "current Scene cannot be removed!");
+	if (scene == G.scene)
+				return EXPP_ReturnPyObjError (PyExc_SystemError,
+								"current Scene cannot be removed!");
 
-  free_libblock(&G.main->scene, scene);
+	free_libblock(&G.main->scene, scene);
 
-  Py_INCREF(Py_None);
-  return Py_None;
+	Py_INCREF(Py_None);
+	return Py_None;
 }
 
 PyObject *Scene_Init (void)
 {
-  PyObject  *submodule;
+	PyObject	*submodule;
 
-  Scene_Type.ob_type = &PyType_Type;
+	Scene_Type.ob_type = &PyType_Type;
 
-  submodule = Py_InitModule3("Blender.Scene",
-                  M_Scene_methods, M_Scene_doc);
+	submodule = Py_InitModule3("Blender.Scene",
+									M_Scene_methods, M_Scene_doc);
 
-  return submodule;
+	return submodule;
 }
 
 PyObject *Scene_CreatePyObject (Scene *scene)
 {
-  BPy_Scene *pyscene;
+	BPy_Scene *pyscene;
 
-  pyscene = (BPy_Scene *)PyObject_NEW (BPy_Scene, &Scene_Type);
+	pyscene = (BPy_Scene *)PyObject_NEW (BPy_Scene, &Scene_Type);
 
-  if (!pyscene)
-    return EXPP_ReturnPyObjError (PyExc_MemoryError,
-            "couldn't create BPy_Scene object");
+	if (!pyscene)
+		return EXPP_ReturnPyObjError (PyExc_MemoryError,
+						"couldn't create BPy_Scene object");
 
-  pyscene->scene = scene;
+	pyscene->scene = scene;
 
-  return (PyObject *)pyscene;
+	return (PyObject *)pyscene;
 }
 
 int Scene_CheckPyObject (PyObject *pyobj)
 {
-  return (pyobj->ob_type == &Scene_Type);
+	return (pyobj->ob_type == &Scene_Type);
 }
 
 Scene *Scene_FromPyObject (PyObject *pyobj)
 {
-  return ((BPy_Scene *)pyobj)->scene;
+	return ((BPy_Scene *)pyobj)->scene;
 }
 
 /*****************************************************************************/
-/* Description: Returns the object with the name specified by the argument   */
-/*              name. Note that the calling function has to remove the first */
-/*              two characters of the object name. These two characters      */
-/*              specify the type of the object (OB, ME, WO, ...)             */
-/*              The function will return NULL when no object with the given  */
-/*              name is found.                                               */
+/* Description: Returns the object with the name specified by the argument	 */
+/*							name. Note that the calling function has to remove the first */
+/*							two characters of the object name. These two characters			 */
+/*							specify the type of the object (OB, ME, WO, ...)						 */
+/*							The function will return NULL when no object with the given  */
+/*							name is found.																							 */
 /*****************************************************************************/
 Scene * GetSceneByName (char * name)
 {
@@ -392,52 +392,52 @@ Scene * GetSceneByName (char * name)
 }
 
 /*****************************************************************************/
-/* Python BPy_Scene methods:                                                 */
+/* Python BPy_Scene methods:																								 */
 /*****************************************************************************/
 static PyObject *Scene_getName(BPy_Scene *self)
 {
-  PyObject *attr = PyString_FromString(self->scene->id.name+2);
+	PyObject *attr = PyString_FromString(self->scene->id.name+2);
 
-  if (attr) return attr;
+	if (attr) return attr;
 
-  return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
-                                   "couldn't get Scene.name attribute"));
+	return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
+																	 "couldn't get Scene.name attribute"));
 }
 
 static PyObject *Scene_setName(BPy_Scene *self, PyObject *args)
 {
-  char *name;
-  char buf[21];
+	char *name;
+	char buf[21];
 
-  if (!PyArg_ParseTuple(args, "s", &name))
-    return (EXPP_ReturnPyObjError (PyExc_TypeError,
-                                     "expected string argument"));
+	if (!PyArg_ParseTuple(args, "s", &name))
+		return (EXPP_ReturnPyObjError (PyExc_TypeError,
+																		 "expected string argument"));
 
-  PyOS_snprintf(buf, sizeof(buf), "%s", name);
+	PyOS_snprintf(buf, sizeof(buf), "%s", name);
 
-  rename_id(&self->scene->id, buf);
+	rename_id(&self->scene->id, buf);
 
-  Py_INCREF(Py_None);
-  return Py_None;
+	Py_INCREF(Py_None);
+	return Py_None;
 }
 
 static PyObject *Scene_getWinSize(BPy_Scene *self)
 {
-  PyObject* list = PyList_New (0);
-  Scene *scene = self->scene;
+	PyObject* list = PyList_New (0);
+	Scene *scene = self->scene;
 
-  PyList_Append (list, PyInt_FromLong(scene->r.xsch));
-  PyList_Append (list, PyInt_FromLong(scene->r.ysch));
+	PyList_Append (list, PyInt_FromLong(scene->r.xsch));
+	PyList_Append (list, PyInt_FromLong(scene->r.ysch));
 
 	return list;
 }
 
 static PyObject *Scene_setWinSize(BPy_Scene *self, PyObject *args)
 {
- 	int xres = -1, yres = -1;
+	int xres = -1, yres = -1;
 
-  if (!PyArg_ParseTuple(args, "(ii)", &xres, &yres))
-    return EXPP_ReturnPyObjError (PyExc_TypeError,
+	if (!PyArg_ParseTuple(args, "(ii)", &xres, &yres))
+		return EXPP_ReturnPyObjError (PyExc_TypeError,
 							"expected a [x, y] list as argument");
 
 	if (xres > 0)
@@ -445,30 +445,30 @@ static PyObject *Scene_setWinSize(BPy_Scene *self, PyObject *args)
 										EXPP_SCENE_RENDER_WINRESOLUTION_MIN,
 										EXPP_SCENE_RENDER_WINRESOLUTION_MAX);
 
-  if (yres > 0)
+	if (yres > 0)
 		self->scene->r.ysch = EXPP_ClampInt(yres,
 										EXPP_SCENE_RENDER_WINRESOLUTION_MIN,
 										EXPP_SCENE_RENDER_WINRESOLUTION_MAX);
 
-  Py_INCREF(Py_None);
+	Py_INCREF(Py_None);
 
 	return Py_None;
 }
 
 static PyObject *Scene_copy (BPy_Scene *self, PyObject *args)
 {
-  short dup_objs = 1;
-  Scene *scene = self->scene;
+	short dup_objs = 1;
+	Scene *scene = self->scene;
 
-  if (!scene)
-    return EXPP_ReturnPyObjError (PyExc_RuntimeError,
-            "Blender Scene was deleted!");
+	if (!scene)
+		return EXPP_ReturnPyObjError (PyExc_RuntimeError,
+						"Blender Scene was deleted!");
 
-  if (!PyArg_ParseTuple (args, "|h", &dup_objs))
-    return EXPP_ReturnPyObjError (PyExc_TypeError,
-            "expected int in [0,2] or nothing as argument");
+	if (!PyArg_ParseTuple (args, "|h", &dup_objs))
+		return EXPP_ReturnPyObjError (PyExc_TypeError,
+						"expected int in [0,2] or nothing as argument");
 
-  return Scene_CreatePyObject (copy_scene (scene, dup_objs));
+	return Scene_CreatePyObject (copy_scene (scene, dup_objs));
 }
 
 /* Blender seems to accept any positive value up to 18000 for start, end and
@@ -476,74 +476,74 @@ static PyObject *Scene_copy (BPy_Scene *self, PyObject *args)
 
 static PyObject *Scene_currentFrame (BPy_Scene *self, PyObject *args)
 {
-  short frame = -1;
-  RenderData *rd = &self->scene->r;
+	short frame = -1;
+	RenderData *rd = &self->scene->r;
 
-  if (!PyArg_ParseTuple (args, "|h", &frame))
-    return EXPP_ReturnPyObjError (PyExc_TypeError,
-            "expected int argument or nothing");
+	if (!PyArg_ParseTuple (args, "|h", &frame))
+		return EXPP_ReturnPyObjError (PyExc_TypeError,
+						"expected int argument or nothing");
 
-  if (frame > 0) rd->cfra = EXPP_ClampInt(frame, 1, EXPP_SCENE_FRAME_MAX);
+	if (frame > 0) rd->cfra = EXPP_ClampInt(frame, 1, EXPP_SCENE_FRAME_MAX);
 
-  return PyInt_FromLong (rd->cfra);
+	return PyInt_FromLong (rd->cfra);
 }
 
 static PyObject *Scene_startFrame (BPy_Scene *self, PyObject *args)
 {
-  short frame = -1;
-  RenderData *rd = &self->scene->r;
+	short frame = -1;
+	RenderData *rd = &self->scene->r;
 
-  if (!PyArg_ParseTuple (args, "|h", &frame))
-    return EXPP_ReturnPyObjError (PyExc_TypeError,
-            "expected int argument or nothing");
+	if (!PyArg_ParseTuple (args, "|h", &frame))
+		return EXPP_ReturnPyObjError (PyExc_TypeError,
+						"expected int argument or nothing");
 
-  if (frame > 0) rd->sfra = EXPP_ClampInt (frame, 1, EXPP_SCENE_FRAME_MAX);
+	if (frame > 0) rd->sfra = EXPP_ClampInt (frame, 1, EXPP_SCENE_FRAME_MAX);
 
-  return PyInt_FromLong (rd->sfra);
+	return PyInt_FromLong (rd->sfra);
 }
 
 static PyObject *Scene_endFrame (BPy_Scene *self, PyObject *args)
 {
-  short frame = -1;
-  RenderData *rd = &self->scene->r;
+	short frame = -1;
+	RenderData *rd = &self->scene->r;
 
-  if (!PyArg_ParseTuple (args, "|h", &frame))
-    return EXPP_ReturnPyObjError (PyExc_TypeError,
-            "expected int argument or nothing");
+	if (!PyArg_ParseTuple (args, "|h", &frame))
+		return EXPP_ReturnPyObjError (PyExc_TypeError,
+						"expected int argument or nothing");
 
-  if (frame > 0) rd->efra = EXPP_ClampInt (frame, 1, EXPP_SCENE_FRAME_MAX);
+	if (frame > 0) rd->efra = EXPP_ClampInt (frame, 1, EXPP_SCENE_FRAME_MAX);
 
-  return PyInt_FromLong (rd->efra);
+	return PyInt_FromLong (rd->efra);
 }
 
 static PyObject *Scene_makeCurrent (BPy_Scene *self)
 {
-  Scene *scene = self->scene;
+	Scene *scene = self->scene;
 
-  if (scene) set_scene (scene);
+	if (scene) set_scene (scene);
 
-  Py_INCREF (Py_None);
-  return Py_None;
+	Py_INCREF (Py_None);
+	return Py_None;
 }
 
 static PyObject *Scene_update (BPy_Scene *self, PyObject *args)
 {
-  Scene *scene = self->scene;
+	Scene *scene = self->scene;
 	int full = 0;
 
-  if (!scene)
-      return EXPP_ReturnPyObjError (PyExc_RuntimeError,
-              "Blender Scene was deleted!");
+	if (!scene)
+			return EXPP_ReturnPyObjError (PyExc_RuntimeError,
+							"Blender Scene was deleted!");
 
-  if (!PyArg_ParseTuple (args, "|i", &full))
-      return EXPP_ReturnPyObjError (PyExc_TypeError,
-              "expected nothing or int (0 or 1) argument");
+	if (!PyArg_ParseTuple (args, "|i", &full))
+			return EXPP_ReturnPyObjError (PyExc_TypeError,
+							"expected nothing or int (0 or 1) argument");
 
 /* Under certain circunstances, sort_baselist *here* can crash Blender.
  * A "RuntimeError: max recursion limit" happens when a scriptlink
  * on frame change has scene.update(1).
  * Investigate better how to avoid this. */
-  if (!full)
+	if (!full)
 		sort_baselist (scene);
 
 	else if (full == 1)
@@ -551,110 +551,114 @@ static PyObject *Scene_update (BPy_Scene *self, PyObject *args)
 
 	else
 		return EXPP_ReturnPyObjError (PyExc_ValueError,
-						"in method scene.update(full), full should be:\n"
-						"0: to only sort scene elements (old behavior); or\n"
-						"1: for a full update (regroups, does ipos, ikas, keys, etc.)");
+			"in method scene.update(full), full should be:\n"
+			"0: to only sort scene elements (old behavior); or\n"
+			"1: for a full update (regroups, does ipos, ikas, keys, etc.)");
 
-  Py_INCREF (Py_None);
-  return Py_None;
+	Py_INCREF (Py_None);
+	return Py_None;
 }
 
 static PyObject *Scene_link (BPy_Scene *self, PyObject *args)
 {
-  Scene    *scene = self->scene;
-  BPy_Object *bpy_obj;
+	Scene *scene = self->scene;
+	BPy_Object *bpy_obj;
 
-  if (!scene)
-      return EXPP_ReturnPyObjError (PyExc_RuntimeError,
-              "Blender Scene was deleted!");
+	if (!scene)
+		return EXPP_ReturnPyObjError (PyExc_RuntimeError,
+			"Blender Scene was deleted!");
 
-  if (!PyArg_ParseTuple (args, "O!", &Object_Type, &bpy_obj))
-      return EXPP_ReturnPyObjError (PyExc_TypeError,
-              "expected Object argument");
+	if (!PyArg_ParseTuple (args, "O!", &Object_Type, &bpy_obj))
+		return EXPP_ReturnPyObjError (PyExc_TypeError,
+			"expected Object argument");
 
-  else { /* Ok, all is fine, let's try to link it */
-    Object *object = bpy_obj->object;
-    Base *base;
+	else { /* Ok, all is fine, let's try to link it */
+		Object *object = bpy_obj->object;
+		Base *base;
 
-    /* We need to link the object to a 'Base', then link this base
-     * to the scene.  See DNA_scene_types.h ... */
+		/* We need to link the object to a 'Base', then link this base
+		 * to the scene.	See DNA_scene_types.h ... */
 
-    /* First, check if the object isn't already in the scene */
-    base = EXPP_Scene_getObjectBase (scene, object);
-    /* if base is not NULL ... */
-    if (base) /* ... the object is already in one of the Scene Bases */
-      return EXPP_ReturnPyObjError (PyExc_RuntimeError,
-              "object already in scene!");
+		/* First, check if the object isn't already in the scene */
+		base = EXPP_Scene_getObjectBase (scene, object);
+		/* if base is not NULL ... */
+		if (base) /* ... the object is already in one of the Scene Bases */
+			return EXPP_ReturnPyObjError (PyExc_RuntimeError,
+							"object already in scene!");
 
-    /* not linked, go get mem for a new base object */
+		/* not linked, go get mem for a new base object */
 
-    base = MEM_callocN(sizeof(Base), "newbase");
+		base = MEM_callocN(sizeof(Base), "newbase");
  
-    if (!base)
-      return EXPP_ReturnPyObjError (PyExc_MemoryError,
-              "couldn't allocate new Base for object");
+		if (!base)
+			return EXPP_ReturnPyObjError (PyExc_MemoryError,
+							"couldn't allocate new Base for object");
+
+		/* check if this object has obdata, case not, try to create it */
+		if (!object->data && (object->type != OB_EMPTY))
+			EXPP_add_obdata(object); /* returns -1 on error, defined in Object.c */
 
-    base->object = object; /* link object to the new base */
-    base->lay = object->lay;
-    base->flag = object->flag;
+		base->object = object; /* link object to the new base */
+		base->lay = object->lay;
+		base->flag = object->flag;
 
-    object->id.us += 1; /* incref the object user count in Blender */
+		object->id.us += 1; /* incref the object user count in Blender */
 
-    BLI_addhead(&scene->base, base); /* finally, link new base to scene */
-  }
+		BLI_addhead(&scene->base, base); /* finally, link new base to scene */
+	}
 
-  Py_INCREF (Py_None);
-  return Py_None;
+	Py_INCREF (Py_None);
+	return Py_None;
 }
 
 static PyObject *Scene_unlink (BPy_Scene *self, PyObject *args)
 { 
-  BPy_Object *bpy_obj = NULL;
-  Object *object;
-  Scene *scene = self->scene;
-  Base *base;
-  short retval = 0;
-
-  if (!scene)
-    return EXPP_ReturnPyObjError (PyExc_RuntimeError,
-            "Blender scene was deleted!");
-
-  if (!PyArg_ParseTuple(args, "O!", &Object_Type, &bpy_obj))
-    return EXPP_ReturnPyObjError (PyExc_TypeError,
-            "expected Object as argument");
+	BPy_Object *bpy_obj = NULL;
+	Object *object;
+	Scene *scene = self->scene;
+	Base *base;
+	short retval = 0;
 
-  object = bpy_obj->object;
+	if (!scene)
+		return EXPP_ReturnPyObjError (PyExc_RuntimeError,
+						"Blender scene was deleted!");
 
-  /* is the object really in the scene? */
-  base = EXPP_Scene_getObjectBase(scene, object);
-   
-  if (base) { /* if it is, remove it: */
-    BLI_remlink(&scene->base, base);
-    object->id.us -= 1;
-    MEM_freeN (base);
-    scene->basact = 0; /* in case the object was selected */
-    retval = 1;
-  }
+	if (!PyArg_ParseTuple(args, "O!", &Object_Type, &bpy_obj))
+		return EXPP_ReturnPyObjError (PyExc_TypeError,
+						"expected Object as argument");
+
+	object = bpy_obj->object;
+
+	/* is the object really in the scene? */
+	base = EXPP_Scene_getObjectBase(scene, object);
+	 
+	if (base) { /* if it is, remove it: */
+		BLI_remlink(&scene->base, base);
+		object->id.us -= 1;
+		MEM_freeN (base);
+		scene->basact = 0; /* in case the object was selected */
+		retval = 1;
+	}
 
-  return Py_BuildValue ("i", PyInt_FromLong (retval));
+	return Py_BuildValue ("i", PyInt_FromLong (retval));
 }
 
 static PyObject *Scene_getRenderdir (BPy_Scene *self)
 {
-  if (self->scene)
-    return PyString_FromString (self->scene->r.pic);
-  else
-    return EXPP_ReturnPyObjError (PyExc_RuntimeError,
-            "Blender Scene was deleted!");
+	if (self->scene)
+		return PyString_FromString (self->scene->r.pic);
+	else
+		return EXPP_ReturnPyObjError (PyExc_RuntimeError,
+						"Blender Scene was deleted!");
 }
 
 static PyObject *Scene_getBackbufdir (BPy_Scene *self)
 {
-  if (self->scene)
-    return PyString_FromString (self->scene->r.backbuf);
-  else
-    return EXPP_ReturnPyObjError (PyExc_RuntimeError,
-            "Blender Scene already deleted");
+	if (self->scene)
+		return PyString_FromString (self->scene->r.backbuf);
+	else
+		return EXPP_ReturnPyObjError (PyExc_RuntimeError,
+						"Blender Scene already deleted");
 }
 
 static PyObject *Scene_frameSettings (BPy_Scene *self, PyObject *args)
@@ -675,8 +679,8 @@ static PyObject *Scene_frameSettings (BPy_Scene *self, PyObject *args)
 		return EXPP_ReturnPyObjError (PyExc_TypeError,
 						"expected three ints or nothing as arguments");
 
-	if (start > 0)   rd->sfra = EXPP_ClampInt (start, 1, EXPP_SCENE_FRAME_MAX);
-	if (end > 0)     rd->efra = EXPP_ClampInt (end, 1, EXPP_SCENE_FRAME_MAX);
+	if (start > 0)	 rd->sfra = EXPP_ClampInt (start, 1, EXPP_SCENE_FRAME_MAX);
+	if (end > 0)		 rd->efra = EXPP_ClampInt (end, 1, EXPP_SCENE_FRAME_MAX);
 	if (current > 0) rd->cfra = EXPP_ClampInt (current, 1, EXPP_SCENE_FRAME_MAX);
 
 	return Py_BuildValue("(iii)", rd->sfra, rd->efra, rd->cfra);
@@ -729,7 +733,7 @@ static PyObject *Scene_getCurrentCamera (BPy_Scene *self)
 	if (cam_obj) /* if found, return a wrapper for it */
 		return M_Object_Get (Py_None, Py_BuildValue ("(s)", cam_obj->id.name+2));
 
-  Py_INCREF(Py_None); /* none found */
+	Py_INCREF(Py_None); /* none found */
 	return Py_None;
 }
 
@@ -763,90 +767,90 @@ static PyObject *Scene_setCurrentCamera (BPy_Scene *self, PyObject *args)
 
 static void Scene_dealloc (BPy_Scene *self)
 {
-  PyObject_DEL (self);
+	PyObject_DEL (self);
 }
 
 static PyObject *Scene_getAttr (BPy_Scene *self, char *name)
 {
-  PyObject *attr = Py_None;
+	PyObject *attr = Py_None;
 
-  if (strcmp(name, "name") == 0)
-    attr = PyString_FromString(self->scene->id.name+2);
+	if (strcmp(name, "name") == 0)
+		attr = PyString_FromString(self->scene->id.name+2);
 
-  else if (strcmp(name, "__members__") == 0)
-    attr = Py_BuildValue("[s]", "name");
+	else if (strcmp(name, "__members__") == 0)
+		attr = Py_BuildValue("[s]", "name");
 
 
-  if (!attr)
-    return (EXPP_ReturnPyObjError (PyExc_MemoryError,
-                      "couldn't create PyObject"));
+	if (!attr)
+		return (EXPP_ReturnPyObjError (PyExc_MemoryError,
+											"couldn't create PyObject"));
 
-  if (attr != Py_None) return attr; /* member attribute found, return it */
+	if (attr != Py_None) return attr; /* member attribute found, return it */
 
-  /* not an attribute, search the methods table */
-  return Py_FindMethod(BPy_Scene_methods, (PyObject *)self, name);
+	/* not an attribute, search the methods table */
+	return Py_FindMethod(BPy_Scene_methods, (PyObject *)self, name);
 }
 
 static int Scene_setAttr (BPy_Scene *self, char *name, PyObject *value)
 {
-  PyObject *valtuple; 
-  PyObject *error = NULL;
+	PyObject *valtuple; 
+	PyObject *error = NULL;
 
-/* We're playing a trick on the Python API users here.  Even if they use
+/* We're playing a trick on the Python API users here.	Even if they use
  * Scene.member = val instead of Scene.setMember(val), we end up using the
  * function anyway, since it already has error checking, clamps to the right
  * interval and updates the Blender Scene structure when necessary. */
 
 /* First we put "value" in a tuple, because we want to pass it to functions
  * that only accept PyTuples. Using "N" doesn't increment value's ref count */
-  valtuple = Py_BuildValue("(O)", value);
+	valtuple = Py_BuildValue("(O)", value);
 
-  if (!valtuple) /* everything OK with our PyObject? */
-    return EXPP_ReturnIntError(PyExc_MemoryError,
-                         "SceneSetAttr: couldn't create PyTuple");
+	if (!valtuple) /* everything OK with our PyObject? */
+		return EXPP_ReturnIntError(PyExc_MemoryError,
+												 "SceneSetAttr: couldn't create PyTuple");
 
 /* Now we just compare "name" with all possible BPy_Scene member variables */
-  if (strcmp (name, "name") == 0)
-    error = Scene_setName (self, valtuple);
+	if (strcmp (name, "name") == 0)
+		error = Scene_setName (self, valtuple);
 
-  else { /* Error: no member with the given name was found */
-    Py_DECREF(valtuple);
-    return (EXPP_ReturnIntError (PyExc_AttributeError, name));
-  }
+	else { /* Error: no member with the given name was found */
+		Py_DECREF(valtuple);
+		return (EXPP_ReturnIntError (PyExc_AttributeError, name));
+	}
 
 /* valtuple won't be returned to the caller, so we need to DECREF it */
-  Py_DECREF(valtuple);
+	Py_DECREF(valtuple);
 
-  if (error != Py_None) return -1;
+	if (error != Py_None) return -1;
 
 /* Py_None was incref'ed by the called Scene_set* function. We probably
  * don't need to decref Py_None (!), but since Python/C API manual tells us
  * to treat it like any other PyObject regarding ref counting ... */
-  Py_DECREF(Py_None);
-  return 0; /* normal exit */
+	Py_DECREF(Py_None);
+	return 0; /* normal exit */
 }
 
 static int Scene_compare (BPy_Scene *a, BPy_Scene *b)
 {
-  Scene *pa = a->scene, *pb = b->scene;
-  return (pa == pb) ? 0:-1;
+	Scene *pa = a->scene, *pb = b->scene;
+	return (pa == pb) ? 0:-1;
 }
 
 static PyObject *Scene_repr (BPy_Scene *self)
 {
-  return PyString_FromFormat("[Scene \"%s\"]", self->scene->id.name+2);
+	return PyString_FromFormat("[Scene \"%s\"]", self->scene->id.name+2);
 }
 
 Base *EXPP_Scene_getObjectBase(Scene *scene, Object *object)
 {
-  Base *base = scene->base.first;
+	Base *base = scene->base.first;
 
-  while (base) {
+	while (base) {
 
-    if (object == base->object) return base; /* found it? */
+		if (object == base->object) return base; /* found it? */
 
-    base = base->next;
-  }
+		base = base->next;
+	}
 
-  return NULL; /* object isn't linked to this scene */
+	return NULL; /* object isn't linked to this scene */
 }
diff --git a/source/blender/python/api2_2x/doc/Scene.py b/source/blender/python/api2_2x/doc/Scene.py
index 425cafe85b64f3ebea80bda50005858a0b5de8b3..a9fc8c65e4e81b73bc45d07f92413575b9669b0c 100644
--- a/source/blender/python/api2_2x/doc/Scene.py
+++ b/source/blender/python/api2_2x/doc/Scene.py
@@ -15,13 +15,25 @@ Example::
   camdata = Camera.New('ortho')           # create new camera data
   camdata.setName('newCam')
   camdata.setLens(16.0)
-  camobj = Object.New('Camera')           # create a new camera object
-  camobj.link(camdata)                    # link data to object
   scene = Scene.New('NewScene')           # create a new scene
-  scene.link(camobj)                      # link object to scene
+  camobj = Object.New('Camera')           # create a new camera object
+  camobj.link(camdata)                    # (*) link data to object first
+  scene.link(camobj)                      # and then link object to scene
   scene.frameSettings(1, 100 ,1)          # set start, end and current frames
   scene.setWinSize(640, 480)              # set the render window dimensions
   scene.makeCurrent()                     # make this the current scene
+
+@warn: as done in the example (*), it's recommended to first link object data to
+    objects and only after that link objects to scene.  This is because if
+    there is no object data linked to an object ob, scene.link(ob) will
+    automatically create the missing data.  This is ok on its own, but I{if
+    after that} this object is linked to obdata, the automatically created one
+    will be discarded -- as expected -- but will stay in Blender's memory
+    space until the program is exited, since Blender doesn't really get rid of
+    most kinds of data.  So first linking obdata to object, then object to
+    scene is a tiny tiny bit faster than the other way around and also saves
+    some realtime memory (if many objects are created from scripts, the
+    savings become important).
 """
 
 def New (name = 'Scene'):