meshes with nan verts could crash blender when building as mesh octree

This commit is contained in:
Campbell Barton
2008-02-17 18:50:45 +00:00
parent a221c3db97
commit afb3f0ec3a

View File

@@ -650,6 +650,13 @@ static void mesh_octree_add_nodes(MocNode **basetable, float *co, float *offs, f
float fx, fy, fz;
int vx, vy, vz;
if (isnan(co[0]) || !finite(co[0]) ||
isnan(co[1]) || !finite(co[1]) ||
isnan(co[2]) || !finite(co[2])
) {
return;
}
fx= (co[0]-offs[0])/div[0];
fy= (co[1]-offs[1])/div[1];
fz= (co[2]-offs[2])/div[2];
@@ -799,7 +806,7 @@ long mesh_octree_table(Object *ob, float *co, char mode)
if(ob==G.obedit) {
EditVert *eve;
for(eve= G.editMesh->verts.first; eve; eve= eve->next) {
mesh_octree_add_nodes(MeshOctree.table, eve->co, MeshOctree.offs, MeshOctree.div, (long)(eve));
}
@@ -861,6 +868,13 @@ EditVert *editmesh_get_x_mirror_vert(Object *ob, float *co)
float vec[3];
long poinval;
/* ignore nan verts */
if (isnan(co[0]) || !finite(co[0]) ||
isnan(co[1]) || !finite(co[1]) ||
isnan(co[2]) || !finite(co[2])
)
return NULL;
vec[0]= -co[0];
vec[1]= co[1];
vec[2]= co[2];