forked from bartvdbraak/blender
Fix boolean modifier crash; if boolean code cannot do the operation on the
meshes, print an error dialog and delete the modifier object.
This commit is contained in:
parent
71991cf41e
commit
9b419bb4be
@ -1210,9 +1210,15 @@ static void *booleanModifier_applyModifier(ModifierData *md, Object *ob, void *d
|
|||||||
if( ((Mesh *)ob->data)->totface>3 && bmd->object && ((Mesh *)bmd->object->data)->totface>3) {
|
if( ((Mesh *)ob->data)->totface>3 && bmd->object && ((Mesh *)bmd->object->data)->totface>3) {
|
||||||
DispListMesh *dlm= NewBooleanMeshDLM(bmd->object, ob, 1+bmd->operation);
|
DispListMesh *dlm= NewBooleanMeshDLM(bmd->object, ob, 1+bmd->operation);
|
||||||
|
|
||||||
return derivedmesh_from_displistmesh(dlm, NULL);
|
/* if new mesh returned, get derived mesh; otherwise there was
|
||||||
|
* an error, so delete the modifier object */
|
||||||
|
|
||||||
|
if( dlm )
|
||||||
|
return derivedmesh_from_displistmesh(dlm, NULL);
|
||||||
|
else
|
||||||
|
bmd->object = NULL;
|
||||||
}
|
}
|
||||||
else return derivedData;
|
return derivedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***/
|
/***/
|
||||||
|
@ -498,37 +498,48 @@ DispListMesh *NewBooleanMeshDLM(Object *ob, Object *ob_select, int int_op_type)
|
|||||||
InterpFaceVertexData
|
InterpFaceVertexData
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success) {
|
|
||||||
// descriptions of the output;
|
|
||||||
CSG_VertexIteratorDescriptor vd_o;
|
|
||||||
CSG_FaceIteratorDescriptor fd_o;
|
|
||||||
|
|
||||||
dlm = MEM_callocN(sizeof(*dlm),"dlm");
|
|
||||||
|
|
||||||
CSG_OutputFaceDescriptor(bool_op,&fd_o);
|
switch( success ) {
|
||||||
CSG_OutputVertexDescriptor(bool_op,&vd_o);
|
case 1:
|
||||||
|
{
|
||||||
|
// descriptions of the output;
|
||||||
|
CSG_VertexIteratorDescriptor vd_o;
|
||||||
|
CSG_FaceIteratorDescriptor fd_o;
|
||||||
|
|
||||||
|
dlm = MEM_callocN(sizeof(*dlm),"dlm");
|
||||||
|
|
||||||
// iterate through results of operation and insert into new object
|
CSG_OutputFaceDescriptor(bool_op,&fd_o);
|
||||||
|
CSG_OutputVertexDescriptor(bool_op,&vd_o);
|
||||||
|
|
||||||
ConvertCSGDescriptorsToDLM(
|
// iterate through results of operation and insert into new object
|
||||||
dlm,
|
|
||||||
NULL,
|
|
||||||
&output_mpd,
|
|
||||||
&fd_o,
|
|
||||||
&vd_o,
|
|
||||||
inv_mat
|
|
||||||
);
|
|
||||||
|
|
||||||
// free up the memory
|
ConvertCSGDescriptorsToDLM(
|
||||||
|
dlm,
|
||||||
|
NULL,
|
||||||
|
&output_mpd,
|
||||||
|
&fd_o,
|
||||||
|
&vd_o,
|
||||||
|
inv_mat
|
||||||
|
);
|
||||||
|
|
||||||
CSG_FreeVertexDescriptor(&vd_o);
|
// free up the memory
|
||||||
CSG_FreeFaceDescriptor(&fd_o);
|
|
||||||
|
CSG_FreeVertexDescriptor(&vd_o);
|
||||||
|
CSG_FreeFaceDescriptor(&fd_o);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case -1:
|
||||||
|
error("Selected meshes must have faces to perform boolean operations");
|
||||||
|
break;
|
||||||
|
case -2:
|
||||||
|
error("Both meshes must be closed");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
error("unknown internal error");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSG_FreeBooleanOperation(bool_op);
|
CSG_FreeBooleanOperation(bool_op);
|
||||||
bool_op = NULL;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We may need to map back the tfaces to mcols here.
|
// We may need to map back the tfaces to mcols here.
|
||||||
|
Loading…
Reference in New Issue
Block a user