diff options
author | Joseph Eagar <joeedh@gmail.com> | 2009-08-31 05:39:03 +0400 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2009-08-31 05:39:03 +0400 |
commit | 63051a87a30b0fc06f5b846477c02564efc42be7 (patch) | |
tree | 5ed5c076cebc2887092636f7125844de8b9d81b7 /source/blender/editors | |
parent | 2d9cee71a618ea946bb1194b39bb71b7fe37a060 (diff) |
nasty bug with BMINDEX_***, reminds me of why those two macros are two-edged sword in the first place; they weren't supposed to be in the api at all, but various porting needs unfortunately demanded them
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index b556ff907da..34b36c9b7c1 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2120,7 +2120,8 @@ static void createTransEditVerts(bContext *C, TransInfo *t) BMVert *eve_act = NULL; float *vectors = NULL, *mappedcos = NULL, *quats= NULL; float mtx[3][3], smtx[3][3], (*defmats)[3][3] = NULL, (*defcos)[3] = NULL; - int count=0, countsel=0, a, totleft; + int count=0, countsel=0, a, totleft, *selstate = NULL; + V_DECLARE(selstate); int propmode = t->flag & T_PROP_EDIT; int mirror = 0; @@ -2169,11 +2170,18 @@ static void createTransEditVerts(bContext *C, TransInfo *t) } } - /* now we can count */ + /* now we can count. we store selection state in selstate, since + get_crazy_mapped_editverts messes up the index state of the + verts*/ eve = BMIter_New(&iter, bm, BM_VERTS_OF_MESH, NULL); - for( ; eve; eve=BMIter_Step(&iter)) { - if(!BM_TestHFlag(eve, BM_HIDDEN)) { - if(BMINDEX_GET(eve)) countsel++; + for(a=0; eve; eve=BMIter_Step(&iter), a++) { + V_GROW(selstate); + + if(!BM_TestHFlag(eve, BM_HIDDEN)) { + if(BMINDEX_GET(eve)) { + selstate[a] = 1; + countsel++; + } if(propmode) count++; } } @@ -2233,8 +2241,8 @@ static void createTransEditVerts(bContext *C, TransInfo *t) /* find out which half we do */ if(mirror) { eve = BMIter_New(&iter, bm, BM_VERTS_OF_MESH, NULL); - for( ; eve; eve=BMIter_Step(&iter)) { - if(!BM_TestHFlag(eve, BM_HIDDEN) && BMINDEX_GET(eve) && eve->co[0]!=0.0f) { + for(a=0; eve; eve=BMIter_Step(&iter), a++) { + if(!BM_TestHFlag(eve, BM_HIDDEN) && selstate[a] && eve->co[0]!=0.0f) { if(eve->co[0]<0.0f) mirror = -1; break; @@ -2245,11 +2253,11 @@ static void createTransEditVerts(bContext *C, TransInfo *t) eve = BMIter_New(&iter, bm, BM_VERTS_OF_MESH, NULL); for(a=0; eve; eve=BMIter_Step(&iter), a++) { if(!BM_TestHFlag(eve, BM_HIDDEN)) { - if(propmode || BMINDEX_GET(eve)) { + if(propmode || selstate[a]) { VertsToTransData(t, tob, bm, eve); /* selected */ - if(BMINDEX_GET(eve)) tob->flag |= TD_SELECTED; + if(selstate[a]) tob->flag |= TD_SELECTED; /* active */ if(eve == eve_act) tob->flag |= TD_ACTIVE; @@ -2313,11 +2321,14 @@ static void createTransEditVerts(bContext *C, TransInfo *t) MEM_freeN(vectors); MEM_freeN(nears); } + /* crazy space free */ if(quats) MEM_freeN(quats); if(defmats) MEM_freeN(defmats); + + V_FREE(selstate); } /* *** NODE EDITOR *** */ |