Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Swaney <sswaney@centurytel.net>2008-04-06 01:33:06 +0400
committerStephen Swaney <sswaney@centurytel.net>2008-04-06 01:33:06 +0400
commit6e5984ce399ec18b6d91dcd19f9ae4ac705d9fbf (patch)
tree540b860137d8eb4cfb9da5169f486c93b882cef4 /source/blender/python/api2_2x
parent83906a614bfd8f9e36affd4ff34426cbd34b5302 (diff)
Python API - read access to Track and Up axis attributes for Object.
Part of Patch 8557. Contributed by Cedric Paille. Thanks! Still waiting for API doc for new attributes. Finger is poised over Revert button...
Diffstat (limited to 'source/blender/python/api2_2x')
-rw-r--r--source/blender/python/api2_2x/Object.c75
1 files changed, 73 insertions, 2 deletions
diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c
index 311d13a18fa..02403c71a36 100644
--- a/source/blender/python/api2_2x/Object.c
+++ b/source/blender/python/api2_2x/Object.c
@@ -459,6 +459,8 @@ static PyObject *Object_insertShapeKey(BPy_Object * self);
static PyObject *Object_copyNLA( BPy_Object * self, PyObject * args );
static PyObject *Object_convertActionToStrip( BPy_Object * self );
static PyObject *Object_copy(BPy_Object * self); /* __copy__ */
+static PyObject *Object_trackAxis(BPy_Object * self);
+static PyObject *Object_upAxis(BPy_Object * self);
/*****************************************************************************/
/* Python BPy_Object methods table: */
@@ -1471,7 +1473,6 @@ static PyObject *Object_getType( BPy_Object * self )
static PyObject *Object_getBoundBox( BPy_Object * self )
{
- int i;
float *vec = NULL;
PyObject *vector, *bbox;
@@ -5060,7 +5061,14 @@ static PyGetSetDef BPy_Object_getseters[] = {
(getter)Object_getRBHalfExtents, (setter)NULL,
"Rigid body physics bounds object type",
NULL},
-
+ {"trackAxis",
+ (getter)Object_trackAxis, (setter)NULL,
+ "track axis 'x' | 'y' | 'z' | '-x' | '-y' | '-z' (string. readonly)",
+ NULL},
+ {"upAxis",
+ (getter)Object_upAxis, (setter)NULL,
+ "up axis 'x' | 'y' | 'z' (string. readonly)",
+ NULL},
{"restrictDisplay",
(getter)Object_getRestricted, (setter)Object_setRestricted,
"Toggle object restrictions",
@@ -5172,6 +5180,7 @@ PyTypeObject Object_Type = {
NULL
};
+
static PyObject *M_Object_DrawModesDict( void )
{
PyObject *M = PyConstant_New( );
@@ -5948,3 +5957,65 @@ static PyObject *Object_SetSBStiffQuads( BPy_Object * self, PyObject * args )
return EXPP_setterWrapper( (void *)self, args,
(setter)Object_setSBStiffQuads );
}
+
+static PyObject *Object_trackAxis( BPy_Object * self )
+{
+ Object* ob;
+ char ctr[3];
+
+ memset( ctr, 0, sizeof(ctr));
+ ob = self->object;
+
+ switch(ob->trackflag){
+ case(0):
+ ctr[0] = 'X';
+ break;
+ case(1):
+ ctr[0] = 'Y';
+ break;
+ case(2):
+ ctr[0] = 'Z';
+ break;
+ case(3):
+ ctr[0] = '-';
+ ctr[1] = 'X';
+ break;
+ case(4):
+ ctr[0] = '-';
+ ctr[1] = 'Y';
+ break;
+ case(5):
+ ctr[0] = '-';
+ ctr[1] = 'Y';
+ break;
+ default:
+ break;
+ }
+
+ return PyString_FromString(ctr);
+}
+
+static PyObject *Object_upAxis( BPy_Object * self )
+{
+ Object* ob;
+ char cup[2];
+
+ memset( cup, 0, sizeof(cup));
+ ob = self->object;
+
+ switch(ob->upflag){
+ case(0):
+ cup[0] = 'X';
+ break;
+ case(1):
+ cup[0] = 'Y';
+ break;
+ case(2):
+ cup[0] = 'Z';
+ break;
+ default:
+ break;
+ }
+
+ return PyString_FromString(cup);
+}