Fix T39196, Dynamic Topology Undo Applied to Wrong Mesh
authorAntony Riakiotakis <kalast@gmail.com>
Tue, 13 May 2014 17:59:54 +0000 (20:59 +0300)
committerAntony Riakiotakis <kalast@gmail.com>
Tue, 13 May 2014 19:05:23 +0000 (22:05 +0300)
commit33df6aa12ea6f627b5b238e6eec64cffb2acdbd4
treea2cd38a29091f349b9850e42ee59a4b3ce5600fb
parent9531091eb8ec4c8c7e62d727f962e19c334e7ef2
Fix T39196, Dynamic Topology Undo Applied to Wrong Mesh

Undoing nodes that do not belong to the current object will cause the
saved bmesh log entry to be reverted instead. This entry can belong to
another object though.
This is easy to fix by enforcing name matching (this was borrowed by
edit mode but can definitely be improved) between current object name
and undo node name and deleting older entries.

However there are complications. Deleting dyntopo entries in this way
can leave a brush stroke as first dyntopo log entry. This can present
issues if we attempt to delete that entry since it's deleted mesh
elements may now have had their ids (which would still be valid at the
time) cleaned up. This can result in crashing if we attempt to resculpt
on the mesh. To fix this I have disabled releasing the deleted entries.

This entanglement between bm_log and undo is quite volatile but I hope
the system works better now.

Also minor cleanup, fix unneeded check warning
source/blender/blenlib/intern/boxpack2d.c
source/blender/bmesh/intern/bmesh_log.c
source/blender/bmesh/intern/bmesh_log.h
source/blender/editors/include/ED_sculpt.h
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_image_proj.c
source/blender/editors/sculpt_paint/paint_intern.h
source/blender/editors/sculpt_paint/paint_undo.c
source/blender/editors/sculpt_paint/sculpt_undo.c
source/blender/editors/space_image/image_ops.c
source/blender/editors/util/undo.c