Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Hnidek <jiri.hnidek@tul.cz>2007-06-08 18:17:13 +0400
committerJiri Hnidek <jiri.hnidek@tul.cz>2007-06-08 18:17:13 +0400
commitd1711b39729230aeb09f824a44c9303eb07d9363 (patch)
tree5d0f898c96d1087fe5e79cf08c5db93003535187 /source/blender/src/editmball.c
parentdc8a10bf58f7393923dc075bc9d707f8fddc9e3d (diff)
Patch [#6729] from Juho Vepsäläinen. It adds inverse and random select for metaelems. I simplified random select a little.
Diffstat (limited to 'source/blender/src/editmball.c')
-rw-r--r--source/blender/src/editmball.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/source/blender/src/editmball.c b/source/blender/src/editmball.c
index 91f0f25ec60..06b2e8b5dd7 100644
--- a/source/blender/src/editmball.c
+++ b/source/blender/src/editmball.c
@@ -30,6 +30,7 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
+#include <math.h>
#include <string.h>
#ifdef HAVE_CONFIG_H
@@ -40,6 +41,7 @@
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
+#include "BLI_rand.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
@@ -251,6 +253,43 @@ void deselectall_mball()
BIF_undo_push("Deselect MetaElem");
}
+/* inverts metaball selection */
+void selectinverse_mball()
+{
+ MetaElem *ml;
+
+ ml= editelems.first;
+ while(ml) {
+ if(ml->flag & SELECT) ml->flag &= ~SELECT;
+ else ml->flag |= SELECT;
+ ml= ml->next;
+ }
+
+ allqueue(REDRAWVIEW3D, 0);
+ countall();
+ BIF_undo_push("Invert MetaElem");
+}
+
+/* select random metaball selection */
+void selectrandom_mball()
+{
+ MetaElem *ml;
+ static short randfac= 50;
+
+ if(!button(&randfac,0, 100,"Percentage:")) return;
+
+ ml= editelems.first;
+ BLI_srand( BLI_rand() ); /* random seed */
+ while(ml) {
+ if((BLI_frand() * 100) < randfac) ml->flag |= SELECT;
+ ml= ml->next;
+ }
+
+ allqueue(REDRAWVIEW3D, 0);
+ countall();
+ BIF_undo_push("Random MetaElem");
+}
+
/* select MetaElement with mouse click (user can select radius circle or
* stiffness circle) */
void mouse_mball()