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:
authorCampbell Barton <ideasman42@gmail.com>2012-03-11 23:58:56 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-11 23:58:56 +0400
commitb330abc290622b32419ba084b8bc7e6a8ea9aaa2 (patch)
tree62c0590af336f1028fd05ffd33c28b7dec0f0c3c /source/blender/editors
parent42b3463030b07ba3a87574c173e759e3bb15353b (diff)
remove Object member from BMesh struct - was only used for undo and BMEditMesh already stores an object pointer.
also fix for own mistake with mesh conversion refactor, shape key index was off by 1 when switching editmode.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/mesh/bmesh_tools.c2
-rw-r--r--source/blender/editors/mesh/bmesh_utils.c11
-rw-r--r--source/blender/editors/transform/transform.c6
3 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c
index da08b3354e1..bbfbb16a5bb 100644
--- a/source/blender/editors/mesh/bmesh_tools.c
+++ b/source/blender/editors/mesh/bmesh_tools.c
@@ -3222,7 +3222,7 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmO
if (!em)
return OPERATOR_CANCELLED;
- bm_new = BM_mesh_create(obedit, &bm_mesh_allocsize_default);
+ bm_new = BM_mesh_create(&bm_mesh_allocsize_default);
CustomData_copy(&em->bm->vdata, &bm_new->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
CustomData_copy(&em->bm->edata, &bm_new->edata, CD_MASK_BMESH, CD_CALLOC, 0);
CustomData_copy(&em->bm->ldata, &bm_new->ldata, CD_MASK_BMESH, CD_CALLOC, 0);
diff --git a/source/blender/editors/mesh/bmesh_utils.c b/source/blender/editors/mesh/bmesh_utils.c
index bee4d4283f6..8ca5dce647f 100644
--- a/source/blender/editors/mesh/bmesh_utils.c
+++ b/source/blender/editors/mesh/bmesh_utils.c
@@ -514,7 +514,7 @@ static void *editbtMesh_to_undoMesh(void *emv, void *obdata)
Mesh *obme = obdata;
undomesh *um = MEM_callocN(sizeof(undomesh), "undo Mesh");
- BLI_strncpy(um->obname, em->bm->ob->id.name + 2, sizeof(um->obname));
+ BLI_strncpy(um->obname, em->ob->id.name + 2, sizeof(um->obname));
/* make sure shape keys work */
um->me.key = obme->key ? copy_key_nolib(obme->key) : NULL;
@@ -546,7 +546,7 @@ static void undoMesh_to_editbtMesh(void *umv, void *emv, void *UNUSED(obdata))
BMEdit_Free(em);
- bm = BM_mesh_create(ob, &bm_mesh_allocsize_default);
+ bm = BM_mesh_create(&bm_mesh_allocsize_default);
BMO_op_callf(bm, "mesh_to_bmesh mesh=%p object=%p set_shapekey=%b", &um->me, ob, FALSE);
em2 = BMEdit_Create(bm, TRUE);
@@ -572,6 +572,13 @@ static void free_undo(void *umv)
/* and this is all the undo system needs to know */
void undo_push_mesh(bContext *C, const char *name)
{
+ /* em->ob gets out of date and crashes on mesh undo,
+ * this is an easy way to ensure its OK
+ * though we could investigate the matter further. */
+ Object *obedit = CTX_data_edit_object(C);
+ BMEditMesh *em = BMEdit_FromObject(obedit);
+ em->ob = obedit;
+
undo_editmode_push(C, name, getEditMesh, free_undo, undoMesh_to_editbtMesh, editbtMesh_to_undoMesh, NULL);
}
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 666d0a2f7f2..7b98a2f0083 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -4552,7 +4552,7 @@ static int createSlideVerts(TransInfo *t)
float vec1[3], dis2, mval[2] = {t->mval[0], t->mval[1]}, d;
/* search cross edges for visible edge to the mouse cursor,
- * then use the shared vertex to calculate screen vector*/
+ * then use the shared vertex to calculate screen vector*/
dis2 = -1.0f;
for (i=0; i<2; i++) {
v = i?e->v1:e->v2;
@@ -4590,8 +4590,7 @@ static int createSlideVerts(TransInfo *t)
}
}
}
-
- em->bm->ob = t->obedit;
+
bmesh_edit_begin(em->bm, BMO_OP_FLAG_UNTAN_MULTIRES);
/*create copies of faces for customdata projection*/
@@ -4779,7 +4778,6 @@ void freeSlideVerts(TransInfo *t)
freeSlideTempFaces(sld);
- sld->em->bm->ob = t->obedit;
bmesh_edit_end(sld->em->bm, BMO_OP_FLAG_UNTAN_MULTIRES);
BLI_smallhash_release(&sld->vhash);