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:
authorCampbell Barton <ideasman42@gmail.com>2014-01-13 13:36:38 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-01-13 13:39:12 +0400
commit7ae1949517a41fbc46ca452f3fa40e7079273503 (patch)
tree64c329f903b2e9b70758c8dbf7789b71110bb94b /source/blender/editors/object/object_select.c
parentf0fb60f8c968f482cefd25db11d080c268c2045d (diff)
Select Random: add option to de-select
also made metaball operator behave like the others. Path originally from Walid Shouman, with own edits.
Diffstat (limited to 'source/blender/editors/object/object_select.c')
-rw-r--r--source/blender/editors/object/object_select.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index fc83919144f..8e7e97aad86 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -1128,23 +1128,14 @@ void OBJECT_OT_select_mirror(wmOperatorType *ot)
static int object_select_random_exec(bContext *C, wmOperator *op)
{
float percent;
- bool extend;
-
- extend = RNA_boolean_get(op->ptr, "extend");
-
- if (extend == false) {
- CTX_DATA_BEGIN (C, Base *, base, visible_bases)
- {
- ED_base_object_select(base, BA_DESELECT);
- }
- CTX_DATA_END;
- }
+ const bool select = (RNA_enum_get(op->ptr, "action") == SEL_SELECT);
+
percent = RNA_float_get(op->ptr, "percent") / 100.0f;
- CTX_DATA_BEGIN (C, Base *, base, visible_bases)
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
if (BLI_frand() < percent) {
- ED_base_object_select(base, BA_SELECT);
+ ED_base_object_select(base, select);
}
}
CTX_DATA_END;
@@ -1171,5 +1162,5 @@ void OBJECT_OT_select_random(wmOperatorType *ot)
/* properties */
RNA_def_float_percentage(ot->srna, "percent", 50.f, 0.0f, 100.0f, "Percent", "Percentage of objects to select randomly", 0.f, 100.0f);
- RNA_def_boolean(ot->srna, "extend", FALSE, "Extend Selection", "Extend selection instead of deselecting everything first");
+ WM_operator_properties_select_action_simple(ot, SEL_SELECT);
}