[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60196] trunk/blender/source/blender/ editors/sculpt_paint/paint_undo.c: Fix #36748 Sculpting/ image painting does not respect undo steps limit.

Antony Riakiotakis kalast at gmail.com
Tue Sep 17 14:11:00 CEST 2013


Revision: 60196
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60196
Author:   psy-fi
Date:     2013-09-17 12:11:00 +0000 (Tue, 17 Sep 2013)
Log Message:
-----------
Fix #36748 Sculpting/image painting does not respect undo steps limit.

A simple oversight here, it should work as intended now.

Nice to have it functional for people who might hate dyntopo undo with a
passion.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/paint_undo.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_undo.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_undo.c	2013-09-17 11:37:09 UTC (rev 60195)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_undo.c	2013-09-17 12:11:00 UTC (rev 60196)
@@ -124,7 +124,31 @@
 {
 	UndoElem *uel;
 	uintptr_t totmem, maxmem;
+	int totundo = 0;
 
+	/* first limit to undo steps */
+	uel = stack->elems.last;
+
+	while (uel) {
+		totundo++;
+		if (totundo > U.undosteps) break;
+		uel = uel->prev;
+	}
+
+	if (uel) {
+		UndoElem *first;
+
+		/* in case the undo steps are zero, the current pointer will be invalid */
+		if (uel == stack->current)
+			stack->current = NULL;
+
+		do {
+			first = stack->elems.first;
+			undo_elem_free(stack, first);
+			BLI_freelinkN(&stack->elems, first);
+		} while (first != uel);
+	}
+
 	if (U.undomemory != 0) {
 		/* limit to maximum memory (afterwards, we can't know in advance) */
 		totmem = 0;




More information about the Bf-blender-cvs mailing list