Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2020-03-27 18:54:28 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2020-04-02 10:38:26 +0300
commit3ebebe62d77cb04618e3bf6b6b8602e7130dac6e (patch)
tree78fe3de656c1a8a8dc09a2af3e728594a2a66716 /source/blender/editors/sculpt_paint
parenta9963669f9d2360a8a7c84c36db5cd64df5e2139 (diff)
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
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c15
1 files changed, 11 insertions, 4 deletions
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;
}