diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2004-04-08 22:58:32 +0400 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2004-04-08 22:58:32 +0400 |
commit | 235c93e714b31fafc32f526c92ddc8cf339fb874 (patch) | |
tree | 66b53823ab0f7a5c7d66ebd7701652ee773cb4d1 /source/blender/src/booleanops.c | |
parent | a9b1cd6a0e1d8054d38279ab4b657fab62e6df43 (diff) |
Fix for bug #1065: boolean ops with meshes containing 0 faces crashed on Linux and OSX.
Check first if meshes have faces, otherwise don't do boolean op.
(see: http://projects.blender.org/tracker/index.php?func=detail&aid=1065&group_id=9&atid=125)
Diffstat (limited to 'source/blender/src/booleanops.c')
-rw-r--r-- | source/blender/src/booleanops.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/source/blender/src/booleanops.c b/source/blender/src/booleanops.c index 2d6fe1b1f19..6edcf206870 100644 --- a/source/blender/src/booleanops.c +++ b/source/blender/src/booleanops.c @@ -64,10 +64,15 @@ #include "BLI_linklist.h" #include "BLI_memarena.h" +#include "BIF_editmesh.h" + #ifdef HAVE_CONFIG_H #include <config.h> #endif +/** check if passed mesh has faces, return zero if only edges, 1 if faces have been found */ +int has_faces(Mesh *me); + /** * Here's the vertex iterator structure used to walk through * the blender vertex structure. @@ -360,15 +365,23 @@ InterpFaceVertexData( return 0; } +int has_faces(Mesh *me) +{ + MFace *mface; + int a; + mface= me->mface; + for(a=0; a<me->totface; a++, mface++) { + if(mface->v3) return 1; + } + return 0; +} /** * Assumes mesh is valid and forms part of a fresh * blender object. */ - - int NewBooleanMesh( struct Base * base, @@ -398,6 +411,13 @@ NewBooleanMesh( if (me == NULL || me2 == NULL) return 0; + success = has_faces(me); + if(success==0) return 0; + success = has_faces(me2); + if(success==0) return 0; + + success = 0; + switch (int_op_type) { case 1 : op_type = e_csg_intersection; break; case 2 : op_type = e_csg_union; break; |