[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45379] trunk/blender/source/blender/ editors/sculpt_paint/sculpt_undo.c: Fix bug #30778, sculpt w/ modifiers + undo causes collapse of vertices

Nicholas Bishop nicholasbishop at gmail.com
Tue Apr 3 20:41:54 CEST 2012


Revision: 45379
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45379
Author:   nicholasbishop
Date:     2012-04-03 18:41:40 +0000 (Tue, 03 Apr 2012)
Log Message:
-----------
Fix bug #30778, sculpt w/ modifiers + undo causes collapse of vertices

Was caused by earlier refactoring of undo, used index array
before it gets initialized. Fixed by swapping order of copying.

Also changed normals calculation on undo restore to operate on
tessellated data (which sculpt still uses), fixes console warning
print.

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

Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt_undo.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt_undo.c	2012-04-03 17:26:57 UTC (rev 45378)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt_undo.c	2012-04-03 18:41:40 UTC (rev 45379)
@@ -274,7 +274,8 @@
 
 		if (ss->modifiers_active) {
 			Mesh *mesh = ob->data;
-			mesh_calc_normals_mapping(mesh->mvert, mesh->totvert, mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, NULL, NULL, 0, NULL, NULL);
+			mesh_calc_normals_tessface(mesh->mvert, mesh->totvert,
+									   mesh->mface, mesh->totface, NULL);
 
 			free_sculptsession_deformMats(ss);
 			tag_update |= 1;
@@ -471,14 +472,6 @@
 	BLI_unlock_thread(LOCK_CUSTOM1);
 
 	/* copy threaded, hopefully this is the performance critical part */
-	switch (type) {
-		case SCULPT_UNDO_COORDS:
-			sculpt_undo_store_coords(ob, unode);
-			break;
-		case SCULPT_UNDO_HIDDEN:
-			sculpt_undo_store_hidden(ob, unode);
-			break;
-	}
 
 	if (unode->grids) {
 		int totgrid, *grids;
@@ -493,6 +486,15 @@
 		memcpy(unode->index, vert_indices, sizeof(int) * unode->totvert);
 	}
 
+	switch (type) {
+		case SCULPT_UNDO_COORDS:
+			sculpt_undo_store_coords(ob, unode);
+			break;
+		case SCULPT_UNDO_HIDDEN:
+			sculpt_undo_store_hidden(ob, unode);
+			break;
+	}
+
 	/* store active shape key */
 	if (ss->kb) BLI_strncpy(unode->shapeName, ss->kb->name, sizeof(ss->kb->name));
 	else unode->shapeName[0] = '\0';




More information about the Bf-blender-cvs mailing list