[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12702] trunk/blender/source/blender/ python/api2_2x:
Campbell Barton
ideasman42 at gmail.com
Wed Nov 28 00:15:51 CET 2007
Revision: 12702
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12702
Author: campbellbarton
Date: 2007-11-28 00:15:51 +0100 (Wed, 28 Nov 2007)
Log Message:
-----------
Patch [#7829] "compressfile" parameter for Blender.Set() from JMS
Modified Paths:
--------------
trunk/blender/source/blender/python/api2_2x/Blender.c
trunk/blender/source/blender/python/api2_2x/doc/Blender.py
Modified: trunk/blender/source/blender/python/api2_2x/Blender.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Blender.c 2007-11-27 22:09:42 UTC (rev 12701)
+++ trunk/blender/source/blender/python/api2_2x/Blender.c 2007-11-27 23:15:51 UTC (rev 12702)
@@ -278,7 +278,19 @@
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 @@
} /* 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 @@
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 );
Modified: trunk/blender/source/blender/python/api2_2x/doc/Blender.py
===================================================================
--- trunk/blender/source/blender/python/api2_2x/doc/Blender.py 2007-11-27 22:09:42 UTC (rev 12701)
+++ trunk/blender/source/blender/python/api2_2x/doc/Blender.py 2007-11-27 23:15:51 UTC (rev 12702)
@@ -60,6 +60,7 @@
@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 @@
@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
More information about the Bf-blender-cvs
mailing list