BPython:
- 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:
@@ -18,7 +18,7 @@ __version__ = "2.34 09/20/04"
|
|||||||
__bpydoc__ = """\
|
__bpydoc__ = """\
|
||||||
This script exports Blender meshes to AC3D's .ac file format.
|
This script exports Blender meshes to AC3D's .ac file format.
|
||||||
|
|
||||||
AC3D is a simple and affordable commercial 3d modeller also built with OpenGL.
|
AC3D is a simple commercial 3d modeller also built with OpenGL.
|
||||||
The .ac file format is an easy to parse text format well supported,
|
The .ac file format is an easy to parse text format well supported,
|
||||||
for example, by the PLib 3d gaming library (AC3D v3.x).
|
for example, by the PLib 3d gaming library (AC3D v3.x).
|
||||||
|
|
||||||
@@ -26,18 +26,19 @@ Supported:<br>
|
|||||||
UV-textured meshes with hierarchy (grouping) information.
|
UV-textured meshes with hierarchy (grouping) information.
|
||||||
|
|
||||||
Missing:<br>
|
Missing:<br>
|
||||||
Support for AC3D 4's crease tag (simple, will be added soon).
|
Support for AC3D 4's crease tag (simple, will be added as option for
|
||||||
|
the next version of this exporter).
|
||||||
|
|
||||||
Known issues:<br>
|
Known issues:<br>
|
||||||
Models textured with more than one image do not work -- for the
|
Models textured with more than one image do not work -- for the
|
||||||
moment you can separate them in Blender such that each mesh only has one
|
moment you can separate them in Blender such that each mesh only has one
|
||||||
image assigned (also see notes below);<br>
|
image assigned (also see notes below);<br>
|
||||||
The exporter is slow for large meshes -- faster code was written for the
|
The exporter is slow for large meshes -- faster code was written for the
|
||||||
TuxKart (http://tuxkart.sf.net) game exporter and will be integrated on a
|
TuxKart (http://tuxkart.sf.net, wiki at http://netpanzer.berlios.de/tuxkart)
|
||||||
future version of this exporter.
|
game exporter and will be integrated on a future version of this exporter.
|
||||||
|
|
||||||
Notes:<br>
|
Notes:<br>
|
||||||
There is a version of this script by <fix this> that accepts meshes with
|
There is a version of this script, by Ingo Ruhnke, that accepts meshes with
|
||||||
more than one texture image assigned, check TuxKart's wiki.
|
more than one texture image assigned, check TuxKart's wiki.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@@ -604,7 +604,8 @@ int BPY_menu_do_python( short menutype, int event )
|
|||||||
char *buffer, *s;
|
char *buffer, *s;
|
||||||
char filestr[FILE_MAXDIR + FILE_MAXFILE];
|
char filestr[FILE_MAXDIR + FILE_MAXFILE];
|
||||||
char dirname[FILE_MAXDIR];
|
char dirname[FILE_MAXDIR];
|
||||||
Script *script = G.main->script.first;
|
char scriptname[21];
|
||||||
|
Script *script = NULL;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
pym = BPyMenu_GetEntry( menutype, ( short ) event );
|
pym = BPyMenu_GetEntry( menutype, ( short ) event );
|
||||||
@@ -660,8 +661,17 @@ int BPY_menu_do_python( short menutype, int event )
|
|||||||
return 0;
|
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: */
|
/* 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 ) {
|
if( !script ) {
|
||||||
printf( "couldn't allocate memory for Script struct!" );
|
printf( "couldn't allocate memory for Script struct!" );
|
||||||
|
|||||||
@@ -602,30 +602,33 @@ static PyObject *Method_Register( PyObject * self, PyObject * args )
|
|||||||
|
|
||||||
sc = curarea->spacedata.first;
|
sc = curarea->spacedata.first;
|
||||||
|
|
||||||
/* this is a little confusing: we need to know which script is being executed
|
/* There are two kinds of scripts:
|
||||||
* now, so we can preserve its namespace from being deleted.
|
* a) those that simply run, finish and return control to Blender;
|
||||||
* There are two possibilities:
|
* b) those that do like 'a)' above but leave callbacks for drawing,
|
||||||
* a) One new script was created and the interpreter still hasn't returned
|
* events and button events, with this Method_Register (Draw.Register
|
||||||
* from executing it.
|
* in Python). These callbacks are called by scriptspaces (Scripts windows).
|
||||||
* b) Any number of scripts were executed but left registered callbacks and
|
*
|
||||||
* so were not deleted yet. */
|
* We need to flag scripts that leave callbacks so their namespaces are
|
||||||
|
* not deleted when they 'finish' execution, because the callbacks will
|
||||||
|
* still need the namespace.
|
||||||
|
*/
|
||||||
|
|
||||||
/* To find out if we're dealing with a) or b), we start with the last
|
/* Let's see if this is a new script */
|
||||||
* created one: */
|
script = G.main->script.first;
|
||||||
script = G.main->script.last;
|
while (script) {
|
||||||
|
if (script->flags & SCRIPT_RUNNING) break;
|
||||||
|
script = script->id.next;
|
||||||
|
}
|
||||||
|
|
||||||
if( !script ) {
|
if( !script ) {
|
||||||
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
/* not new, it's a left callback calling Register again */
|
||||||
"Draw.Register: couldn't get pointer to script struct" );
|
script = sc->script;
|
||||||
|
if( !script ) {
|
||||||
|
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
||||||
|
"Draw.Register: couldn't get pointer to script struct" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else sc->script = script;
|
||||||
/* if the flag SCRIPT_RUNNING is set, this script is case a): */
|
|
||||||
if( !( script->flags & SCRIPT_RUNNING ) ) {
|
|
||||||
script = sc->script;
|
|
||||||
}
|
|
||||||
/* otherwise it's case b) and the script we want is here: */
|
|
||||||
else
|
|
||||||
sc->script = script;
|
|
||||||
|
|
||||||
/* Now we have the right script and can set a lock so its namespace can't be
|
/* Now we have the right script and can set a lock so its namespace can't be
|
||||||
* deleted for as long as we need it */
|
* deleted for as long as we need it */
|
||||||
@@ -660,7 +663,6 @@ static PyObject *Method_Redraw( PyObject * self, PyObject * args )
|
|||||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||||
"expected int argument (or nothing)" );
|
"expected int argument (or nothing)" );
|
||||||
|
|
||||||
/* XXX shouldn't we redraw all spacescript wins with this script on ? */
|
|
||||||
if( after )
|
if( after )
|
||||||
addafterqueue( curarea->win, REDRAW, 1 );
|
addafterqueue( curarea->win, REDRAW, 1 );
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user