Fix for bug #5345, sculpt tool doesn't seems to use correctly the undo setting on...
authorNicholas Bishop <nicholasbishop@gmail.com>
Mon, 4 Dec 2006 03:26:30 +0000 (03:26 +0000)
committerNicholas Bishop <nicholasbishop@gmail.com>
Mon, 4 Dec 2006 03:26:30 +0000 (03:26 +0000)
source/blender/src/multires.c
source/blender/src/sculptmode.c

index 4a0c058f54c6d21b35403a5e620a261d18815fcb..e9e763f10ae1108c97fb6c071499e5e0235a4a1a 100644 (file)
@@ -1063,8 +1063,11 @@ void multires_level_to_mesh(Object *ob, Mesh *me)
        /* Vertices/Edges/Faces */
        
        for(i=0; i<lvl->totvert; ++i) {
-               if(em)
+               if(em) {
                        eves[i]= addvertlist(lvl->verts[i].co, NULL); /* TODO */
+                       if(lvl->verts[i].flag & 1) eves[i]->f |= SELECT;
+                       if(lvl->verts[i].flag & ME_HIDE) eves[i]->h= 1;
+               }
                else
                        me->mvert[i]= lvl->verts[i];
        }
index 14d3e675b227d22f445515031073c0ef69b72a52..3b2c46e622218995ba60a18f6b7d6d57bc55b139 100644 (file)
@@ -301,10 +301,17 @@ void sculptmode_undo_free(Scene *sce)
 
 void sculptmode_undo_push(char *str, SculptUndoType type)
 {
-       int cnt= 7;
+       int cnt= U.undosteps-1;
        SculptUndo *su= G.scene->sculptdata.undo;
-       SculptUndoStep *n= MEM_callocN(sizeof(SculptUndoStep), "SculptUndo"), *sus, *chop, *path;
+       SculptUndoStep *n, *sus, *chop, *path;
        Mesh *me= get_mesh(G.scene->sculptdata.active_ob);
+       
+       if(U.undosteps==0) {
+               sculptmode_undo_free(G.scene);
+               return;
+       }
+       
+       n= MEM_callocN(sizeof(SculptUndoStep), "SculptUndo");
 
        /* Chop off undo data after cur */
        for(sus= su->steps.last; sus && sus != su->cur; sus= path) {