diff options
author | Toni Alatalo <antont@kyperjokki.fi> | 2005-10-03 18:28:08 +0400 |
---|---|---|
committer | Toni Alatalo <antont@kyperjokki.fi> | 2005-10-03 18:28:08 +0400 |
commit | 9459f7c1be6c75f5d46f6ede9cc55e82dfeba270 (patch) | |
tree | 636f38e3d9211423c6cf903b6f8c8656392b471e /source/blender/python/api2_2x/Key.c | |
parent | 12dc56578609e45b676490200fffabf8f464655b (diff) |
added getting names of shapes/KeyBlocks to bpy api so mikasaari can continue with his lipsync script (where names of phonemes are as names of shapes/keyblocks).
Diffstat (limited to 'source/blender/python/api2_2x/Key.c')
-rw-r--r-- | source/blender/python/api2_2x/Key.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/python/api2_2x/Key.c b/source/blender/python/api2_2x/Key.c index 543b8d80e33..01fdeb4530c 100644 --- a/source/blender/python/api2_2x/Key.c +++ b/source/blender/python/api2_2x/Key.c @@ -100,12 +100,15 @@ static struct PyMethodDef Key_methods[] = { static PyObject *KeyBlock_getData( PyObject * self ); static PyObject *KeyBlock_getPos( PyObject * self ); +static PyObject *KeyBlock_getName( PyObject * self ); static struct PyMethodDef KeyBlock_methods[] = { { "getPos", (PyCFunction) KeyBlock_getPos, METH_NOARGS, "Get keyblock position"}, { "getData", (PyCFunction) KeyBlock_getData, METH_NOARGS, "Get keyblock data" }, + { "getName", (PyCFunction) KeyBlock_getName, METH_NOARGS, + "Get keyblock name"}, { 0, 0, 0, 0 } }; @@ -249,12 +252,19 @@ static PyObject *KeyBlock_getattr( PyObject * self, char *name ) return KeyBlock_getPos(self); } else if ( strcmp( name, "data" ) == 0 ) { return KeyBlock_getData(self); - } else if ( strcmp( name, "pos" ) == 0 ) { - return KeyBlock_getPos(self); + } else if ( strcmp( name, "name" ) == 0 ) { + return KeyBlock_getName(self); } return Py_FindMethod( KeyBlock_methods, ( PyObject * ) self, name ); } +static PyObject *KeyBlock_getName( PyObject * self ) { + BPy_KeyBlock *kb = ( BPy_KeyBlock * ) self; + PyObject *name = Py_BuildValue( "s", kb->keyblock->name); + return name; +} + + static PyObject *KeyBlock_getPos( PyObject * self ) { BPy_KeyBlock *kb = ( BPy_KeyBlock * ) self; |