diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2004-11-27 21:32:26 +0300 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2004-11-27 21:32:26 +0300 |
commit | e3b7dfe6e2cf4d1d7faf32d287b02c01939dc3e6 (patch) | |
tree | 3a6922ea4b0ca5f2c3414eb28d428f0640b23091 /source/blender | |
parent | fa5649796d2deb94eefff92d2e1132de3dc5e339 (diff) |
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).
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/python/BPY_extern.h | 1 | ||||
-rw-r--r-- | source/blender/python/BPY_interface.c | 40 | ||||
-rw-r--r-- | source/blender/python/api2_2x/NMesh.c | 4 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/API_intro.py | 73 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/NMesh.py | 7 | ||||
-rw-r--r-- | source/blender/src/drawtext.c | 7 |
6 files changed, 128 insertions, 4 deletions
diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index 45a95b39a00..48c5126c22b 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -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 ); diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c index 1fd217656d9..bc691e002fb 100644 --- a/source/blender/python/BPY_interface.c +++ b/source/blender/python/BPY_interface.c @@ -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: diff --git a/source/blender/python/api2_2x/NMesh.c b/source/blender/python/api2_2x/NMesh.c index 7862330f425..9b11d783af4 100644 --- a/source/blender/python/api2_2x/NMesh.c +++ b/source/blender/python/api2_2x/NMesh.c @@ -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 ) diff --git a/source/blender/python/api2_2x/doc/API_intro.py b/source/blender/python/api2_2x/doc/API_intro.py index bceef653dca..b8506fd87e0 100644 --- a/source/blender/python/api2_2x/doc/API_intro.py +++ b/source/blender/python/api2_2x/doc/API_intro.py @@ -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 diff --git a/source/blender/python/api2_2x/doc/NMesh.py b/source/blender/python/api2_2x/doc/NMesh.py index b98793e3798..ca2e42ccdbf 100644 --- a/source/blender/python/api2_2x/doc/NMesh.py +++ b/source/blender/python/api2_2x/doc/NMesh.py @@ -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. """ diff --git a/source/blender/src/drawtext.c b/source/blender/src/drawtext.c index ef5656c7f1f..e6e9ea598e1 100644 --- a/source/blender/src/drawtext.c +++ b/source/blender/src/drawtext.c @@ -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) { |