[Bf-blender-cvs] [3ebebe62d77] master: Sculpt Undo: Fix multires undo for interleaved nodes

Sergey Sharybin noreply at git.blender.org
Thu Apr 2 09:56:00 CEST 2020


Commit: 3ebebe62d77cb04618e3bf6b6b8602e7130dac6e
Author: Sergey Sharybin
Date:   Fri Mar 27 16:54:28 2020 +0100
Branches: master
https://developer.blender.org/rB3ebebe62d77cb04618e3bf6b6b8602e7130dac6e

Sculpt Undo: Fix multires undo for interleaved nodes

Made it so grids array is properly allocated when first node in the
undo list does not contain grid data.

Differential Revision: https://developer.blender.org/D7299

===================================================================

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

===================================================================

diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 67ef82aeaaf..bb463d29f1c 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -677,11 +677,18 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase
   }
 
   if (use_multires_undo) {
-    int max_grid;
-    unode = lb->first;
-    max_grid = unode->maxgrid;
-    undo_modified_grids = MEM_callocN(sizeof(char) * max_grid, "undo_grids");
     for (unode = lb->first; unode; unode = unode->next) {
+      if (!STREQ(unode->idname, ob->id.name)) {
+        continue;
+      }
+      if (unode->maxgrid == 0) {
+        continue;
+      }
+
+      if (undo_modified_grids == NULL) {
+        undo_modified_grids = MEM_callocN(sizeof(char) * unode->maxgrid, "undo_grids");
+      }
+
       for (int i = 0; i < unode->totgrid; i++) {
         undo_modified_grids[unode->grids[i]] = 1;
       }



More information about the Bf-blender-cvs mailing list