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 #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; atotface; 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;