diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-02-20 21:56:07 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-02-20 21:56:07 +0300 |
commit | 4c0b33ef80efda5628883d6ca12e855dfe95d9e9 (patch) | |
tree | 345f101ff08225021602e986fd866ec1fb069c1b /source/blender/python | |
parent | 1892df0e68e603ce7e026d5f49948fb795dc58cf (diff) |
Python Bugfix
A new file could have its Blender.Get("filename") return "<memory>" after undo'ing on an open file.
Fix for own error with python sys.path, messed up game engine.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/BPY_interface.c | 6 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Blender.c | 4 | ||||
-rw-r--r-- | source/blender/python/api2_2x/sceneRender.c | 11 |
3 files changed, 12 insertions, 9 deletions
diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c index 02b65c3077d..9d28e8f9e38 100644 --- a/source/blender/python/BPY_interface.c +++ b/source/blender/python/BPY_interface.c @@ -377,7 +377,7 @@ void init_syspath( int first_time ) d = PyModule_GetDict( mod ); /* borrowed ref */ EXPP_dict_set_item_str( d, "executable", Py_BuildValue( "s", bprogname ) ); - if (first_time) { + if (bpy_orig_syspath_List == NULL) { /* backup the original sys.path to rebuild later */ PyObject *syspath = PyDict_GetItemString( d, "path" ); /* borrowed ref */ if (bpy_orig_syspath_List) { /* This should never happen but just incase, be nice */ @@ -401,12 +401,12 @@ void BPY_rebuild_syspath( void ) mod = PyImport_ImportModule( "sys" ); if (!mod) { - printf("error: could not import python sys module. some modules may not import."); + printf("error: could not import python sys module. some modules may not import.\n"); return; } if (!bpy_orig_syspath_List) { /* should never happen */ - printf("error refershing python path"); + printf("error refershing python path\n"); Py_DECREF(mod); return; } diff --git a/source/blender/python/api2_2x/Blender.c b/source/blender/python/api2_2x/Blender.c index b6ec761f219..b0f396943d9 100644 --- a/source/blender/python/api2_2x/Blender.c +++ b/source/blender/python/api2_2x/Blender.c @@ -341,10 +341,10 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value ) else if( StringEqual( str, "endframe" ) ) ret = PyInt_FromLong( G.scene->r.efra ); else if( StringEqual( str, "filename" ) ) { - if ( strstr(G.main->name, ".B.blend") != 0) + if (!G.relbase_valid) ret = PyString_FromString(""); else - ret = PyString_FromString(G.main->name); + ret = PyString_FromString(G.sce); } else if( StringEqual( str, "homedir" ) ) { char *hdir = bpy_gethome(0); diff --git a/source/blender/python/api2_2x/sceneRender.c b/source/blender/python/api2_2x/sceneRender.c index 2d73d4fc8b7..29fc018e16d 100644 --- a/source/blender/python/api2_2x/sceneRender.c +++ b/source/blender/python/api2_2x/sceneRender.c @@ -2089,7 +2089,7 @@ static int RenderData_setModeBit( BPy_RenderData* self, PyObject *value, #define MODE_MASK ( R_OSA | R_SHADOW | R_GAMMA | R_ENVMAP | R_EDGE | \ R_FIELDS | R_FIELDSTILL | R_RADIO | R_BORDER | R_PANORAMA | R_CROP | \ - R_ODDFIELD | R_MBLUR | R_RAYTRACE | R_THREADS ) + R_ODDFIELD | R_MBLUR | R_RAYTRACE | R_AUTO_THREADS ) static PyObject *RenderData_getMode( BPy_RenderData *self ) { @@ -2593,10 +2593,13 @@ static PyGetSetDef BPy_RenderData_getseters[] = { (getter)RenderData_getModeBit, (setter)RenderData_setModeBit, "Skip rendering existing image files", (void *)R_NO_OVERWRITE}, - + {"autoThreads", + (getter)RenderData_getModeBit, (setter)RenderData_setModeBit, + "Use system number of processors", + (void *)R_AUTO_THREADS}, /* R_GAUSS unused */ /* R_FBUF unused */ -/* R_THREADS unused */ +/* R_AUTO_THREADS unused */ {"threads", (getter)RenderData_getThreads, (setter)RenderData_setThreads, "Number of threads used to render", @@ -3718,7 +3721,7 @@ static PyObject *M_Render_ModesDict( void ) PyConstant_Insert( d, "ODDFIELD", PyInt_FromLong( R_ODDFIELD ) ); PyConstant_Insert( d, "MBLUR", PyInt_FromLong( R_MBLUR ) ); PyConstant_Insert( d, "RAYTRACING", PyInt_FromLong( R_RAYTRACE ) ); - PyConstant_Insert( d, "THREADS", PyInt_FromLong( R_THREADS ) ); + PyConstant_Insert( d, "AUTOTHREADS", PyInt_FromLong( R_AUTO_THREADS ) ); } return M; } |