[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53434] trunk/blender/source/blender/ editors/util/undo.c: Disable fall through to global undo from paint/ sculpt undo

Nicholas Bishop nicholasbishop at gmail.com
Sun Dec 30 19:23:45 CET 2012


Revision: 53434
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53434
Author:   nicholasbishop
Date:     2012-12-30 18:23:42 +0000 (Sun, 30 Dec 2012)
Log Message:
-----------
Disable fall through to global undo from paint/sculpt undo

Undoing/redoing in sculpt and other paint modes should only use the
mode-specific undo, not global undo. It is now consistent with edit
mode and avoids tricky interaction between the two systems.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/util/undo.c

Modified: trunk/blender/source/blender/editors/util/undo.c
===================================================================
--- trunk/blender/source/blender/editors/util/undo.c	2012-12-30 18:23:03 UTC (rev 53433)
+++ trunk/blender/source/blender/editors/util/undo.c	2012-12-30 18:23:42 UTC (rev 53434)
@@ -162,15 +162,18 @@
 		}
 	}
 	else {
-		int do_glob_undo = FALSE;
-		
+		/* Note: we used to do a fall-through here where if the
+		 * mode-specific undo system had no more steps to undo (or
+		 * redo), the global undo would run.
+		 *
+		 * That was inconsistent with editmode, and also makes for
+		 * unecessarily tricky interaction with the other undo
+		 * systems. */
 		if (obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
-			if (!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname))
-				do_glob_undo = TRUE;
+			ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname);
 		}
 		else if (obact && obact->mode & OB_MODE_SCULPT) {
-			if (!ED_undo_paint_step(C, UNDO_PAINT_MESH, step, undoname))
-				do_glob_undo = TRUE;
+			ED_undo_paint_step(C, UNDO_PAINT_MESH, step, undoname);
 		}
 		else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
 			if (step == 1)
@@ -178,24 +181,17 @@
 			else
 				PE_redo(CTX_data_scene(C));
 		}
-		else {
-			do_glob_undo = TRUE;
-		}
-		
-		if (do_glob_undo) {
-			if (U.uiflag & USER_GLOBALUNDO) {
-				// note python defines not valid here anymore.
-				//#ifdef WITH_PYTHON
-				// XXX		BPY_scripts_clear_pyobjects();
-				//#endif
-				if (undoname)
-					BKE_undo_name(C, undoname);
-				else
-					BKE_undo_step(C, step);
+		else if (U.uiflag & USER_GLOBALUNDO) {
+			// note python defines not valid here anymore.
+			//#ifdef WITH_PYTHON
+			// XXX		BPY_scripts_clear_pyobjects();
+			//#endif
+			if (undoname)
+				BKE_undo_name(C, undoname);
+			else
+				BKE_undo_step(C, step);
 				
-				WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, CTX_data_scene(C));
-			}
-			
+			WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, CTX_data_scene(C));
 		}
 	}
 	




More information about the Bf-blender-cvs mailing list