diff options
author | Joseph Eagar <joeedh@gmail.com> | 2009-08-06 18:03:43 +0400 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2009-08-06 18:03:43 +0400 |
commit | 7e6662e60ca9bd30dd11826ebceceea6dec85103 (patch) | |
tree | e2b32993b178bc2066a0f82707e35e8e11af227b /source/blender | |
parent | 8f5d067c466c997291d946e098db5b3ad15a8576 (diff) |
added a crash handler to dump the global undo state to file on segmentation fault. it saves to the current file path in G.sce + .crash.blend. note that this code is only enabled on release builds, it's #ifdef'd out if _DEBUG is defined. for users, if you were in edit mode when a crash happened, this will only save the mesh changes up to the time you entered edit mode.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_blender.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_bmesh.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 18 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_polygon.c | 10 | ||||
-rw-r--r-- | source/blender/bmesh/operators/utils.c | 6 | ||||
-rw-r--r-- | source/blender/editors/mesh/bmesh_tools.c | 2 |
6 files changed, 27 insertions, 13 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 19b9c315939..52ea1484d28 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -75,6 +75,7 @@ extern void BKE_undo_name(struct bContext *C, const char *name); extern void BKE_reset_undo(void); extern char *BKE_undo_menu_string(void); extern void BKE_undo_number(struct bContext *C, int nr); +void BKE_undo_save(char *fname); extern void BKE_undo_save_quit(void); #ifdef __cplusplus diff --git a/source/blender/blenkernel/BKE_bmesh.h b/source/blender/blenkernel/BKE_bmesh.h index 957cd8ef9bd..fc43ae0f9a5 100644 --- a/source/blender/blenkernel/BKE_bmesh.h +++ b/source/blender/blenkernel/BKE_bmesh.h @@ -1,7 +1,7 @@ /** * BKE_bmesh.h jan 2007 * - * BMesh modeler structure and functions. + * (old) BMesh modeler structure and functions. * * $Id$ * @@ -52,6 +52,7 @@ struct BME_Edge; struct BME_Poly; struct BME_Loop; +/*NOTE: this is the bmesh 1.0 code. it's completely outdated.*/ /*Notes on further structure Cleanup: -Remove the tflags, they belong in custom data layers diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 2728aa30e6e..e354cf14830 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -726,10 +726,18 @@ char *BKE_undo_menu_string(void) /* saves quit.blend */ void BKE_undo_save_quit(void) { + char str[FILE_MAXDIR+FILE_MAXFILE]; + + BLI_make_file_string("/", str, btempdir, "quit.blend"); + + BKE_undo_save(str); +} + +void BKE_undo_save(char *fname) +{ UndoElem *uel; MemFileChunk *chunk; int file; - char str[FILE_MAXDIR+FILE_MAXFILE]; if( (U.uiflag & USER_GLOBALUNDO)==0) return; @@ -742,9 +750,7 @@ void BKE_undo_save_quit(void) /* no undo state to save */ if(undobase.first==undobase.last) return; - BLI_make_file_string("/", str, btempdir, "quit.blend"); - - file = open(str,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666); + file = open(fname, O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666); if(file == -1) { //XXX error("Unable to save %s, check you have permissions", str); return; @@ -758,7 +764,7 @@ void BKE_undo_save_quit(void) close(file); - if(chunk) ; //XXX error("Unable to save %s, internal error", str); - else printf("Saved session recovery to %s\n", str); + if(chunk) ; //XXX error("Unable to save %s, internal error", fname); + else printf("Saved session recovery to %s\n", fname); } diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index 3d38d1e541f..38a28e3e84b 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -383,8 +383,8 @@ void poly_rotate_plane(float normal[3], float (*verts)[3], int nverts) void BM_Face_UpdateNormal(BMesh *bm, BMFace *f) { - float projverts[12][3]; - float (*proj)[3] = f->len < 12 ? projverts : MEM_mallocN(sizeof(float)*f->len*3, "projvertsn"); + float projverts[200][3]; + float (*proj)[3] = f->len < 200 ? projverts : MEM_mallocN(sizeof(float)*f->len*3, "projvertsn"); BMLoop *l = f->loopbase; int i=0; @@ -476,9 +476,9 @@ void bmesh_update_face_normal(BMesh *bm, BMFace *f, float (*projectverts)[3]) /* * BMESH FLIP NORMAL * - * Reverses the winding of a faces - * Note that this does *not* update the calculated - * Normal + * Reverses the winding of a face. + * Note that this updates the calculated + * normal. */ void BM_flip_normal(BMesh *bm, BMFace *f) { diff --git a/source/blender/bmesh/operators/utils.c b/source/blender/bmesh/operators/utils.c index 55ab3cc0405..b6dcb4feb53 100644 --- a/source/blender/bmesh/operators/utils.c +++ b/source/blender/bmesh/operators/utils.c @@ -271,9 +271,15 @@ void bmesh_righthandfaces_exec(BMesh *bm, BMOperator *op) BM_Compute_Face_Center(bm, startf, cent); + /*make sure the starting face has the correct winding*/ if (cent[0]*startf->no[0] + cent[1]*startf->no[1] + cent[2]*startf->no[2] < 0.0) BM_flip_normal(bm, startf); + /*now that we've found our starting face, make all connected faces + have the same winding. this is done recursively, using a manual + stack (if we use simple function recursion, we'd end up overloading + the stack on large meshes).*/ + V_GROW(fstack); fstack[0] = startf; BMO_SetFlag(bm, startf, FACE_VIS); diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c index cba74f8d439..c008f1876f4 100644 --- a/source/blender/editors/mesh/bmesh_tools.c +++ b/source/blender/editors/mesh/bmesh_tools.c @@ -1743,5 +1743,5 @@ void MESH_OT_vertices_smooth(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - RNA_def_int(ot->srna, "repeat", 1, 1, 200, "How many times to smooth the mesh", "", 1, INT_MAX); + RNA_def_int(ot->srna, "repeat", 1, 1, 100, "Number of times to smooth the mesh", "", 1, INT_MAX); } |