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.
This commit is contained in:
@@ -960,6 +960,14 @@ AttributeError:
|
|||||||
return EXPP_intError(PyExc_AttributeError, "%s%s",
|
return EXPP_intError(PyExc_AttributeError, "%s%s",
|
||||||
sArmatureBadArgs, "Expects string");
|
sArmatureBadArgs, "Expects string");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------Armature.name (getter)
|
||||||
|
//Gets the name of the armature
|
||||||
|
static PyObject *Armature_getLib(BPy_Armature *self, void *closure)
|
||||||
|
{
|
||||||
|
return EXPP_GetIdLib((ID *)self->armature);
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------Armature.bones (getter)
|
//------------------------Armature.bones (getter)
|
||||||
//Gets the name of the armature
|
//Gets the name of the armature
|
||||||
static PyObject *Armature_getBoneDict(BPy_Armature *self, void *closure)
|
static PyObject *Armature_getBoneDict(BPy_Armature *self, void *closure)
|
||||||
@@ -998,6 +1006,8 @@ static PyMethodDef BPy_Armature_methods[] = {
|
|||||||
static PyGetSetDef BPy_Armature_getset[] = {
|
static PyGetSetDef BPy_Armature_getset[] = {
|
||||||
{"name", (getter)Armature_getName, (setter)Armature_setName,
|
{"name", (getter)Armature_getName, (setter)Armature_setName,
|
||||||
"The armature's name", NULL},
|
"The armature's name", NULL},
|
||||||
|
{"lib", (getter)Armature_getLib, (setter)NULL,
|
||||||
|
"The armature's library or None", NULL},
|
||||||
{"bones", (getter)Armature_getBoneDict, (setter)Armature_setBoneDict,
|
{"bones", (getter)Armature_getBoneDict, (setter)Armature_setBoneDict,
|
||||||
"The armature's Bone dictionary", NULL},
|
"The armature's Bone dictionary", NULL},
|
||||||
{"vertexGroups", (getter)Armature_getVertexGroups, (setter)Armature_setVertexGroups,
|
{"vertexGroups", (getter)Armature_getVertexGroups, (setter)Armature_setVertexGroups,
|
||||||
|
|||||||
@@ -848,6 +848,10 @@ static int Camera_setName( BPy_Camera * self, PyObject * value )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *Camera_getLib( BPy_Camera * self )
|
||||||
|
{
|
||||||
|
return EXPP_GetIdLib((ID *)self->camera);
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject *Camera_getUsers( BPy_Camera * self )
|
static PyObject *Camera_getUsers( BPy_Camera * self )
|
||||||
{
|
{
|
||||||
@@ -1119,6 +1123,10 @@ static PyGetSetDef BPy_Camera_getseters[] = {
|
|||||||
(getter)Camera_getName, (setter)Camera_setName,
|
(getter)Camera_getName, (setter)Camera_setName,
|
||||||
"Camera name",
|
"Camera name",
|
||||||
NULL},
|
NULL},
|
||||||
|
{"lib",
|
||||||
|
(getter)Camera_getLib, (setter)NULL,
|
||||||
|
"Camera libname",
|
||||||
|
NULL},
|
||||||
{"users",
|
{"users",
|
||||||
(getter)Camera_getUsers, (setter)NULL,
|
(getter)Camera_getUsers, (setter)NULL,
|
||||||
"Number of camera users",
|
"Number of camera users",
|
||||||
|
|||||||
@@ -1550,6 +1550,11 @@ static PyObject *CurveGetAttr( BPy_Curve * self, char *name )
|
|||||||
|
|
||||||
if( strcmp( name, "name" ) == 0 )
|
if( strcmp( name, "name" ) == 0 )
|
||||||
attr = PyString_FromString( self->curve->id.name + 2 );
|
attr = PyString_FromString( self->curve->id.name + 2 );
|
||||||
|
else if( strcmp( name, "lib" ) == 0 )
|
||||||
|
/* WARNING - Not standard, until we move to get/setattrs
|
||||||
|
at the moment we cant return None at the end because it raises an error */
|
||||||
|
attr = EXPP_GetIdLib((ID *)self->curve);
|
||||||
|
if (attr) return attr;
|
||||||
else if( strcmp( name, "pathlen" ) == 0 )
|
else if( strcmp( name, "pathlen" ) == 0 )
|
||||||
attr = PyInt_FromLong( self->curve->pathlen );
|
attr = PyInt_FromLong( self->curve->pathlen );
|
||||||
else if( strcmp( name, "totcol" ) == 0 )
|
else if( strcmp( name, "totcol" ) == 0 )
|
||||||
|
|||||||
@@ -242,6 +242,11 @@ static int Font_setFilename( BPy_Font * self, PyObject * value )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static PyObject *Font_getLib( BPy_Font * self )
|
||||||
|
{
|
||||||
|
return EXPP_GetIdLib((ID *)self->font);
|
||||||
|
}
|
||||||
|
|
||||||
/*--------------- BPy_Font.pack()---------------------------------*/
|
/*--------------- BPy_Font.pack()---------------------------------*/
|
||||||
static PyObject *Font_pack( BPy_Font * self )
|
static PyObject *Font_pack( BPy_Font * self )
|
||||||
{
|
{
|
||||||
@@ -291,14 +296,18 @@ static PyGetSetDef BPy_Font_getseters[] = {
|
|||||||
(getter)Font_getName, (setter)Font_setName,
|
(getter)Font_getName, (setter)Font_setName,
|
||||||
"Font name",
|
"Font name",
|
||||||
NULL},
|
NULL},
|
||||||
{"filename",
|
{"lib",
|
||||||
(getter)Font_getFilename, (setter)Font_setFilename,
|
(getter)Font_getLib, (setter)NULL,
|
||||||
"Font filepath",
|
"Font linked library",
|
||||||
NULL},
|
NULL},
|
||||||
{"users",
|
{"users",
|
||||||
(getter)Font_getUsers, (setter)NULL,
|
(getter)Font_getUsers, (setter)NULL,
|
||||||
"Number of font users",
|
"Number of font users",
|
||||||
NULL},
|
NULL},
|
||||||
|
{"filename",
|
||||||
|
(getter)Font_getFilename, (setter)Font_setFilename,
|
||||||
|
"Font filepath",
|
||||||
|
NULL},
|
||||||
{"packed",
|
{"packed",
|
||||||
(getter)Font_getPacked, (setter)NULL,
|
(getter)Font_getPacked, (setter)NULL,
|
||||||
"Packed status",
|
"Packed status",
|
||||||
|
|||||||
@@ -245,6 +245,13 @@ static PyObject *Group_getName( BPy_Group * self )
|
|||||||
"couldn't get Group.name attribute" ) );
|
"couldn't get Group.name attribute" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *Group_getLib( BPy_Group * self )
|
||||||
|
{
|
||||||
|
GROUP_DEL_CHECK_PY(self);
|
||||||
|
return EXPP_GetIdLib((ID *)self->group);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject *Group_getUsers( BPy_Group * self )
|
static PyObject *Group_getUsers( BPy_Group * self )
|
||||||
{
|
{
|
||||||
GROUP_DEL_CHECK_PY(self);
|
GROUP_DEL_CHECK_PY(self);
|
||||||
@@ -306,6 +313,10 @@ static PyGetSetDef BPy_Group_getseters[] = {
|
|||||||
(getter)Group_getName, (setter)Group_setName,
|
(getter)Group_getName, (setter)Group_setName,
|
||||||
"Group name",
|
"Group name",
|
||||||
NULL},
|
NULL},
|
||||||
|
{"lib",
|
||||||
|
(getter)Group_getLib, (setter)NULL,
|
||||||
|
"Group linked library",
|
||||||
|
NULL},
|
||||||
{"users",
|
{"users",
|
||||||
(getter)Group_getUsers, (setter)NULL,
|
(getter)Group_getUsers, (setter)NULL,
|
||||||
"Number of group users",
|
"Number of group users",
|
||||||
|
|||||||
@@ -1140,35 +1140,39 @@ static PyObject *Image_getAttr( BPy_Image * self, char *name )
|
|||||||
else if( strcmp( name, "packed" ) == 0 ) {
|
else if( strcmp( name, "packed" ) == 0 ) {
|
||||||
if (self->image->packedfile) attr = Py_True;
|
if (self->image->packedfile) attr = Py_True;
|
||||||
else attr = Py_False;
|
else attr = Py_False;
|
||||||
EXPP_incr_ret(attr);
|
Py_INCREF(attr);
|
||||||
} else if( strcmp( name, "has_data" ) == 0 ) {
|
} else if( strcmp( name, "has_data" ) == 0 ) {
|
||||||
if (self->image->ibufs.first) attr = Py_True;
|
if (self->image->ibufs.first) attr = Py_True;
|
||||||
else attr = Py_False;
|
else attr = Py_False;
|
||||||
EXPP_incr_ret(attr);
|
Py_INCREF(attr);
|
||||||
} else if( strcmp( name, "fields" ) == 0 ) {
|
} else if( strcmp( name, "fields" ) == 0 ) {
|
||||||
if (self->image->flag & IMA_FIELDS) attr = Py_True;
|
if (self->image->flag & IMA_FIELDS) attr = Py_True;
|
||||||
else attr = Py_False;
|
else attr = Py_False;
|
||||||
EXPP_incr_ret(attr);
|
Py_INCREF(attr);
|
||||||
} else if( strcmp( name, "fields_odd" ) == 0 ) {
|
} else if( strcmp( name, "fields_odd" ) == 0 ) {
|
||||||
if (self->image->flag & IMA_STD_FIELD) attr = Py_True;
|
if (self->image->flag & IMA_STD_FIELD) attr = Py_True;
|
||||||
else attr = Py_False;
|
else attr = Py_False;
|
||||||
EXPP_incr_ret(attr);
|
Py_INCREF(attr);
|
||||||
} else if( strcmp( name, "antialias" ) == 0 ) {
|
} else if( strcmp( name, "antialias" ) == 0 ) {
|
||||||
if (self->image->flag & IMA_ANTIALI) attr = Py_True;
|
if (self->image->flag & IMA_ANTIALI) attr = Py_True;
|
||||||
else attr = Py_False;
|
else attr = Py_False;
|
||||||
EXPP_incr_ret(attr);
|
Py_INCREF(attr);
|
||||||
|
} else if ( strcmp( name, "lib" ) == 0 ) {
|
||||||
|
/* WARNING - Not standard, until we move to get/setattrs
|
||||||
|
at the moment we cant return None at the end because it raises an error */
|
||||||
|
attr = EXPP_GetIdLib((ID *)self->image);
|
||||||
|
if (attr) return attr;
|
||||||
} else if( strcmp( name, "bindcode" ) == 0 )
|
} else if( strcmp( name, "bindcode" ) == 0 )
|
||||||
attr = PyInt_FromLong( self->image->bindcode );
|
attr = PyInt_FromLong( self->image->bindcode );
|
||||||
else if( strcmp( name, "users" ) == 0 )
|
else if( strcmp( name, "users" ) == 0 )
|
||||||
attr = PyInt_FromLong( self->image->id.us );
|
attr = PyInt_FromLong( self->image->id.us );
|
||||||
else if( strcmp( name, "__members__" ) == 0 )
|
else if( strcmp( name, "__members__" ) == 0 )
|
||||||
attr = Py_BuildValue( "[s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s]",
|
attr = Py_BuildValue( "[s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s]",
|
||||||
"name", "filename", "size", "depth",
|
"name", "filename", "size", "depth",
|
||||||
"xrep", "yrep", "start", "end",
|
"xrep", "yrep", "start", "end",
|
||||||
"speed", "packed", "has_data"
|
"speed", "packed", "has_data"
|
||||||
"fields", "odd", "antialias",
|
"fields", "odd", "antialias",
|
||||||
"bindcode", "users" );
|
"bindcode", "users", "lib" );
|
||||||
|
|
||||||
if( !attr )
|
if( !attr )
|
||||||
return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
|
return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
|
||||||
|
|||||||
@@ -101,6 +101,8 @@ static PyObject *Ipo_getRctf( BPy_Ipo * self );
|
|||||||
static PyObject *Ipo_oldsetRctf( BPy_Ipo * self, PyObject * args );
|
static PyObject *Ipo_oldsetRctf( BPy_Ipo * self, PyObject * args );
|
||||||
static int Ipo_setRctf( BPy_Ipo * self, PyObject * args );
|
static int Ipo_setRctf( BPy_Ipo * self, PyObject * args );
|
||||||
|
|
||||||
|
static PyObject *Ipo_getLib( BPy_Ipo * self );
|
||||||
|
static PyObject *Ipo_getUsers( BPy_Ipo * self );
|
||||||
static PyObject *Ipo_getCurve( BPy_Ipo * self, PyObject * args );
|
static PyObject *Ipo_getCurve( BPy_Ipo * self, PyObject * args );
|
||||||
static PyObject *Ipo_getCurves( BPy_Ipo * self );
|
static PyObject *Ipo_getCurves( BPy_Ipo * self );
|
||||||
static PyObject *Ipo_getCurveNames( BPy_Ipo * self );
|
static PyObject *Ipo_getCurveNames( BPy_Ipo * self );
|
||||||
@@ -119,6 +121,9 @@ static PyObject *Ipo_getCurveBeztriple( BPy_Ipo * self, PyObject * args );
|
|||||||
static PyObject *Ipo_getChannel( BPy_Ipo * self );
|
static PyObject *Ipo_getChannel( BPy_Ipo * self );
|
||||||
static int Ipo_setChannel( BPy_Ipo * self, PyObject * args );
|
static int Ipo_setChannel( BPy_Ipo * self, PyObject * args );
|
||||||
|
|
||||||
|
static PyObject *Ipo_getFakeUser( BPy_Ipo * self );
|
||||||
|
static int Ipo_setFakeUser( BPy_Ipo * self, PyObject * value );
|
||||||
|
|
||||||
static int Ipo_length( BPy_Ipo * inst );
|
static int Ipo_length( BPy_Ipo * inst );
|
||||||
static PyObject *Ipo_getIpoCurveByName( BPy_Ipo * self, PyObject * key );
|
static PyObject *Ipo_getIpoCurveByName( BPy_Ipo * self, PyObject * key );
|
||||||
static int Ipo_setIpoCurveByName( BPy_Ipo * self, PyObject * key,
|
static int Ipo_setIpoCurveByName( BPy_Ipo * self, PyObject * key,
|
||||||
@@ -177,6 +182,18 @@ static PyGetSetDef BPy_Ipo_getseters[] = {
|
|||||||
(getter)Ipo_getName, (setter)Ipo_setName,
|
(getter)Ipo_getName, (setter)Ipo_setName,
|
||||||
"Ipo data name",
|
"Ipo data name",
|
||||||
NULL},
|
NULL},
|
||||||
|
{"lib",
|
||||||
|
(getter)Ipo_getLib, (setter)NULL,
|
||||||
|
"Ipos linked library",
|
||||||
|
NULL},
|
||||||
|
{"users",
|
||||||
|
(getter)Ipo_getUsers, (setter)NULL,
|
||||||
|
"Number of Ipo users",
|
||||||
|
NULL},
|
||||||
|
{"fakeUser",
|
||||||
|
(getter)Ipo_getFakeUser, (setter)Ipo_setFakeUser,
|
||||||
|
"Ipos fake user state",
|
||||||
|
NULL},
|
||||||
{"curves",
|
{"curves",
|
||||||
(getter)Ipo_getCurves, (setter)NULL,
|
(getter)Ipo_getCurves, (setter)NULL,
|
||||||
"Ipo curves",
|
"Ipo curves",
|
||||||
@@ -227,7 +244,7 @@ static PySequenceMethods Ipo_as_sequence = {
|
|||||||
/* Python Ipo_Type callback function prototypes: */
|
/* Python Ipo_Type callback function prototypes: */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static void Ipo_dealloc( BPy_Ipo * self );
|
static void Ipo_dealloc( BPy_Ipo * self );
|
||||||
//static int IpoPrint (BPy_Ipo *self, FILE *fp, int flags);
|
/*static int IpoPrint (BPy_Ipo *self, FILE *fp, int flags);*/
|
||||||
static int Ipo_compare( BPy_Ipo * a, BPy_Ipo * b );
|
static int Ipo_compare( BPy_Ipo * a, BPy_Ipo * b );
|
||||||
static PyObject *Ipo_repr( BPy_Ipo * self );
|
static PyObject *Ipo_repr( BPy_Ipo * self );
|
||||||
static PyObject *Ipo_getIter( BPy_Ipo * self );
|
static PyObject *Ipo_getIter( BPy_Ipo * self );
|
||||||
@@ -830,6 +847,33 @@ static int Ipo_setName( BPy_Ipo * self, PyObject * args )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static PyObject *Ipo_getLib( BPy_Ipo * self )
|
||||||
|
{
|
||||||
|
return EXPP_GetIdLib((ID *)self->ipo);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject *Ipo_getUsers( BPy_Ipo * self )
|
||||||
|
{
|
||||||
|
return PyInt_FromLong( self->ipo->id.us );
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject *Ipo_getFakeUser( BPy_Ipo * self )
|
||||||
|
{
|
||||||
|
if (self->ipo->id.flag & LIB_FAKEUSER)
|
||||||
|
Py_RETURN_TRUE;
|
||||||
|
else
|
||||||
|
Py_RETURN_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int Ipo_setFakeUser( BPy_Ipo * self, PyObject * value )
|
||||||
|
{
|
||||||
|
return SetIdFakeUser(&self->ipo->id, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static PyObject *Ipo_getBlocktype( BPy_Ipo * self )
|
static PyObject *Ipo_getBlocktype( BPy_Ipo * self )
|
||||||
{
|
{
|
||||||
PyObject *attr = PyInt_FromLong( self->ipo->blocktype );
|
PyObject *attr = PyInt_FromLong( self->ipo->blocktype );
|
||||||
@@ -1631,7 +1675,7 @@ static PyObject *Ipo_nextIter( BPy_Ipo * self )
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
PyObject *Ipo_Init( void )
|
PyObject *Ipo_Init( void )
|
||||||
{
|
{
|
||||||
// PyObject *submodule;
|
/* PyObject *submodule; */
|
||||||
|
|
||||||
if( PyType_Ready( &Ipo_Type ) < 0 )
|
if( PyType_Ready( &Ipo_Type ) < 0 )
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1822,7 +1866,7 @@ static PyObject *Ipo_getCurvecurval( BPy_Ipo * self, PyObject * args )
|
|||||||
return ( EXPP_ReturnPyObjError
|
return ( EXPP_ReturnPyObjError
|
||||||
( PyExc_TypeError, "No IPO curve" ) );
|
( PyExc_TypeError, "No IPO curve" ) );
|
||||||
|
|
||||||
if( PyNumber_Check( PyTuple_GetItem( args, 0 ) ) ) // args is an integer
|
if( PyNumber_Check( PyTuple_GetItem( args, 0 ) ) ) /* args is an integer */
|
||||||
{
|
{
|
||||||
if( !PyArg_ParseTuple( args, "i", &numcurve ) )
|
if( !PyArg_ParseTuple( args, "i", &numcurve ) )
|
||||||
return ( EXPP_ReturnPyObjError
|
return ( EXPP_ReturnPyObjError
|
||||||
@@ -1837,7 +1881,7 @@ static PyObject *Ipo_getCurvecurval( BPy_Ipo * self, PyObject * args )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else // args is a string
|
else /* args is a string */
|
||||||
{
|
{
|
||||||
if( !PyArg_ParseTuple( args, "s", &stringname ) )
|
if( !PyArg_ParseTuple( args, "s", &stringname ) )
|
||||||
return ( EXPP_ReturnPyObjError
|
return ( EXPP_ReturnPyObjError
|
||||||
|
|||||||
@@ -179,6 +179,8 @@ struct PyMethodDef M_Lamp_methods[] = {
|
|||||||
/* Python BPy_Lamp methods declarations: */
|
/* Python BPy_Lamp methods declarations: */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static PyObject *Lamp_getName( BPy_Lamp * self );
|
static PyObject *Lamp_getName( BPy_Lamp * self );
|
||||||
|
static PyObject *Lamp_getLib( BPy_Lamp * self );
|
||||||
|
static PyObject *Lamp_getFakeUser( BPy_Lamp * self );
|
||||||
static PyObject *Lamp_getType( BPy_Lamp * self );
|
static PyObject *Lamp_getType( BPy_Lamp * self );
|
||||||
static PyObject *Lamp_getTypesConst( void );
|
static PyObject *Lamp_getTypesConst( void );
|
||||||
static PyObject *Lamp_getMode( BPy_Lamp * self );
|
static PyObject *Lamp_getMode( BPy_Lamp * self );
|
||||||
@@ -232,6 +234,7 @@ static PyObject *Lamp_oldsetQuad2( BPy_Lamp * self, PyObject * args );
|
|||||||
static PyObject *Lamp_oldsetCol( BPy_Lamp * self, PyObject * args );
|
static PyObject *Lamp_oldsetCol( BPy_Lamp * self, PyObject * args );
|
||||||
static int Lamp_setIpo( BPy_Lamp * self, PyObject * args );
|
static int Lamp_setIpo( BPy_Lamp * self, PyObject * args );
|
||||||
static int Lamp_setName( BPy_Lamp * self, PyObject * args );
|
static int Lamp_setName( BPy_Lamp * self, PyObject * args );
|
||||||
|
static int Lamp_setFakeUser( BPy_Lamp * self, PyObject * args );
|
||||||
static int Lamp_setType( BPy_Lamp * self, PyObject * args );
|
static int Lamp_setType( BPy_Lamp * self, PyObject * args );
|
||||||
static int Lamp_setMode( BPy_Lamp * self, PyObject * args );
|
static int Lamp_setMode( BPy_Lamp * self, PyObject * args );
|
||||||
static int Lamp_setSamples( BPy_Lamp * self, PyObject * args );
|
static int Lamp_setSamples( BPy_Lamp * self, PyObject * args );
|
||||||
@@ -379,6 +382,22 @@ static PyMethodDef BPy_Lamp_methods[] = {
|
|||||||
/* Python attributes get/set structure: */
|
/* Python attributes get/set structure: */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static PyGetSetDef BPy_Lamp_getseters[] = {
|
static PyGetSetDef BPy_Lamp_getseters[] = {
|
||||||
|
{"name",
|
||||||
|
(getter)Lamp_getName, (setter)Lamp_setName,
|
||||||
|
"Lamp data name",
|
||||||
|
NULL},
|
||||||
|
{"lib",
|
||||||
|
(getter)Lamp_getLib, (setter)NULL,
|
||||||
|
"Lamps linked library",
|
||||||
|
NULL},
|
||||||
|
{"users",
|
||||||
|
(getter)Lamp_getUsers, (setter)NULL,
|
||||||
|
"Number of lamp users",
|
||||||
|
NULL},
|
||||||
|
{"fakeUser",
|
||||||
|
(getter)Lamp_getFakeUser, (setter)Lamp_setFakeUser,
|
||||||
|
"Lamps fake user state",
|
||||||
|
NULL},
|
||||||
{"bias",
|
{"bias",
|
||||||
(getter)Lamp_getBias, (setter)Lamp_setBias,
|
(getter)Lamp_getBias, (setter)Lamp_setBias,
|
||||||
"Lamp shadow map sampling bias",
|
"Lamp shadow map sampling bias",
|
||||||
@@ -423,10 +442,6 @@ static PyGetSetDef BPy_Lamp_getseters[] = {
|
|||||||
(getter)Lamp_getMode, (setter)Lamp_setMode,
|
(getter)Lamp_getMode, (setter)Lamp_setMode,
|
||||||
"Lamp mode bitmask",
|
"Lamp mode bitmask",
|
||||||
NULL},
|
NULL},
|
||||||
{"name",
|
|
||||||
(getter)Lamp_getName, (setter)Lamp_setName,
|
|
||||||
"Lamp data name",
|
|
||||||
NULL},
|
|
||||||
{"quad1",
|
{"quad1",
|
||||||
(getter)Lamp_getQuad1, (setter)Lamp_setQuad1,
|
(getter)Lamp_getQuad1, (setter)Lamp_setQuad1,
|
||||||
"Quad lamp linear distance attenuation",
|
"Quad lamp linear distance attenuation",
|
||||||
@@ -495,10 +510,6 @@ static PyGetSetDef BPy_Lamp_getseters[] = {
|
|||||||
(getter)Lamp_getComponent, (setter)Lamp_setComponent,
|
(getter)Lamp_getComponent, (setter)Lamp_setComponent,
|
||||||
"Lamp color blue component",
|
"Lamp color blue component",
|
||||||
(void *)EXPP_LAMP_COMP_B},
|
(void *)EXPP_LAMP_COMP_B},
|
||||||
{"users",
|
|
||||||
(getter)Lamp_getUsers, (setter)NULL,
|
|
||||||
"Number of lamp users",
|
|
||||||
NULL},
|
|
||||||
{"Modes",
|
{"Modes",
|
||||||
(getter)Lamp_getModesConst, (setter)NULL,
|
(getter)Lamp_getModesConst, (setter)NULL,
|
||||||
"Dictionary of values for 'mode' attribute",
|
"Dictionary of values for 'mode' attribute",
|
||||||
@@ -614,7 +625,6 @@ static PyObject *M_Lamp_New( PyObject * self, PyObject * args,
|
|||||||
static char *kwlist[] = { "type_str", "name_str", NULL };
|
static char *kwlist[] = { "type_str", "name_str", NULL };
|
||||||
BPy_Lamp *py_lamp; /* for Lamp Data object wrapper in Python */
|
BPy_Lamp *py_lamp; /* for Lamp Data object wrapper in Python */
|
||||||
Lamp *bl_lamp; /* for actual Lamp Data we create in Blender */
|
Lamp *bl_lamp; /* for actual Lamp Data we create in Blender */
|
||||||
char buf[21];
|
|
||||||
|
|
||||||
if( !PyArg_ParseTupleAndKeywords( args, keywords, "|ss", kwlist,
|
if( !PyArg_ParseTupleAndKeywords( args, keywords, "|ss", kwlist,
|
||||||
&type_str, &name_str ) )
|
&type_str, &name_str ) )
|
||||||
@@ -907,6 +917,19 @@ static PyObject *Lamp_getName( BPy_Lamp * self )
|
|||||||
"couldn't get Lamp.name attribute" ) );
|
"couldn't get Lamp.name attribute" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *Lamp_getLib( BPy_Lamp * self )
|
||||||
|
{
|
||||||
|
return EXPP_GetIdLib((ID *)self->lamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject *Lamp_getFakeUser( BPy_Lamp * self )
|
||||||
|
{
|
||||||
|
if (self->lamp->id.flag & LIB_FAKEUSER)
|
||||||
|
Py_RETURN_TRUE;
|
||||||
|
else
|
||||||
|
Py_RETURN_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject *Lamp_getType( BPy_Lamp * self )
|
static PyObject *Lamp_getType( BPy_Lamp * self )
|
||||||
{
|
{
|
||||||
PyObject *attr = PyInt_FromLong( self->lamp->type );
|
PyObject *attr = PyInt_FromLong( self->lamp->type );
|
||||||
@@ -1148,6 +1171,11 @@ static int Lamp_setName( BPy_Lamp * self, PyObject * value )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int Lamp_setFakeUser( BPy_Lamp * self, PyObject * value )
|
||||||
|
{
|
||||||
|
return SetIdFakeUser(&self->lamp->id, value);
|
||||||
|
}
|
||||||
|
|
||||||
static int Lamp_setType( BPy_Lamp * self, PyObject * value )
|
static int Lamp_setType( BPy_Lamp * self, PyObject * value )
|
||||||
{
|
{
|
||||||
return EXPP_setIValueRange ( value, &self->lamp->type,
|
return EXPP_setIValueRange ( value, &self->lamp->type,
|
||||||
|
|||||||
@@ -747,7 +747,12 @@ static PyObject *Lattice_getAttr( BPy_Lattice * self, char *name )
|
|||||||
|
|
||||||
if( strcmp( name, "name" ) == 0 )
|
if( strcmp( name, "name" ) == 0 )
|
||||||
attr = PyString_FromString( self->Lattice->id.name + 2 );
|
attr = PyString_FromString( self->Lattice->id.name + 2 );
|
||||||
else if( strcmp( name, "width" ) == 0 )
|
else if ( strcmp( name, "lib" ) == 0 ) {
|
||||||
|
/* WARNING - Not standard, until we move to get/setattrs
|
||||||
|
at the moment we cant return None at the end because it raises an error */
|
||||||
|
attr = EXPP_GetIdLib((ID *)self->Lattice);
|
||||||
|
if (attr) return attr;
|
||||||
|
} else if( strcmp( name, "width" ) == 0 )
|
||||||
attr = PyInt_FromLong( self->Lattice->pntsu );
|
attr = PyInt_FromLong( self->Lattice->pntsu );
|
||||||
else if( strcmp( name, "height" ) == 0 )
|
else if( strcmp( name, "height" ) == 0 )
|
||||||
attr = PyInt_FromLong( self->Lattice->pntsv );
|
attr = PyInt_FromLong( self->Lattice->pntsv );
|
||||||
@@ -800,10 +805,10 @@ static PyObject *Lattice_getAttr( BPy_Lattice * self, char *name )
|
|||||||
} else if( strcmp( name, "key" ) == 0 ) {
|
} else if( strcmp( name, "key" ) == 0 ) {
|
||||||
return Lattice_getKey(self);
|
return Lattice_getKey(self);
|
||||||
} else if( strcmp( name, "__members__" ) == 0 )
|
} else if( strcmp( name, "__members__" ) == 0 )
|
||||||
attr = Py_BuildValue( "[s,s,s,s,s,s,s,s,s,s]", "name", "width",
|
attr = Py_BuildValue( "[s,s,s,s,s,s,s,s,s,s,s]", "name", "width",
|
||||||
"height", "depth", "widthType",
|
"height", "depth", "widthType",
|
||||||
"heightType", "depthType", "mode",
|
"heightType", "depthType", "mode",
|
||||||
"latSize", "users", "key" );
|
"latSize", "users", "key", "lib" );
|
||||||
|
|
||||||
if( !attr )
|
if( !attr )
|
||||||
return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
|
return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ static PyObject *M_Library_Update( PyObject * self );
|
|||||||
static PyObject *M_Library_Datablocks( PyObject * self, PyObject * args );
|
static PyObject *M_Library_Datablocks( PyObject * self, PyObject * args );
|
||||||
static PyObject *M_Library_Load( PyObject * self, PyObject * args );
|
static PyObject *M_Library_Load( PyObject * self, PyObject * args );
|
||||||
static PyObject *M_Library_LinkableGroups( PyObject * self );
|
static PyObject *M_Library_LinkableGroups( PyObject * self );
|
||||||
|
static PyObject *M_Library_LinkedLibs( PyObject * self );
|
||||||
|
|
||||||
PyObject *Library_Init( void );
|
PyObject *Library_Init( void );
|
||||||
void EXPP_Library_Close( void );
|
void EXPP_Library_Close( void );
|
||||||
@@ -112,6 +113,9 @@ for each loaded object.";
|
|||||||
static char Library_LinkableGroups_doc[] =
|
static char Library_LinkableGroups_doc[] =
|
||||||
"() - Get all linkable groups from the open .blend library file.";
|
"() - 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.
|
* 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},
|
{"Load", M_Library_Load, METH_VARARGS, Library_Load_doc},
|
||||||
{"LinkableGroups", ( PyCFunction ) M_Library_LinkableGroups,
|
{"LinkableGroups", ( PyCFunction ) M_Library_LinkableGroups,
|
||||||
METH_NOARGS, Library_LinkableGroups_doc},
|
METH_NOARGS, Library_LinkableGroups_doc},
|
||||||
|
{"LinkedLibs", ( PyCFunction ) M_Library_LinkedLibs,
|
||||||
|
METH_NOARGS, Library_LinkedLibs_doc},
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -293,22 +299,36 @@ PyObject *M_Library_LinkableGroups( PyObject * self )
|
|||||||
}
|
}
|
||||||
|
|
||||||
names = BLO_blendhandle_get_linkable_groups( bpy_openlib );
|
names = BLO_blendhandle_get_linkable_groups( bpy_openlib );
|
||||||
|
list = PyList_New( BLI_linklist_length( names ) );
|
||||||
|
|
||||||
if( names ) {
|
if( names ) {
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
list = PyList_New( BLI_linklist_length( names ) );
|
|
||||||
for( l = names; l; l = l->next ) {
|
for( l = names; l; l = l->next ) {
|
||||||
PyList_SET_ITEM( list, counter,
|
PyList_SET_ITEM( list, counter, PyString_FromString( ( char * ) l->link ) );
|
||||||
Py_BuildValue( "s",
|
|
||||||
( char * ) l->link ) );
|
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
BLI_linklist_free( names, free ); /* free linklist *and* each node's data */
|
BLI_linklist_free( names, free ); /* free linklist *and* each node's data */
|
||||||
return list;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include "DNA_scene_types.h"
|
#include "DNA_scene_types.h"
|
||||||
#include "DNA_object_types.h" /* MainSeq_new */
|
#include "DNA_object_types.h" /* MainSeq_new */
|
||||||
#include "DNA_texture_types.h"
|
#include "DNA_texture_types.h"
|
||||||
|
#include "DNA_curve_types.h"
|
||||||
#include "DNA_ipo_types.h"
|
#include "DNA_ipo_types.h"
|
||||||
#include "DNA_group_types.h"
|
#include "DNA_group_types.h"
|
||||||
#include "DNA_world_types.h"
|
#include "DNA_world_types.h"
|
||||||
@@ -74,7 +75,8 @@
|
|||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "Armature.h"
|
#include "Armature.h"
|
||||||
#include "Lamp.h"
|
#include "Lamp.h"
|
||||||
#include "CurNurb.h"
|
/*#include " CurNurb.h" do we need this ? */
|
||||||
|
#include "Curve.h"
|
||||||
#include "NMesh.h"
|
#include "NMesh.h"
|
||||||
#include "Mesh.h"
|
#include "Mesh.h"
|
||||||
#include "Lattice.h"
|
#include "Lattice.h"
|
||||||
|
|||||||
@@ -533,6 +533,7 @@ static PyObject *Material_getColorComponent( BPy_Material * self,
|
|||||||
void * closure );
|
void * closure );
|
||||||
static PyObject *Material_getOopsLoc( BPy_Material * self );
|
static PyObject *Material_getOopsLoc( BPy_Material * self );
|
||||||
static PyObject *Material_getOopsSel( BPy_Material * self );
|
static PyObject *Material_getOopsSel( BPy_Material * self );
|
||||||
|
static PyObject *Material_getLib( BPy_Material * self );
|
||||||
static PyObject *Material_getUsers( BPy_Material * self );
|
static PyObject *Material_getUsers( BPy_Material * self );
|
||||||
static PyObject *Material_getFakeUser( BPy_Material * self );
|
static PyObject *Material_getFakeUser( BPy_Material * self );
|
||||||
/*static int Material_setSeptex( BPy_Material * self, PyObject * value );
|
/*static int Material_setSeptex( BPy_Material * self, PyObject * value );
|
||||||
@@ -1092,6 +1093,10 @@ static PyGetSetDef BPy_Material_getseters[] = {
|
|||||||
(getter)Material_getFakeUser, (setter)Material_setFakeUser,
|
(getter)Material_getFakeUser, (setter)Material_setFakeUser,
|
||||||
"The fake user status of this material",
|
"The fake user status of this material",
|
||||||
NULL},
|
NULL},
|
||||||
|
{"lib",
|
||||||
|
(getter)Material_getLib, (setter)NULL,
|
||||||
|
"Materials external library",
|
||||||
|
NULL},
|
||||||
{"properties", (getter) Material_getProperties, (setter)NULL,
|
{"properties", (getter) Material_getProperties, (setter)NULL,
|
||||||
"Get material's ID properties"},
|
"Get material's ID properties"},
|
||||||
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
|
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
|
||||||
@@ -2845,6 +2850,11 @@ static int Material_setOopsSel ( BPy_Material * self, PyObject * value )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *Material_getLib(BPy_Material *self)
|
||||||
|
{
|
||||||
|
return EXPP_GetIdLib((ID *)self->material);
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject *Material_getUsers( BPy_Material * self )
|
static PyObject *Material_getUsers( BPy_Material * self )
|
||||||
{
|
{
|
||||||
return PyInt_FromLong( self->material->id.us );
|
return PyInt_FromLong( self->material->id.us );
|
||||||
|
|||||||
@@ -7195,6 +7195,11 @@ static PyObject *Mesh_getUsers( BPy_Mesh * self )
|
|||||||
"couldn't get Mesh.users attribute" );
|
"couldn't get Mesh.users attribute" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *Mesh_getLib(BPy_Mesh *self)
|
||||||
|
{
|
||||||
|
return EXPP_GetIdLib((ID *)self->mesh);
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject *Mesh_getFakeUser( BPy_Mesh * self )
|
static PyObject *Mesh_getFakeUser( BPy_Mesh * self )
|
||||||
{
|
{
|
||||||
if (self->mesh->id.flag & LIB_FAKEUSER)
|
if (self->mesh->id.flag & LIB_FAKEUSER)
|
||||||
@@ -7661,6 +7666,10 @@ static PyGetSetDef BPy_Mesh_getseters[] = {
|
|||||||
(getter)Mesh_getUsers, (setter)NULL,
|
(getter)Mesh_getUsers, (setter)NULL,
|
||||||
"Number of users of the mesh",
|
"Number of users of the mesh",
|
||||||
NULL},
|
NULL},
|
||||||
|
{"lib",
|
||||||
|
(getter)Mesh_getLib, (setter)NULL,
|
||||||
|
"Meshes external library",
|
||||||
|
NULL},
|
||||||
{"fakeUser",
|
{"fakeUser",
|
||||||
(getter)Mesh_getFakeUser, (setter)Mesh_setFakeUser,
|
(getter)Mesh_getFakeUser, (setter)Mesh_setFakeUser,
|
||||||
"The fake user status of this mesh",
|
"The fake user status of this mesh",
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ static PyObject *M_MetaElem_TypesDict( void )
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static PyObject *Metaball_getElements( BPy_Metaball * self );
|
static PyObject *Metaball_getElements( BPy_Metaball * self );
|
||||||
static PyObject *Metaball_getName( BPy_Metaball * self );
|
static PyObject *Metaball_getName( BPy_Metaball * self );
|
||||||
|
static PyObject *Metaball_getLib( BPy_Metaball * self );
|
||||||
static int Metaball_setName( BPy_Metaball * self, PyObject * value );
|
static int Metaball_setName( BPy_Metaball * self, PyObject * value );
|
||||||
static PyObject *Metaball_getMaterials( BPy_Metaball * self );
|
static PyObject *Metaball_getMaterials( BPy_Metaball * self );
|
||||||
static int Metaball_setMaterials( BPy_Metaball * self, PyObject * value );
|
static int Metaball_setMaterials( BPy_Metaball * self, PyObject * value );
|
||||||
@@ -176,6 +177,10 @@ static PyGetSetDef BPy_Metaball_getseters[] = {
|
|||||||
(getter)Metaball_getName, (setter)Metaball_setName,
|
(getter)Metaball_getName, (setter)Metaball_setName,
|
||||||
"Metaball name",
|
"Metaball name",
|
||||||
NULL},
|
NULL},
|
||||||
|
{"lib",
|
||||||
|
(getter)Metaball_getLib, (setter)NULL,
|
||||||
|
"Metaballs external library",
|
||||||
|
NULL},
|
||||||
{"users",
|
{"users",
|
||||||
(getter)Metaball_getUsers, (setter)NULL,
|
(getter)Metaball_getUsers, (setter)NULL,
|
||||||
"Number of metaball users",
|
"Number of metaball users",
|
||||||
@@ -557,8 +562,6 @@ static PyObject *Metaball_getName( BPy_Metaball * self )
|
|||||||
"couldn't get Metaball.name attribute" ) );
|
"couldn't get Metaball.name attribute" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int Metaball_setName( BPy_Metaball * self, PyObject * value )
|
static int Metaball_setName( BPy_Metaball * self, PyObject * value )
|
||||||
{
|
{
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
@@ -571,6 +574,11 @@ static int Metaball_setName( BPy_Metaball * self, PyObject * value )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *Metaball_getLib( BPy_Metaball * self )
|
||||||
|
{
|
||||||
|
return EXPP_GetIdLib((ID *)self->metaball);
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject *Metaball_getMaterials( BPy_Metaball *self )
|
static PyObject *Metaball_getMaterials( BPy_Metaball *self )
|
||||||
{
|
{
|
||||||
return EXPP_PyList_fromMaterialList( self->metaball->mat,
|
return EXPP_PyList_fromMaterialList( self->metaball->mat,
|
||||||
|
|||||||
@@ -347,6 +347,7 @@ static PyObject *Object_getLocation( BPy_Object * self, PyObject * args );
|
|||||||
static PyObject *Object_getMaterials( BPy_Object * self, PyObject * args );
|
static PyObject *Object_getMaterials( BPy_Object * self, PyObject * args );
|
||||||
static PyObject *Object_getMatrix( BPy_Object * self, PyObject * args );
|
static PyObject *Object_getMatrix( BPy_Object * self, PyObject * args );
|
||||||
static PyObject *Object_getName( BPy_Object * self );
|
static PyObject *Object_getName( BPy_Object * self );
|
||||||
|
static PyObject *Object_getLib( BPy_Object * self );
|
||||||
static PyObject *Object_getParent( BPy_Object * self );
|
static PyObject *Object_getParent( BPy_Object * self );
|
||||||
static PyObject *Object_getParentBoneName( BPy_Object * self );
|
static PyObject *Object_getParentBoneName( BPy_Object * self );
|
||||||
static int Object_setParentBoneName( BPy_Object * self, PyObject * value );
|
static int Object_setParentBoneName( BPy_Object * self, PyObject * value );
|
||||||
@@ -1323,6 +1324,11 @@ static PyObject *Object_getName( BPy_Object * self )
|
|||||||
return PyString_FromString( self->object->id.name + 2 );
|
return PyString_FromString( self->object->id.name + 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *Object_getLib( BPy_Object * self )
|
||||||
|
{
|
||||||
|
return EXPP_GetIdLib((ID *)self->object);
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject *Object_getParent( BPy_Object * self )
|
static PyObject *Object_getParent( BPy_Object * self )
|
||||||
{
|
{
|
||||||
if( self->object->parent )
|
if( self->object->parent )
|
||||||
@@ -4921,6 +4927,10 @@ static PyGetSetDef BPy_Object_getseters[] = {
|
|||||||
(getter)Object_getName, (setter)Object_setName,
|
(getter)Object_getName, (setter)Object_setName,
|
||||||
"Object data name",
|
"Object data name",
|
||||||
NULL},
|
NULL},
|
||||||
|
{"lib",
|
||||||
|
(getter)Object_getLib, (setter)NULL,
|
||||||
|
"Objects linked library",
|
||||||
|
NULL},
|
||||||
{"oopsLoc",
|
{"oopsLoc",
|
||||||
(getter)Object_getOopsLoc, (setter)Object_setOopsLoc,
|
(getter)Object_getOopsLoc, (setter)Object_setOopsLoc,
|
||||||
"Object OOPs location",
|
"Object OOPs location",
|
||||||
|
|||||||
@@ -294,7 +294,10 @@ static PyObject *Scene_getAttr( BPy_Scene * self, char *name )
|
|||||||
|
|
||||||
else if ( strcmp( name, "properties" ) == 0 )
|
else if ( strcmp( name, "properties" ) == 0 )
|
||||||
return BPy_Wrap_IDProperty( (ID*)self->scene, IDP_GetProperties((ID*)self->scene, 1), NULL );
|
return BPy_Wrap_IDProperty( (ID*)self->scene, IDP_GetProperties((ID*)self->scene, 1), NULL );
|
||||||
|
|
||||||
|
else if ( strcmp( name, "lib" ) == 0 )
|
||||||
|
return EXPP_GetIdLib((ID *)self->scene);
|
||||||
|
|
||||||
/* accept both Layer (for compatibility with ob.Layer) and Layers */
|
/* accept both Layer (for compatibility with ob.Layer) and Layers */
|
||||||
else if( strncmp( name, "Layer", 5 ) == 0 )
|
else if( strncmp( name, "Layer", 5 ) == 0 )
|
||||||
attr = PyInt_FromLong( self->scene->lay & ((1<<20)-1) );
|
attr = PyInt_FromLong( self->scene->lay & ((1<<20)-1) );
|
||||||
@@ -305,7 +308,7 @@ static PyObject *Scene_getAttr( BPy_Scene * self, char *name )
|
|||||||
return Scene_getObjects(self);
|
return Scene_getObjects(self);
|
||||||
|
|
||||||
else if( strcmp( name, "__members__" ) == 0 )
|
else if( strcmp( name, "__members__" ) == 0 )
|
||||||
attr = Py_BuildValue( "[sss]", "name", "Layers", "layers", "objects");
|
attr = Py_BuildValue( "[ssssss]", "name", "Layers", "layers", "objects", "properties", "lib");
|
||||||
|
|
||||||
if( !attr )
|
if( !attr )
|
||||||
return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
|
return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
|
||||||
|
|||||||
@@ -551,6 +551,8 @@ static PyObject *Sound_getAttr( BPy_Sound * self, char *name )
|
|||||||
attr = PyString_FromString( self->sound->id.name + 2 );
|
attr = PyString_FromString( self->sound->id.name + 2 );
|
||||||
else if( strcmp( name, "filename" ) == 0 )
|
else if( strcmp( name, "filename" ) == 0 )
|
||||||
attr = PyString_FromString( self->sound->name );
|
attr = PyString_FromString( self->sound->name );
|
||||||
|
else if( strcmp( name, "lib" ) == 0 )
|
||||||
|
return EXPP_GetIdLib((ID *)self->sound);
|
||||||
else if( strcmp( name, "packed" ) == 0 ) {
|
else if( strcmp( name, "packed" ) == 0 ) {
|
||||||
if (!sound_sample_is_null(self->sound))
|
if (!sound_sample_is_null(self->sound))
|
||||||
{
|
{
|
||||||
@@ -563,7 +565,7 @@ static PyObject *Sound_getAttr( BPy_Sound * self, char *name )
|
|||||||
else
|
else
|
||||||
attr = EXPP_incr_ret_False();
|
attr = EXPP_incr_ret_False();
|
||||||
} else if( strcmp( name, "__members__" ) == 0 )
|
} else if( strcmp( name, "__members__" ) == 0 )
|
||||||
attr = Py_BuildValue( "[s,s]", "name", "filename" );
|
attr = Py_BuildValue( "[s,s,s]", "name", "filename", "lib", "packed" );
|
||||||
|
|
||||||
if( !attr )
|
if( !attr )
|
||||||
return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
|
return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
|
||||||
|
|||||||
@@ -934,6 +934,8 @@ static PyObject *World_GetAttr( BPy_World * self, char *name )
|
|||||||
|
|
||||||
if( strcmp( name, "name" ) == 0 )
|
if( strcmp( name, "name" ) == 0 )
|
||||||
return World_getName( self );
|
return World_getName( self );
|
||||||
|
if( strcmp( name, "lib" ) == 0 )
|
||||||
|
return EXPP_GetIdLib((ID *)self->world);
|
||||||
if( strcmp( name, "skytype" ) == 0 )
|
if( strcmp( name, "skytype" ) == 0 )
|
||||||
return World_getSkytype( self );
|
return World_getSkytype( self );
|
||||||
if( strcmp( name, "mode" ) == 0 )
|
if( strcmp( name, "mode" ) == 0 )
|
||||||
|
|||||||
@@ -185,7 +185,17 @@ int SetIdFakeUser( ID * id, PyObject *value)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Description: This function sets the fake user status of the ID */
|
||||||
|
/* returns an int error, so from getsetattrs */
|
||||||
|
/*****************************************************************************/
|
||||||
|
PyObject *EXPP_GetIdLib( ID * id )
|
||||||
|
{
|
||||||
|
if (id->lib)
|
||||||
|
return PyString_FromString(id->lib->name);
|
||||||
|
else
|
||||||
|
return EXPP_incr_ret( Py_None );
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Description: These functions set an internal string with the given type */
|
/* Description: These functions set an internal string with the given type */
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ PyObject *EXPP_GetModuleConstant(char *module, char *constant);
|
|||||||
|
|
||||||
int StringEqual( const char *string1, const char *string2 );
|
int StringEqual( const char *string1, const char *string2 );
|
||||||
char *GetIdName( ID * id );
|
char *GetIdName( ID * id );
|
||||||
|
PyObject *EXPP_GetIdLib( ID * id );
|
||||||
int SetIdFakeUser( ID * id, PyObject *value);
|
int SetIdFakeUser( ID * id, PyObject *value);
|
||||||
|
|
||||||
ID *GetIdFromList( ListBase * list, char *name );
|
ID *GetIdFromList( ListBase * list, char *name );
|
||||||
|
|||||||
Reference in New Issue
Block a user