Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/blender/python/BPY_extern.h1
-rw-r--r--source/blender/python/BPY_interface.c40
-rw-r--r--source/blender/python/api2_2x/NMesh.c4
-rw-r--r--source/blender/python/api2_2x/doc/API_intro.py73
-rw-r--r--source/blender/python/api2_2x/doc/NMesh.py7
-rw-r--r--source/blender/src/drawtext.c7
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) {