diff options
author | Geoffrey Bantle <hairbat@yahoo.com> | 2006-05-16 07:40:36 +0400 |
---|---|---|
committer | Geoffrey Bantle <hairbat@yahoo.com> | 2006-05-16 07:40:36 +0400 |
commit | 563247f7a71ee785b741d77568bd5c9a56ee903c (patch) | |
tree | b8fe58a94ffb85b5c6f6043dc9ee191e2b9ba785 /source/blender/src/editmesh.c | |
parent | ac5ad70b7ce23dcf75026e7737901baa8699ce1f (diff) |
-> Sanity Check for Stored Selections
When a python script modified the selection state of a vertex, edge or face this could cause the creation of invalid EditSelection structures when entering editmode. Added a check to the function 'make_editmesh' to correct this.
Diffstat (limited to 'source/blender/src/editmesh.c')
-rw-r--r-- | source/blender/src/editmesh.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/source/blender/src/editmesh.c b/source/blender/src/editmesh.c index 0121ad18799..3bba88003d1 100644 --- a/source/blender/src/editmesh.c +++ b/source/blender/src/editmesh.c @@ -862,13 +862,17 @@ void make_editMesh() //restore editselections EM_init_index_arrays(1,1,1); mselect = me->mselect; + for(a=0; a<me->totselect; a++, mselect++){ - ese = MEM_callocN(sizeof(EditSelection), "Edit Selection"); - ese->type = mselect->type; - if(ese->type == EDITVERT) ese->data = EM_get_vert_for_index(mselect->index); else - if(ese->type == EDITEDGE) ese->data = EM_get_edge_for_index(mselect->index); else - if(ese->type == EDITFACE) ese->data = EM_get_face_for_index(mselect->index); - BLI_addtail(&(G.editMesh->selected),ese); + /*check if recorded selection is still valid, if so copy into editmesh*/ + if( (mselect->type == EDITVERT && me->mvert[mselect->index].flag & SELECT) || (mselect->type == EDITEDGE && me->medge[mselect->index].flag & SELECT) || (mselect->type == EDITFACE && me->mface[mselect->index].flag & SELECT) ){ + ese = MEM_callocN(sizeof(EditSelection), "Edit Selection"); + ese->type = mselect->type; + if(ese->type == EDITVERT) ese->data = EM_get_vert_for_index(mselect->index); else + if(ese->type == EDITEDGE) ese->data = EM_get_edge_for_index(mselect->index); else + if(ese->type == EDITFACE) ese->data = EM_get_face_for_index(mselect->index); + BLI_addtail(&(G.editMesh->selected),ese); + } } EM_free_index_arrays(); } @@ -1285,7 +1289,7 @@ void remake_editMesh(void) BIF_undo_push("Undo all changes"); } -/* *************** SEPARATE (partial exit editmode) *************/ +/* *************** (partial exit editmode) *************/ void separatemenu(void) |