diff options
author | Daniel Dunbar <daniel@zuster.org> | 2005-08-20 07:08:23 +0400 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2005-08-20 07:08:23 +0400 |
commit | a30740c1964059e1e6d3ca652da324ff0d505a1a (patch) | |
tree | e0104696db9dd12419f4efd4e456483997cab393 /source/blender/src/editview.c | |
parent | d81a5abf3252aff1f09c40bd5046700ddfe6676e (diff) |
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
Diffstat (limited to 'source/blender/src/editview.c')
-rw-r--r-- | source/blender/src/editview.c | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c index ce9ffad1bf0..c9e2a09c957 100644 --- a/source/blender/src/editview.c +++ b/source/blender/src/editview.c @@ -147,6 +147,20 @@ void EM_backbuf_checkAndSelectFaces(EditMesh *em, int select) } } +void EM_backbuf_checkAndSelectTFaces(Mesh *me, int select) +{ + TFace *tface = me->tface; + int a; + + if (tface) { + for(a=1; a<=me->totface; a++, tface++) { + if(EM_check_backbuf(a)) { + tface->flag = select?(tface->flag|TF_SELECT):(tface->flag&~TF_SELECT); + } + } + } +} + void arrows_move_cursor(unsigned short event) { short mval[2]; @@ -502,30 +516,22 @@ static void do_lasso_select_armature(short mcords[][2], short moves, short selec static void do_lasso_select_facemode(short mcords[][2], short moves, short select) { Mesh *me; - TFace *tface; rcti rect; - int a; me= get_mesh(OBACT); if(me==NULL || me->tface==NULL) return; if(me->totface==0) return; - tface= me->tface; em_vertoffs= me->totface+1; // max index array lasso_select_boundbox(&rect, mcords, moves); EM_mask_init_backbuf_border(mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax); - for(a=1; a<=me->totface; a++, tface++) { - if(EM_check_backbuf(a)) { - tface->flag = select?(tface->flag|TF_SELECT):(tface->flag&~TF_SELECT); - } - } + EM_backbuf_checkAndSelectTFaces(me, select); EM_free_backbuf(); - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWIMAGE, 0); + object_tface_flags_changed(OBACT, 0); } static void do_lasso_select(short mcords[][2], short moves, short select) @@ -1728,7 +1734,23 @@ static void mesh_selectionCB(int selecting, Object *editobj, short *mval, float struct { short select, mval[2]; float radius; } data; EditMesh *em = G.editMesh; int bbsel; - + + if(!G.obedit && (G.f&G_FACESELECT)) { + Mesh *me = get_mesh(OBACT); + + if (me) { + em_vertoffs= me->totface+1; // max index array + + bbsel= EM_init_backbuf_circle(mval[0], mval[1], (short)(rad+1.0)); + EM_backbuf_checkAndSelectTFaces(me, selecting==LEFTMOUSE); + EM_free_backbuf(); + + object_tface_flags_changed(OBACT, 0); + } + + return; + } + bbsel= EM_init_backbuf_circle(mval[0], mval[1], (short)(rad+1.0)); data.select = (selecting==LEFTMOUSE); |