diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-12-27 16:35:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-12-27 16:35:14 +0300 |
commit | 28805c626fffdc70736e26dccb2ef37816c4bc76 (patch) | |
tree | 9d224332eebc9c5fc6256f8046b1382f8d30728a /source/blender/python/api2_2x/Blender.c | |
parent | c020b9b14666d1648a0bf79276ae8420c532ac14 (diff) |
==Python API==
added mipmap as an option for Blender.Get/Set
Diffstat (limited to 'source/blender/python/api2_2x/Blender.c')
-rw-r--r-- | source/blender/python/api2_2x/Blender.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/source/blender/python/api2_2x/Blender.c b/source/blender/python/api2_2x/Blender.c index 05eb82802b8..2bcc9d21da4 100644 --- a/source/blender/python/api2_2x/Blender.c +++ b/source/blender/python/api2_2x/Blender.c @@ -1,5 +1,5 @@ /* - * $Id: Blender.c 12702 2007-11-27 23:15:51Z campbellbarton $ + * $Id$ * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -285,11 +285,23 @@ static PyObject *Blender_Set( PyObject * self, PyObject * args ) return EXPP_ReturnPyObjError( PyExc_ValueError, "expected an integer" ); - if (value) - U.flag |= USER_FILECOMPRESS; + if (value) + U.flag |= USER_FILECOMPRESS; else - U.flag &= ~USER_FILECOMPRESS; + U.flag &= ~USER_FILECOMPRESS; + } else if (StringEqual( name , "mipmap" ) ) { + int value = PyObject_IsTrue( arg ); + + if (value==-1) + return EXPP_ReturnPyObjError( PyExc_ValueError, + "expected an integer" ); + + if (value) + U.gameflags &= ~USER_DISABLE_MIPMAP; + else + U.gameflags |= USER_DISABLE_MIPMAP; + set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP)); }else return ( EXPP_ReturnPyObjError( PyExc_AttributeError, "value given is not a blender setting" ) ); @@ -521,14 +533,15 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value ) else if(StringEqual( str, "compressfile" )) ret = PyInt_FromLong( (U.flag & USER_FILECOMPRESS) >> 15 ); - + else if(StringEqual( str, "mipmap" )) + ret = PyInt_FromLong( (U.gameflags & USER_DISABLE_MIPMAP) == 0 ); else return EXPP_ReturnPyObjError( PyExc_AttributeError, "unknown attribute" ); if (ret) return ret; else return EXPP_ReturnPyObjError (PyExc_MemoryError, - "could not create pystring!"); + "could not create the PyObject!"); } /*****************************************************************************/ |