-- applied patch by Michael Reimpell that lets scripts registration info be either commented out or not (commented, it doesn't interfere with Python documentation tools.  The patch also fixes potential overflows, thanks (and sorry for the confusion) again, Michael.
-- fixed NMesh_hasFaceUV, it was returning true for false and vice-versa.  Reported by Jonas Petersen with patch, thanks.
-- added 'homedir' and 'uscriptsdir' to Blender.Get() to get Blender's home dir and the user defined scripts dir.
-- related to the above doc updates.
This commit is contained in:
2004-11-02 05:13:52 +00:00
parent bad7e33eac
commit 0737153338
5 changed files with 224 additions and 166 deletions

View File

@@ -97,8 +97,10 @@ static char Blender_Get_doc[] = "(request) - Retrieve settings from Blender\n\
'staframe' - Returns the start frame of the animation\n\
'endframe' - Returns the end frame of the animation\n\
'filename' - Returns the name of the last file read or written\n\
'homedir' - Returns Blender's home dir\n\
'datadir' - Returns the dir where scripts can save their data, if available\n\
'scriptsdir' - Returns the main dir where scripts are kept, if available\n\
'uscriptsdir' - Returns the user defined dir for scripts, if available\n\
'version' - Returns the Blender version number";
static char Blender_Redraw_doc[] = "() - Redraw all 3D windows";
@@ -217,6 +219,13 @@ static PyObject *Blender_Get( PyObject * self, PyObject * args )
if( StringEqual( str, "filename" ) ) {
return ( PyString_FromString( G.sce ) );
}
if( StringEqual( str, "homedir" ) ) {
if( BLI_exists( bpy_gethome() ))
return PyString_FromString( bpy_gethome() );
else
return EXPP_incr_ret( Py_None );
}
if( StringEqual( str, "datadir" ) ) {
char datadir[FILE_MAXDIR];
BLI_make_file_string( "/", datadir, bpy_gethome( ),
@@ -235,6 +244,12 @@ static PyObject *Blender_Get( PyObject * self, PyObject * args )
else
return EXPP_incr_ret( Py_None );
}
if( StringEqual( str, "uscriptsdir" ) ) {
if( BLI_exists( U.pythondir ) )
return PyString_FromString( U.pythondir );
else
return EXPP_incr_ret( Py_None );
}
/* According to the old file (opy_blender.c), the following if
statement is a quick hack and needs some clean up. */
if( StringEqual( str, "vrmloptions" ) ) {