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>2007-11-28 02:15:51 +0300
committerCampbell Barton <ideasman42@gmail.com>2007-11-28 02:15:51 +0300
commitbb77ea8df5f016399e50bce5ef8b67d2cac89a28 (patch)
tree5fa15827175531dbe6c989b6a84ef61f251749c0 /source/blender/python/api2_2x/Blender.c
parent07a2f7013aaaa64fc2aad3f629d5a08e4962a73e (diff)
Patch [#7829] "compressfile" parameter for Blender.Set() from JMS
Diffstat (limited to 'source/blender/python/api2_2x/Blender.c')
-rw-r--r--source/blender/python/api2_2x/Blender.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/source/blender/python/api2_2x/Blender.c b/source/blender/python/api2_2x/Blender.c
index 07384391d27..6246baa02e8 100644
--- a/source/blender/python/api2_2x/Blender.c
+++ b/source/blender/python/api2_2x/Blender.c
@@ -278,7 +278,19 @@ static PyObject *Blender_Set( PyObject * self, PyObject * args )
if ( !PyArg_Parse( arg , "s" , &dir ))
return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string" );
BLI_strncpy(U.tempdir, dir, FILE_MAXDIR);
- } else
+ } else if (StringEqual( name , "compressfile" ) ) {
+ int value = PyObject_IsTrue( arg );
+
+ if (value==-1)
+ return EXPP_ReturnPyObjError( PyExc_ValueError,
+ "expected an integer" );
+
+ if (value)
+ U.flag |= USER_FILECOMPRESS;
+ else
+ U.flag &= ~USER_FILECOMPRESS;
+
+ }else
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
"value given is not a blender setting" ) );
Py_RETURN_NONE;
@@ -506,6 +518,10 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
} /* End 'quick hack' part. */
else if(StringEqual( str, "version" ))
ret = PyInt_FromLong( G.version );
+
+ else if(StringEqual( str, "compressfile" ))
+ ret = PyInt_FromLong( (U.flag & USER_FILECOMPRESS) >> 15 );
+
else
return EXPP_ReturnPyObjError( PyExc_AttributeError, "unknown attribute" );
@@ -685,10 +701,16 @@ static PyObject *Blender_Save( PyObject * self, PyObject * args )
disable_where_script( 1 ); /* to avoid error popups in the write_* functions */
- if( BLI_testextensie( fname, ".blend" ) ) {
+ if( BLI_testextensie( fname, ".blend" ) ) {
+ int writeflags;
if( G.fileflags & G_AUTOPACK )
packAll( );
- if( !BLO_write_file( fname, G.fileflags, &error ) ) {
+
+ writeflags= G.fileflags & ~G_FILE_COMPRESS;
+ if(U.flag & USER_FILECOMPRESS)
+ writeflags |= G_FILE_COMPRESS;
+
+ if( !BLO_write_file( fname, writeflags, &error ) ) {
disable_where_script( 0 );
return EXPP_ReturnPyObjError( PyExc_SystemError,
error );