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:
authorJoseph Eagar <joeedh@gmail.com>2009-09-10 10:08:52 +0400
committerJoseph Eagar <joeedh@gmail.com>2009-09-10 10:08:52 +0400
commit4652d66c0a7c6a698d84d69cf1e0727c0edd776c (patch)
treed131b49e619c9032c5e7f8a3b56c88cd8d0543b8 /source/blender/editors
parent4c072f85d98d6ae7f1322314f8da8b3f2fb40f7d (diff)
editmode undo stores data as mesh dna now, instead of bmesh copies. also fixed a bug related to vpaint and hide flags.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/mesh/bmeshutils.c38
-rw-r--r--source/blender/editors/space_view3d/drawobject.c6
2 files changed, 34 insertions, 10 deletions
diff --git a/source/blender/editors/mesh/bmeshutils.c b/source/blender/editors/mesh/bmeshutils.c
index 36c5a550a1a..9682515f6c7 100644
--- a/source/blender/editors/mesh/bmeshutils.c
+++ b/source/blender/editors/mesh/bmeshutils.c
@@ -539,32 +539,52 @@ static void *getEditMesh(bContext *C)
return NULL;
}
+typedef struct undomesh {
+ Mesh me;
+ int selectmode;
+} undomesh;
+
/*undo simply makes copies of a bmesh*/
static void *editbtMesh_to_undoMesh(void *emv)
{
+ BMEditMesh *em = emv;
+ undomesh *me = MEM_callocN(sizeof(undomesh), "undo Mesh");
+
/*we recalc the tesselation here, to avoid seeding calls to
BMEdit_RecalcTesselation throughout the code.*/
- BMEdit_RecalcTesselation(emv);
+ BMEdit_RecalcTesselation(em);
+
+ BMO_CallOpf(em->bm, "bmesh_to_mesh meshptr=%p notesselation=%i", me, 1);
+ me->selectmode = em->selectmode;
- return BMEdit_Copy(emv);
+ return me;
}
static void undoMesh_to_editbtMesh(void *umv, void *emv)
{
- BMEditMesh *em1 = umv, *em2 = emv;
+ BMEditMesh *em = emv, *em2;
+ undomesh *me = umv;
+ BMesh *bm;
+ int allocsize[4] = {512, 512, 2048, 512};
+
+ BMEdit_Free(em);
+
+ bm = BM_Make_Mesh(allocsize);
+ BMO_CallOpf(bm, "mesh_to_bmesh mesh=%p", me);
- BMEdit_Free(em2);
+ em2 = BMEdit_Create(bm);
+ *em = *em2;
+
+ em->selectmode = me->selectmode;
- *em2 = *BMEdit_Copy(em1);
+ MEM_freeN(em2);
}
static void free_undo(void *umv)
{
- BMEditMesh *em = umv;
-
- BMEdit_Free(em);
- MEM_freeN(em);
+ free_mesh(umv, 0);
+ MEM_freeN(umv);
}
/* and this is all the undo system needs to know */
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index d432cac248f..9c7aed86072 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -5750,7 +5750,11 @@ static int bbs_mesh_solid__setDrawOpts(void *userData, int index, int *drawSmoot
{
Mesh *me = userData;
- if (!(me->mface[index].flag&ME_HIDE)) {
+ /*sanity check*/
+ if (index >= me->totpoly)
+ return 0;
+
+ if (!(me->mpoly[index].flag&ME_HIDE)) {
WM_set_framebuffer_index_color(index+1);
return 1;
} else {