diff options
author | Ken Hughes <khughes@pacific.edu> | 2006-01-16 05:06:02 +0300 |
---|---|---|
committer | Ken Hughes <khughes@pacific.edu> | 2006-01-16 05:06:02 +0300 |
commit | df3fd052dd97e5ee7e450ec5f4bce9aec5fa2def (patch) | |
tree | a9d2fb183fc9535a8c03513dad30cdc3c2be2350 | |
parent | 9137d364df2ad81bd22f954eafe94bb23ea6945c (diff) |
Fixed Window.Editmode(0) so that it only calls undo_push_mesh() when
U.undosteps is nonzero. Also added optional parameter to avoid pushing
undo info alltogether if desired.
-rw-r--r-- | source/blender/python/api2_2x/Window.c | 15 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Window.py | 5 |
2 files changed, 13 insertions, 7 deletions
diff --git a/source/blender/python/api2_2x/Window.c b/source/blender/python/api2_2x/Window.c index 8b89296dcde..a7ad2581f45 100644 --- a/source/blender/python/api2_2x/Window.c +++ b/source/blender/python/api2_2x/Window.c @@ -889,20 +889,23 @@ static PyObject *M_Window_EditMode( PyObject * self, PyObject * args ) short status = -1; char *undo_str = "From script"; int undo_str_len = 11; + int do_undo = 1; - if( !PyArg_ParseTuple - ( args, "|hs#", &status, &undo_str, &undo_str_len ) ) + if( !PyArg_ParseTuple( args, + "|hs#i", &status, &undo_str, &undo_str_len, &do_undo ) ) return EXPP_ReturnPyObjError( PyExc_TypeError, - "expected nothing or an int (bool) and a string as arguments" ); + "expected optional int (bool), string and int (bool) as arguments" ); if( status >= 0 ) { if( status ) { if( !G.obedit ) enter_editmode( ); } else if( G.obedit ) { - if( undo_str_len > 63 ) - undo_str[63] = '\0'; /* 64 is max */ - undo_push_mesh( undo_str ); /* use better solution after 2.34 */ + if( do_undo && U.undosteps != 0 ) { + if( undo_str_len > 63 ) + undo_str[63] = '\0'; /* 64 is max */ + undo_push_mesh( undo_str ); /* use better solution after 2.34 */ + } exit_editmode( 1 ); } } diff --git a/source/blender/python/api2_2x/doc/Window.py b/source/blender/python/api2_2x/doc/Window.py index 64775654054..061ae696f6a 100644 --- a/source/blender/python/api2_2x/doc/Window.py +++ b/source/blender/python/api2_2x/doc/Window.py @@ -232,7 +232,7 @@ def GetPerspMatrix (): @return: the current matrix. """ -def EditMode(enable = -1, undo_msg = 'From script'): +def EditMode(enable = -1, undo_msg = 'From script', undo = 1): """ Get and optionally set the current edit mode status: in or out. @@ -258,6 +258,9 @@ def EditMode(enable = -1, undo_msg = 'From script'): string is used as the undo message in the Mesh->Undo History submenu in the 3d view header. Max length is 63, strings longer than that get clamped. + @param undo: don't save Undo information (only needed when exiting edit + mode). + @type undo: int @rtype: int (bool) @return: 0 if Blender is not in edit mode right now, 1 otherwise. @warn: this is an important function. NMesh operates on normal Blender |