added fakeUser and users to more pytypes

This commit is contained in:
2006-12-17 02:16:29 +00:00
parent 6acadfe982
commit 1041ad4719
11 changed files with 113 additions and 64 deletions

View File

@@ -158,6 +158,34 @@ ID *GetIdFromList( ListBase * list, char *name )
return id;
}
/*****************************************************************************/
/* Description: This function sets the fake user status of the ID */
/* returns an int error, so from getsetattrs */
/*****************************************************************************/
int SetIdFakeUser( ID * id, PyObject *value)
{
int param;
param = PyObject_IsTrue( value );
if( param == -1 )
return EXPP_ReturnIntError( PyExc_TypeError,
"expected int argument in range [0,1]" );
if (param) {
if (!(id->flag & LIB_FAKEUSER)) {
id->flag |= LIB_FAKEUSER;
id_us_plus(id);
}
} else {
if (id->flag & LIB_FAKEUSER) {
id->flag &= ~LIB_FAKEUSER;
id->us--;
}
}
return 0;
}
/*****************************************************************************/
/* Description: These functions set an internal string with the given type */
/* and error_msg arguments. */