BPython:
- fixed bug #1882: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1882&group_id=9 Crash / hang when changing meshes that had edge data. The mesh->totedge value was not being set to 0. Reported by jms, thanks. - fixed bug #1780: https://projects.blender.org/tracker/index.php?func=detail&aid=1780&group_id=9&atid=125. Deleting a Text that was being used as script link crashed Blender. Added a check to unlink the Text from eventual script links when it gets removed. Reported by kaito, thanks. - doc updates (one related to bug #1807: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1807&group_id=9 , actually a little misleading word in the NMesh doc: you can get the subsurfed mesh with NMesh.GetRawFromObject, but it's the display subdivision level that counts).
This commit is contained in:
@@ -61,6 +61,7 @@ extern "C" {
|
||||
/*void BPY_clear_bad_scriptlist(struct ListBase *, struct Text *byebye); */
|
||||
int BPY_has_onload_script( void );
|
||||
void BPY_do_all_scripts( short event );
|
||||
int BPY_check_all_scriptlinks( struct Text *text );
|
||||
void BPY_do_pyscript( struct ID *id, short event );
|
||||
void BPY_free_scriptlink( struct ScriptLink *slink );
|
||||
void BPY_copy_scriptlink( struct ScriptLink *scriptlink );
|
||||
|
||||
@@ -1091,6 +1091,46 @@ void BPY_free_scriptlink( struct ScriptLink *slink )
|
||||
return;
|
||||
}
|
||||
|
||||
int CheckAllScriptsFromList( ListBase * list, Text * text )
|
||||
{
|
||||
ID *id;
|
||||
ScriptLink *scriptlink;
|
||||
int index;
|
||||
int fixed = 0;
|
||||
|
||||
id = list->first;
|
||||
|
||||
while( id != NULL ) {
|
||||
scriptlink = ID_getScriptlink( id );
|
||||
if( scriptlink && scriptlink->totscript ) {
|
||||
for( index = 0; index < scriptlink->totscript; index++) {
|
||||
if ((Text *)scriptlink->scripts[index] == text) {
|
||||
scriptlink->scripts[index] = NULL;
|
||||
fixed++;
|
||||
}
|
||||
}
|
||||
}
|
||||
id = id->next;
|
||||
}
|
||||
|
||||
return fixed;
|
||||
}
|
||||
|
||||
/* When a Text is deleted, we need to unlink it from eventual scriptlinks */
|
||||
int BPY_check_all_scriptlinks( Text * text )
|
||||
{
|
||||
int fixed = 0;
|
||||
fixed += CheckAllScriptsFromList( &( G.main->object ), text );
|
||||
fixed += CheckAllScriptsFromList( &( G.main->lamp ), text );
|
||||
fixed += CheckAllScriptsFromList( &( G.main->camera ), text );
|
||||
fixed += CheckAllScriptsFromList( &( G.main->mat ), text );
|
||||
fixed += CheckAllScriptsFromList( &( G.main->world ), text );
|
||||
fixed += CheckAllScriptsFromList( &( G.main->scene ), text );
|
||||
|
||||
return fixed;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Description:
|
||||
* Notes:
|
||||
|
||||
@@ -2064,8 +2064,10 @@ static int unlink_existingMeshData( Mesh * mesh )
|
||||
EXPP_unlink_mesh( mesh );
|
||||
if( mesh->mvert )
|
||||
MEM_freeN( mesh->mvert );
|
||||
if( mesh->medge )
|
||||
if( mesh->medge ) {
|
||||
MEM_freeN( mesh->medge );
|
||||
mesh->totedge = 0;
|
||||
}
|
||||
if( mesh->mface )
|
||||
MEM_freeN( mesh->mface );
|
||||
if( mesh->mcol )
|
||||
|
||||
@@ -214,6 +214,75 @@ Blender Data Structures:
|
||||
Blender works the way it does, see the U{Blender Architecture document
|
||||
<http://www.blender3d.org/cms/Blender_Architecture.336.0.html>}.
|
||||
|
||||
Documenting scripts:
|
||||
--------------------
|
||||
|
||||
The "Scripts Help Browser" script in the Help menu can parse special variables
|
||||
from registered scripts and display help information for users. For that,
|
||||
authors only need to add proper information to their scripts, after the
|
||||
registration header.
|
||||
|
||||
The expected variables:
|
||||
|
||||
- __bpydoc__ (or __doc__) (type: string):
|
||||
- The main help text. Write a first short paragraph explaining what the
|
||||
script does, then add the rest of the help text, leaving a blank line
|
||||
between each new paragraph. To force line breaks you can use <br> tags.
|
||||
|
||||
- __author__ (type: string or list of strings):
|
||||
- Author name(s).
|
||||
|
||||
- __version__ (type: string):
|
||||
- Script version.
|
||||
|
||||
- __url__ (type: string or list of strings):
|
||||
- Internet links that are shown as buttons in the help screen. Clicking
|
||||
them opens the user's default browser at the specified location. The
|
||||
expected format for each url entry is e.g.
|
||||
"Author's site, http://www.somewhere.com". The first part, before the
|
||||
comma (','), is used as the button's tooltip. There are two preset
|
||||
options: "blender" and "elysiun", which link to the Python forums at
|
||||
blender.org and elysiun.com, respectively.
|
||||
|
||||
- __email__ (optional, type: string or list of strings):
|
||||
- Equivalent to __url__, but opens the user's default email client. You
|
||||
can write the email as someone:somewhere*com and the help script will
|
||||
substitute accordingly: someone@somewhere.com. This is only a minor help
|
||||
to hide emails from spammers, since your script may be available at some
|
||||
site. "scripts" is the available preset, with the email address of the
|
||||
mailing list devoted to scripting in Blender, bf-scripts-dev@blender.org.
|
||||
You should only use this one if you are subscribed to the list:
|
||||
http://projects.blender.org/mailman/listinfo/bf-scripts-dev for more
|
||||
information.
|
||||
|
||||
Example::
|
||||
__author__ = 'Mr. Author'
|
||||
__version__ = '1.0 11/11/04'
|
||||
__url__ = ["Author's site, http://somewhere.com",
|
||||
"Support forum, http://somewhere.com/forum/", "blender", "elysiun"]
|
||||
__email__ = ["Mr. Author, mrauthor:somewhere*com", "scripts"]
|
||||
__bpydoc__ = \"\"\"\\
|
||||
This script does this and that.
|
||||
|
||||
Explaining better, this script helps you create ...
|
||||
|
||||
You can write as many paragraphs as needed.
|
||||
|
||||
Shortcuts:<br>
|
||||
Esc or Q: quit.<br>
|
||||
etc.
|
||||
|
||||
Supported:<br>
|
||||
Meshes, metaballs.
|
||||
|
||||
Known issues:<br>
|
||||
This is just an example, there's no actual script.
|
||||
|
||||
Notes:<br>
|
||||
You can check scripts bundled with Blender to see more examples of how to
|
||||
add documentation to your own works.
|
||||
\"\"\"
|
||||
|
||||
A note to newbie script writers:
|
||||
--------------------------------
|
||||
|
||||
@@ -224,8 +293,8 @@ A note to newbie script writers:
|
||||
scripts to get an idea of what can be done, you may be surprised.
|
||||
|
||||
@author: The Blender Python Team
|
||||
@requires: Blender 2.34 or newer.
|
||||
@version: 2.34cvs
|
||||
@requires: Blender 2.35 or newer.
|
||||
@version: 2.35
|
||||
@see: U{www.blender3d.org<http://www.blender3d.org>}: main site
|
||||
@see: U{www.blender.org<http://www.blender.org>}: documentation and forum
|
||||
@see: U{www.elysiun.com<http://www.elysiun.com>}: user forum
|
||||
|
||||
@@ -128,8 +128,13 @@ def GetRawFromObject(name):
|
||||
@param name: The name of an Object of type "Mesh".
|
||||
@rtype: NMesh
|
||||
@return: The NMesh wrapper of the mesh data from the Object called I{name}.
|
||||
@note: For "subsurfed" meshes, it's the B{display} level of subdivision that
|
||||
matters, the rendering one is only processed at the rendering pre-stage
|
||||
and is not available for scripts. This is not a problem at all, since
|
||||
you can get and set the subdivision levels via scripting, too (see
|
||||
L{NMesh.getSubDivLevels}, L{NMesh.setSubDivLevels}).
|
||||
@warn: This function gets I{deformed} mesh data, already modified for
|
||||
rendering (think "display list"). It also doesn't let you overwrite the
|
||||
displaying (think "display list"). It also doesn't let you overwrite the
|
||||
original mesh in Blender, so if you try to update it, a new mesh will
|
||||
be created.
|
||||
"""
|
||||
|
||||
@@ -710,6 +710,13 @@ void unlink_text(Text *text)
|
||||
ScrArea *area;
|
||||
SpaceLink *sl;
|
||||
|
||||
/* check if this text was used as script link:
|
||||
* this check function unsets the pointers and returns how many
|
||||
* script links used this Text */
|
||||
if (BPY_check_all_scriptlinks (text)) {
|
||||
allqueue(REDRAWBUTSSCRIPT, 0);
|
||||
}
|
||||
|
||||
for (scr= G.main->screen.first; scr; scr= scr->id.next) {
|
||||
for (area= scr->areabase.first; area; area= area->next) {
|
||||
for (sl= area->spacedata.first; sl; sl= sl->next) {
|
||||
|
||||
Reference in New Issue
Block a user