diff options
author | Ton Roosendaal <ton@blender.org> | 2004-11-28 22:48:53 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2004-11-28 22:48:53 +0300 |
commit | f11c448cab75c397fcd7f330c0997cf95f7f549d (patch) | |
tree | 953174d3f6c2be40edf2fbf4c1a813581e2df76f /source/blender/src/editview.c | |
parent | 12795fede80fb9948a53eb465defd60e00777a2e (diff) |
Fixed something that annoyed me for ages;
In Object mode, Solid drawing, selection was just always not what you
wanted, the rules for wireframe (cycling) can't be used then.
New rule is;
- it always selects the frontmost visible item (wires in solid too), unless
- frontmost is active already, then it picks the 2nd
- mouse didnt move 2 pixels while selecting, then it starts cycling
Works nice :)
Diffstat (limited to 'source/blender/src/editview.c')
-rw-r--r-- | source/blender/src/editview.c | 68 |
1 files changed, 52 insertions, 16 deletions
diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c index eae69683433..6f0d6f6d395 100644 --- a/source/blender/src/editview.c +++ b/source/blender/src/editview.c @@ -633,7 +633,7 @@ int gesture(void) if(G.qual & LR_CTRLKEY) { if(G.obedit==NULL) { if(G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT)) return 0; - if(G.obpose) return; + if(G.obpose) return 0; } lasso= 1; } @@ -1008,7 +1008,7 @@ void mouse_select(void) int temp, a, dist=100; short hits, mval[2]; - /* always start list from basact */ + /* always start list from basact in wire mode */ startbase= FIRSTBASE; if(BASACT && BASACT->next) startbase= BASACT->next; @@ -1046,25 +1046,61 @@ void mouse_select(void) if(hits==0) hits= selectprojektie(buffer, mval[0]-21, mval[1]-21, mval[0]+21, mval[1]+21); if(hits>0) { - + if(G.qual & LR_ALTKEY) basact= mouse_select_menu(buffer, hits, mval); else { - base= startbase; - while(base) { - if(base->lay & G.vd->lay) { - for(a=0; a<hits; a++) { - /* index was converted */ - if(base->selcol==buffer[ (4 * a) + 3 ]) { - basact= base; - } - } + static short lastmval[2]={-100, -100}; + int donearest= 0; + + /* define if we use solid nearest select or not */ + if(G.vd->drawtype>OB_WIRE) { + donearest= 1; + if( ABS(mval[0]-lastmval[0])<3 && ABS(mval[1]-lastmval[1])<3) { + donearest= 0; } + } + lastmval[0]= mval[0]; lastmval[1]= mval[1]; + + if(donearest) { + unsigned int min= 0xFFFFFFFF; + int selcol= 0, notcol=0; + if(BASACT) notcol= BASACT->selcol; - if(basact) break; + for(a=0; a<hits; a++) { + /* index was converted */ + if( min > buffer[4*a+1] && notcol!=buffer[4*a+3]) { + min= buffer[4*a+1]; + selcol= buffer[4*a+3]; + } + } + base= FIRSTBASE; + while(base) { + if(base->lay & G.vd->lay) { + if(base->selcol==selcol) break; + } + base= base->next; + } + if(base) basact= base; + } + else { - base= base->next; - if(base==0) base= FIRSTBASE; - if(base==startbase) break; + base= startbase; + while(base) { + if(base->lay & G.vd->lay) { + for(a=0; a<hits; a++) { + /* index was converted */ + if(base->selcol==buffer[(4*a)+3]) { + basact= base; + } + } + } + + if(basact) break; + + base= base->next; + if(base==0) base= FIRSTBASE; + if(base==startbase) break; + } } } } |