forked from bartvdbraak/blender
Fix bug #30778, sculpt w/ modifiers + undo causes collapse of vertices
Was caused by earlier refactoring of undo, used index array before it gets initialized. Fixed by swapping order of copying. Also changed normals calculation on undo restore to operate on tessellated data (which sculpt still uses), fixes console warning print.
This commit is contained in:
parent
51afa3b7c6
commit
c86b17ddb7
@ -274,7 +274,8 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
|
||||
|
||||
if (ss->modifiers_active) {
|
||||
Mesh *mesh = ob->data;
|
||||
mesh_calc_normals_mapping(mesh->mvert, mesh->totvert, mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, NULL, NULL, 0, NULL, NULL);
|
||||
mesh_calc_normals_tessface(mesh->mvert, mesh->totvert,
|
||||
mesh->mface, mesh->totface, NULL);
|
||||
|
||||
free_sculptsession_deformMats(ss);
|
||||
tag_update |= 1;
|
||||
@ -471,14 +472,6 @@ SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node,
|
||||
BLI_unlock_thread(LOCK_CUSTOM1);
|
||||
|
||||
/* copy threaded, hopefully this is the performance critical part */
|
||||
switch (type) {
|
||||
case SCULPT_UNDO_COORDS:
|
||||
sculpt_undo_store_coords(ob, unode);
|
||||
break;
|
||||
case SCULPT_UNDO_HIDDEN:
|
||||
sculpt_undo_store_hidden(ob, unode);
|
||||
break;
|
||||
}
|
||||
|
||||
if (unode->grids) {
|
||||
int totgrid, *grids;
|
||||
@ -493,6 +486,15 @@ SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node,
|
||||
memcpy(unode->index, vert_indices, sizeof(int) * unode->totvert);
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case SCULPT_UNDO_COORDS:
|
||||
sculpt_undo_store_coords(ob, unode);
|
||||
break;
|
||||
case SCULPT_UNDO_HIDDEN:
|
||||
sculpt_undo_store_hidden(ob, unode);
|
||||
break;
|
||||
}
|
||||
|
||||
/* store active shape key */
|
||||
if (ss->kb) BLI_strncpy(unode->shapeName, ss->kb->name, sizeof(ss->kb->name));
|
||||
else unode->shapeName[0] = '\0';
|
||||
|
Loading…
Reference in New Issue
Block a user