Bugfix for #5846 erratic error with in "ob.getData(mesh=1)"
It looks like the changes for bug #5000 Changin EditMode in Script wrecks memory break the python interpreter. Since this is critical, I have #ifdef'ed those out of BPY_interface.c and Window.c. Did not touch Armature.c. The ifdefs are tagged with /* bug 5000 */ This means bug #5000 is back in play. Interesting to note that according to #5846, only scripts run from the script menu and not via Alt-P were broken.
This commit is contained in:
@@ -525,11 +525,14 @@ int BPY_txt_do_python_Text( struct Text *text )
|
||||
|
||||
py_dict = CreateGlobalDictionary( );
|
||||
|
||||
#if 0
|
||||
/* bug 5000 */
|
||||
//setup a weakref dictionary on __main__
|
||||
maindict= PyModule_GetDict(PyImport_AddModule( "__main__"));
|
||||
if (PyDict_SetItemString(maindict, "armatures", PyList_New(0)) == -1){
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
script->py_globaldict = py_dict;
|
||||
|
||||
|
||||
@@ -890,9 +890,12 @@ static PyObject *M_Window_EditMode( PyObject * self, PyObject * args )
|
||||
char *undo_str = "From script";
|
||||
int undo_str_len = 11;
|
||||
int do_undo = 1;
|
||||
#if 0
|
||||
/* bug 5000 */
|
||||
PyObject *maindict = NULL, *armlist = NULL;
|
||||
PyObject *pyarmature = NULL;
|
||||
int x;
|
||||
#endif
|
||||
|
||||
if( !PyArg_ParseTuple( args,
|
||||
"|hs#i", &status, &undo_str, &undo_str_len, &do_undo ) )
|
||||
@@ -901,7 +904,9 @@ static PyObject *M_Window_EditMode( PyObject * self, PyObject * args )
|
||||
|
||||
if( status >= 0 ) {
|
||||
if( status ) {
|
||||
if( !G.obedit )
|
||||
if( !G.obedit ){
|
||||
#if 0
|
||||
/* bug 5000 */
|
||||
//update armatures
|
||||
maindict= PyModule_GetDict(PyImport_AddModule( "__main__"));
|
||||
armlist = PyDict_GetItemString(maindict, "armatures");
|
||||
@@ -910,14 +915,18 @@ static PyObject *M_Window_EditMode( PyObject * self, PyObject * args )
|
||||
if (pyarmature != Py_None)
|
||||
Armature_RebuildEditbones(pyarmature);
|
||||
}
|
||||
#endif
|
||||
//enter editmode
|
||||
enter_editmode(0);
|
||||
}
|
||||
} else if( G.obedit ) {
|
||||
if( undo_str_len > 63 )
|
||||
undo_str[63] = '\0'; /* 64 is max */
|
||||
BIF_undo_push( undo_str ); /* This checks user undo settings */
|
||||
exit_editmode( EM_FREEDATA );
|
||||
|
||||
#if 0
|
||||
/* bug 5000 */
|
||||
//update armatures
|
||||
maindict= PyModule_GetDict(PyImport_AddModule( "__main__"));
|
||||
armlist = PyDict_GetItemString(maindict, "armatures");
|
||||
@@ -926,7 +935,7 @@ static PyObject *M_Window_EditMode( PyObject * self, PyObject * args )
|
||||
if (pyarmature != Py_None)
|
||||
Armature_RebuildBones(pyarmature);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user