- Small doc update in a script;
- Fixed bug #1742:
http://projects.blender.org/tracker/?func=detail&atid=125&aid=1742&group_id=9

It was an internal error in bpython.  I was using G.main->script.last to find the currently running (if any) script, but this isn't reliable, we must check each open script to find out if one of them has the SCRIPT_RUNNING bitflag set.

Thanks intrr for reporting and blendix for pointing how to reproduce the bug.  From my tests it should be working fine now.
This commit is contained in:
2004-11-09 14:07:25 +00:00
parent 1197c4842a
commit c16e5dad1c
3 changed files with 41 additions and 28 deletions

View File

@@ -604,7 +604,8 @@ int BPY_menu_do_python( short menutype, int event )
char *buffer, *s;
char filestr[FILE_MAXDIR + FILE_MAXFILE];
char dirname[FILE_MAXDIR];
Script *script = G.main->script.first;
char scriptname[21];
Script *script = NULL;
int len;
pym = BPyMenu_GetEntry( menutype, ( short ) event );
@@ -660,8 +661,17 @@ int BPY_menu_do_python( short menutype, int event )
return 0;
}
BLI_strncpy(scriptname, pym->name, 21);
len = strlen(scriptname) - 1;
/* by convention, scripts that open the file browser or have submenus
* display '...'. Here we remove them from the datablock name */
while ((len > 0) && scriptname[len] == '.') {
scriptname[len] = '\0';
len--;
}
/* Create a new script structure and initialize it: */
script = alloc_libblock( &G.main->script, ID_SCRIPT, pym->name );
script = alloc_libblock( &G.main->script, ID_SCRIPT, scriptname );
if( !script ) {
printf( "couldn't allocate memory for Script struct!" );