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 | |
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')
-rw-r--r-- | source/blender/python/api2_2x/Key.c | 14 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Key.py | 4 |
2 files changed, 16 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; diff --git a/source/blender/python/api2_2x/doc/Key.py b/source/blender/python/api2_2x/doc/Key.py index f091b32c29e..b2c23856dbb 100644 --- a/source/blender/python/api2_2x/doc/Key.py +++ b/source/blender/python/api2_2x/doc/Key.py @@ -67,6 +67,7 @@ class KeyBlock: attribute is read-only. @cvar pos: The position of the keyframe (see L{getPos}). This attribute is read-only. + @cvar name: The name of the KeyBlock. This attribute is read-only. """ def getData(): """ @@ -92,3 +93,6 @@ class KeyBlock: Ipo intersects the KeyBlock position is the actual time of the keyframe. """ + + def getName(): + """Get the name of the keyframe represented by this KeyBlock.""" |