diff options
author | Matt Ebb <matt@mke3.net> | 2004-01-03 12:22:33 +0300 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2004-01-03 12:22:33 +0300 |
commit | c9a7e4be1738e17fed741ee60482a697529e6251 (patch) | |
tree | f51032c1e6d470c76d60844df4aaed54551006d0 /source/blender/src/editmesh.c | |
parent | cf8b43a2c88faefd97565d997481c0f8db016574 (diff) |
* Ported mesh editmode 'select random' from tuhopuu by popular request
Description:
Mesh editmode header/toolbox: Select -> Random...
Randomly selects a user-set percentage of vertices, adding to the current selection.
* Modified some menu entries to be consistent with the guidelines doc.
* Added 'Align Active Camera to View' in 3D View menu
Diffstat (limited to 'source/blender/src/editmesh.c')
-rw-r--r-- | source/blender/src/editmesh.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/src/editmesh.c b/source/blender/src/editmesh.c index 6f6dbaf00e7..dbe2be1b27b 100644 --- a/source/blender/src/editmesh.c +++ b/source/blender/src/editmesh.c @@ -8709,3 +8709,37 @@ void select_less(void) allqueue(REDRAWVIEW3D, 0); } + + +void selectrandom_mesh(void) /* randomly selects a user-set % of vertices */ +{ + EditVert *eve; + int newsel = 0; /* to decide whether to redraw or not */ + short randfac = 50; + + if(G.obedit==0) return; + + /* Get the percentage of vertices to randomly select as 'randfac' */ + if(button(&randfac,0, 100,"Percentage:")==0) return; + + if(G.obedit->lay & G.vd->lay) { + eve= G.edve.first; + while(eve) { + BLI_srand( BLI_rand() ); /* random seed */ + if ( (BLI_frand() * 100) < randfac) { + eve->f |= SELECT; + newsel = 1; + } else { + /* Deselect other vertices + * + * - Commenting this out makes it add to the selection, + * rather than replace it. + * eve->f &= ~SELECT; + */ + } + eve= eve->next; + } + countall(); + allqueue(REDRAWVIEW3D, 0); + } +} |