own error, recent commit that tried to keep an active face could crash when deleting faces.

This commit is contained in:
Campbell Barton 2008-07-18 13:05:15 +00:00
parent c216c980d3
commit 6786c517af
2 changed files with 5 additions and 9 deletions

@ -340,8 +340,9 @@ void free_editface(EditFace *efa)
#endif #endif
EM_remove_selection(efa, EDITFACE); EM_remove_selection(efa, EDITFACE);
if (G.editMesh->act_face==efa) if (G.editMesh->act_face==efa) {
EM_set_actFace(NULL); EM_set_actFace( G.editMesh->faces.first == efa ? NULL : G.editMesh->faces.first);
}
CustomData_em_free_block(&G.editMesh->fdata, &efa->data); CustomData_em_free_block(&G.editMesh->fdata, &efa->data);
if(efa->fast==0) if(efa->fast==0)
@ -1061,7 +1062,7 @@ void make_editMesh()
EM_fgon_flags(); EM_fgon_flags();
if (EM_get_actFace(0)==NULL) { if (EM_get_actFace(0)==NULL) {
EM_set_actFace(NULL); /* will use the first face, this is so we alwats have an active face */ EM_set_actFace( G.editMesh->faces.first ); /* will use the first face, this is so we alwats have an active face */
} }
/* vertex coordinates change with cache edit, need to recalc */ /* vertex coordinates change with cache edit, need to recalc */

@ -72,12 +72,7 @@ editmesh_lib: generic (no UI, no menus) operations/evaluators for editmesh data
/* this replaces the active flag used in uv/face mode */ /* this replaces the active flag used in uv/face mode */
void EM_set_actFace(EditFace *efa) void EM_set_actFace(EditFace *efa)
{ {
if (efa) { G.editMesh->act_face = efa;
G.editMesh->act_face = efa;
} else {
/* True or NULL if we have no faces, so we always have an active face */
G.editMesh->act_face = G.editMesh->faces.first;
}
} }
EditFace * EM_get_actFace(int sloppy) EditFace * EM_get_actFace(int sloppy)