Fixes to previous sculpting tweaks
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 6 May 2014 14:26:52 +0000 (16:26 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 6 May 2014 14:27:45 +0000 (16:27 +0200)
undo didn't work, layer and smooth crashed..

source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/sculpt_paint/sculpt_undo.c

index b75387d55516655d386da60404e99346c128c235..4a1a65832e6afe50fa1fde5a3cd99e14434ea0d5 100644 (file)
@@ -4250,7 +4250,7 @@ static void sculpt_stroke_modifiers_check(const bContext *C, Object *ob)
 {
        SculptSession *ss = ob->sculpt;
 
-       if (ss->modifiers_active) {
+       if (ss->kb || ss->modifiers_active) {
                Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
                Brush *brush = BKE_paint_brush(&sd->paint);
 
@@ -4573,13 +4573,16 @@ static void sculpt_stroke_update_step(bContext *C, struct PaintStroke *UNUSED(st
         *
         * Could be optimized later, but currently don't think it's so
         * much common scenario.
-        **
-        ** Same applies to the DAG_id_tag_update() invoked from
+        *
+        * Same applies to the DAG_id_tag_update() invoked from
         * sculpt_flush_update().
         */
-       if (ss->kb || ss->modifiers_active) {
+       if (ss->modifiers_active) {
                sculpt_flush_stroke_deform(sd, ob);
        }
+       else if (ss->kb) {
+               sculpt_update_keyblock(ob);
+       }
 
        ss->cache->first_time = false;
 
index 0560801bc773164ffcb915a9013cda2b6e10c81c..961a525c86fbda7703046246561031228b28895d 100644 (file)
@@ -462,7 +462,7 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
        }
 
        if (update || rebuild) {
-               int tag_update = 0;
+               bool tag_update = false;
                /* we update all nodes still, should be more clever, but also
                 * needs to work correct when exiting/entering sculpt mode and
                 * the nodes get recreated, though in that case it could do all */
@@ -476,15 +476,15 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
                                multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);
                }
 
-               tag_update = ((Mesh *)ob->data)->id.us > 1;
+               tag_update |= ((Mesh *)ob->data)->id.us > 1;
 
-               if (ss->modifiers_active) {
+               if (ss->kb || ss->modifiers_active) {
                        Mesh *mesh = ob->data;
                        BKE_mesh_calc_normals_tessface(mesh->mvert, mesh->totvert,
                                                       mesh->mface, mesh->totface, NULL);
 
                        free_sculptsession_deformMats(ss);
-                       tag_update |= 1;
+                       tag_update |= true;
                }
 
                if (tag_update) {