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
parent07a2f7013aaaa64fc2aad3f629d5a08e4962a73e (diff)
Patch [#7829] "compressfile" parameter for Blender.Set() from JMS
Diffstat (limited to 'source/blender/python/api2_2x')
-rw-r--r--source/blender/python/api2_2x/Blender.c28
-rw-r--r--source/blender/python/api2_2x/doc/Blender.py2
2 files changed, 27 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 );
diff --git a/source/blender/python/api2_2x/doc/Blender.py b/source/blender/python/api2_2x/doc/Blender.py
index 51666d0e211..088a02c547c 100644
--- a/source/blender/python/api2_2x/doc/Blender.py
+++ b/source/blender/python/api2_2x/doc/Blender.py
@@ -60,6 +60,7 @@ def Set (request, data):
@type request: string
@param request: The setting to change:
- 'curframe': the current animation frame
+ - 'compressfile' : compress file writing a blend file (Use a boolean value True/False).
- 'uscriptsdir': user scripts dir
- 'yfexportdir': yafray temp xml storage dir
- 'fontsdir': font dir
@@ -79,6 +80,7 @@ def Get (request):
@param request: The setting data to be returned:
- 'curframe': the current animation frame.
- 'curtime' : the current animation time.
+ - 'compressfile' : compress setting from the file menu, return 0 for false or 1 for true.
- 'staframe': the start frame of the animation.
- 'endframe': the end frame of the animation.
- 'rt': the value of the 'rt' button for general debugging