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:
authorCampbell Barton <ideasman42@gmail.com>2007-02-23 17:51:20 +0300
committerCampbell Barton <ideasman42@gmail.com>2007-02-23 17:51:20 +0300
commit086d51c822774ec68e95d9ab68679fb219ad8a12 (patch)
tree49591a038e005b8aaa7263668929d645dbfc8ca1 /source/blender/python/api2_2x/Library.c
parent260af5f3c1590900353cce62657536bc96d3f53b (diff)
BPython API
* Added data.lib attributes to almost all data types, (except for Text3d and NLA) This is None or the path of the library as a string. * Main was giving a warning, Include Curve.h rather then CurNurb.h * Added Library.LinkedLibs(), returns a list of externaly linked libs.
Diffstat (limited to 'source/blender/python/api2_2x/Library.c')
-rw-r--r--source/blender/python/api2_2x/Library.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/source/blender/python/api2_2x/Library.c b/source/blender/python/api2_2x/Library.c
index 5d5075891ee..4a22540a0ae 100644
--- a/source/blender/python/api2_2x/Library.c
+++ b/source/blender/python/api2_2x/Library.c
@@ -66,6 +66,7 @@ static PyObject *M_Library_Update( PyObject * self );
static PyObject *M_Library_Datablocks( PyObject * self, PyObject * args );
static PyObject *M_Library_Load( PyObject * self, PyObject * args );
static PyObject *M_Library_LinkableGroups( PyObject * self );
+static PyObject *M_Library_LinkedLibs( PyObject * self );
PyObject *Library_Init( void );
void EXPP_Library_Close( void );
@@ -112,6 +113,9 @@ for each loaded object.";
static char Library_LinkableGroups_doc[] =
"() - Get all linkable groups from the open .blend library file.";
+static char Library_LinkedLibs_doc[] =
+ "() - Get all libs used in the the open .blend file.";
+
/**
* Python method structure definition for Blender.Library submodule.
*/
@@ -128,6 +132,8 @@ struct PyMethodDef M_Library_methods[] = {
{"Load", M_Library_Load, METH_VARARGS, Library_Load_doc},
{"LinkableGroups", ( PyCFunction ) M_Library_LinkableGroups,
METH_NOARGS, Library_LinkableGroups_doc},
+ {"LinkedLibs", ( PyCFunction ) M_Library_LinkedLibs,
+ METH_NOARGS, Library_LinkedLibs_doc},
{NULL, NULL, 0, NULL}
};
@@ -293,22 +299,36 @@ PyObject *M_Library_LinkableGroups( PyObject * self )
}
names = BLO_blendhandle_get_linkable_groups( bpy_openlib );
-
+ list = PyList_New( BLI_linklist_length( names ) );
+
if( names ) {
int counter = 0;
- list = PyList_New( BLI_linklist_length( names ) );
+
for( l = names; l; l = l->next ) {
- PyList_SET_ITEM( list, counter,
- Py_BuildValue( "s",
- ( char * ) l->link ) );
+ PyList_SET_ITEM( list, counter, PyString_FromString( ( char * ) l->link ) );
counter++;
}
BLI_linklist_free( names, free ); /* free linklist *and* each node's data */
return list;
}
+ return list;
+}
- Py_INCREF( Py_None );
- return Py_None;
+/**
+ * Return a list with the names of all externally linked libs used in the current Blend file
+ */
+PyObject *M_Library_LinkedLibs( PyObject * self )
+{
+ int counter = 0;
+ Library *li;
+ PyObject *list;
+
+ list = PyList_New( BLI_countlist( &( G.main->library ) ) );
+ for (li= G.main->library.first; li; li= li->id.next) {
+ PyList_SET_ITEM( list, counter, PyString_FromString( li->name ));
+ counter++;
+ }
+ return list;
}
/**