[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35224] trunk/blender/source/blender/ editors/sculpt_paint/sculpt_undo.c: Fixes for undo when suclpting on deformed mesh:

Sergey Sharybin g.ulairi at gmail.com
Sun Feb 27 17:49:29 CET 2011


Revision: 35224
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35224
Author:   nazgul
Date:     2011-02-27 16:49:28 +0000 (Sun, 27 Feb 2011)
Log Message:
-----------
Fixes for undo when suclpting on deformed mesh:
- Invalid shape when deformation mesh was disabled befoe undoing
- Crash when deformation modifier was enabled before undoing

Still got problems with undoing multires changes when toggling modifiers.

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	2011-02-27 15:25:24 UTC (rev 35223)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt_undo.c	2011-02-27 16:49:28 UTC (rev 35224)
@@ -70,8 +70,10 @@
 
 static void sculpt_restore_deformed(SculptSession *ss, SculptUndoNode *unode, int uindex, int oindex, float coord[3])
 {
-	swap_v3_v3(coord, unode->orig_co[uindex]);
-	copy_v3_v3(unode->co[uindex], ss->deform_cos[oindex]);
+	if(unode->orig_co) {
+		swap_v3_v3(coord, unode->orig_co[uindex]);
+		copy_v3_v3(unode->co[uindex], ss->deform_cos[oindex]);
+	} else swap_v3_v3(coord, unode->co[uindex]);
 }
 
 static void sculpt_undo_restore(bContext *C, ListBase *lb)
@@ -126,7 +128,10 @@
 
 				for(i=0; i<unode->totvert; i++) {
 					if(ss->modifiers_active) sculpt_restore_deformed(ss, unode, i, index[i], vertCos[index[i]]);
-					else swap_v3_v3(vertCos[index[i]], unode->co[i]);
+					else {
+						if(unode->orig_co) swap_v3_v3(vertCos[index[i]], unode->orig_co[i]);
+						else swap_v3_v3(vertCos[index[i]], unode->co[i]);
+					}
 				}
 
 				/* propagate new coords to keyblock */
@@ -140,7 +145,10 @@
 			} else {
 				for(i=0; i<unode->totvert; i++) {
 					if(ss->modifiers_active) sculpt_restore_deformed(ss, unode, i, index[i], mvert[index[i]].co);
-					else swap_v3_v3(mvert[index[i]].co, unode->co[i]);
+					else {
+						if(unode->orig_co) swap_v3_v3(mvert[index[i]].co, unode->orig_co[i]);
+						else swap_v3_v3(mvert[index[i]].co, unode->co[i]);
+					}
 					mvert[index[i]].flag |= ME_VERT_PBVH_UPDATE;
 				}
 			}




More information about the Bf-blender-cvs mailing list