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>2006-12-17 05:16:29 +0300
committerCampbell Barton <ideasman42@gmail.com>2006-12-17 05:16:29 +0300
commit1041ad47195b78ed3c2005355143056579b9b69c (patch)
treec2d1986ecec571da564b660714cfba9b8aab0c57 /source/blender/python/api2_2x/gen_utils.c
parent6acadfe9829fa5262c374e7183ac346255257545 (diff)
added fakeUser and users to more pytypes
Diffstat (limited to 'source/blender/python/api2_2x/gen_utils.c')
-rw-r--r--source/blender/python/api2_2x/gen_utils.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/gen_utils.c b/source/blender/python/api2_2x/gen_utils.c
index 23128f94805..4bd079f2b82 100644
--- a/source/blender/python/api2_2x/gen_utils.c
+++ b/source/blender/python/api2_2x/gen_utils.c
@@ -159,6 +159,34 @@ ID *GetIdFromList( ListBase * list, char *name )
}
/*****************************************************************************/
+/* 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. */
/*****************************************************************************/