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
path: root/source
diff options
context:
space:
mode:
authorToni Alatalo <antont@kyperjokki.fi>2005-10-03 18:28:08 +0400
committerToni Alatalo <antont@kyperjokki.fi>2005-10-03 18:28:08 +0400
commit9459f7c1be6c75f5d46f6ede9cc55e82dfeba270 (patch)
tree636f38e3d9211423c6cf903b6f8c8656392b471e /source
parent12dc56578609e45b676490200fffabf8f464655b (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')
-rw-r--r--source/blender/python/api2_2x/Key.c14
-rw-r--r--source/blender/python/api2_2x/doc/Key.py4
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."""