Python API

made all libdata hashable - use the object type,name and lib for the hash.
added .tag to libdata so we can test if data's been processed without using dictionaries
added libdataseq.tag (write only) setting the tag flag (which can always be dirty)
This commit is contained in:
2007-03-26 02:10:24 +00:00
parent aba5557028
commit c97be098f7
26 changed files with 113 additions and 25 deletions

View File

@@ -350,6 +350,31 @@ static int MainSeq_setActive(BPy_MainSeq *self, PyObject *value)
"Only Scene and Image types have the active attribute" );
}
static int MainSeq_setTag(BPy_MainSeq *self, PyObject *value)
{
int param = PyObject_IsTrue( value );
ID *id;
if( param == -1 )
return EXPP_ReturnIntError( PyExc_TypeError,
"expected int argument in range [0,1]" );
id = (ID *)wich_libbase(G.main, self->type)->first;
if (param) {
for (; id; id = id->next) {
id->flag |= LIB_DOIT;
}
} else {
for (; id; id = id->next) {
id->flag &= ~LIB_DOIT;
}
}
return 0;
}
/* New Data, internal functions */
Mesh *add_mesh__internal(char *name)
{
@@ -640,6 +665,10 @@ static PyGetSetDef MainSeq_getseters[] = {
(getter)MainSeq_getActive, (setter)MainSeq_setActive,
"active object",
NULL},
{"tag",
(getter)NULL, (setter)MainSeq_setTag,
"tag all data in True or False (write only)",
NULL},
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
};