Commit: 794b915a65b9d35915c3780579cfce687bcde6e8
Author: Lukas Tönne
Date: Sun Feb 1 14:20:45 2015 +0100
Branches: strand_editmode
https://developer.blender.org/rB794b915a65b9d35915c3780579cfce687bcde6e8
Fix for strands undo creating an invalid BMesh.
When copying mesh data to bmesh the MVERT and similar customdata types
have to be omitted. Otherwise the bmesh instance ends up with NULL
pointers in customdata layers, but entries in the typemap != -1. The
effect was that when storing new steps after one or more undo, the
resulting original data would be copied, and subsequent undo steps
are ignored.
===================================================================
M source/blender/blenkernel/BKE_customdata.h
M source/blender/blenkernel/intern/customdata.c
M source/blender/editors/hair/hair_undo.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_customdata.h
b/source/blender/blenkernel/BKE_customdata.h
index 86e66f7..e42ed8b 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -59,6 +59,7 @@ extern const CustomDataMask CD_MASK_DERIVEDMESH;
extern const CustomDataMask CD_MASK_BMESH;
extern const CustomDataMask CD_MASK_FACECORNERS;
extern const CustomDataMask CD_MASK_STRANDS;
+extern const CustomDataMask CD_MASK_STRANDS_BMESH;
extern const CustomDataMask CD_MASK_EVERYTHING;
/* for ORIGINDEX layer type, indicates no original index for this element */
diff --git a/source/blender/blenkernel/intern/customdata.c
b/source/blender/blenkernel/intern/customdata.c
index 3bb19cb..717e137 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -1324,7 +1324,12 @@ const CustomDataMask CD_MASK_STRANDS =
CD_MASK_MVERT | CD_MASK_MEDGE |
CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_MCOL |
CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR | CD_MASK_MDISPS |
- CD_MASK_MVERT_SKIN | CD_MASK_FREESTYLE_EDGE | CD_MASK_FREESTYLE_FACE |
+ CD_MASK_MVERT_SKIN | CD_MASK_FREESTYLE_EDGE |
+ CD_MASK_MSURFACE_SAMPLE;
+const CustomDataMask CD_MASK_STRANDS_BMESH =
+ CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_PROP_FLT |
CD_MASK_PROP_INT |
+ CD_MASK_PROP_STR | CD_MASK_SHAPEKEY | CD_MASK_SHAPE_KEYINDEX |
CD_MASK_MDISPS |
+ CD_MASK_MVERT_SKIN | CD_MASK_FREESTYLE_EDGE |
CD_MASK_MSURFACE_SAMPLE;
const CustomDataMask CD_MASK_EVERYTHING =
CD_MASK_MVERT | CD_MASK_MSTICKY /* DEPRECATED */ | CD_MASK_MDEFORMVERT |
CD_MASK_MEDGE | CD_MASK_MFACE |
diff --git a/source/blender/editors/hair/hair_undo.c
b/source/blender/editors/hair/hair_undo.c
index 0b169a8..7e1c3cf 100644
--- a/source/blender/editors/hair/hair_undo.c
+++ b/source/blender/editors/hair/hair_undo.c
@@ -118,7 +118,7 @@ static void strands_undo_to_edit(void *undov, void *editv,
void *UNUSED(obdata))
edit->bm->shapenr = undo->shapenr;
bm = BM_mesh_create(&allocsize);
- BM_mesh_bm_from_me_ex(bm, &undo->me, CD_MASK_STRANDS, false, false,
undo->shapenr);
+ BM_mesh_bm_from_me_ex(bm, &undo->me, CD_MASK_STRANDS_BMESH, false,
false, undo->shapenr);
/* note: have to create the new edit before freeing the old one,
* because it owns the root_dm and we have to copy it before
@@ -184,6 +184,5 @@ void undo_push_strands(bContext *C, const char *name)
BMEditStrands *edit = BKE_editstrands_from_object(obact);
edit->ob = obact;
-
undo_editmode_push(C, name, CTX_data_active_object, strands_get_edit,
strands_free_undo, strands_undo_to_edit, strands_edit_to_undo, NULL);
}
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs