Patch [#20290] by Bjørnar Hansen for bug [#20270] 2.5a0, Select Random says percent...
authorMartin Poirier <theeth@yahoo.com>
Wed, 9 Dec 2009 21:42:21 +0000 (21:42 +0000)
committerMartin Poirier <theeth@yahoo.com>
Wed, 9 Dec 2009 21:42:21 +0000 (21:42 +0000)
source/blender/editors/mesh/editmesh_mods.c
source/blender/editors/object/object_select.c

index e7986d227cfbf6ca9131e7aad3ef3f021be35d91..30dc61140979cdd2571b680bc39de60ea62d3c03 100644 (file)
@@ -3629,7 +3629,7 @@ static int mesh_select_random_exec(bContext *C, wmOperator *op)
        if(!RNA_boolean_get(op->ptr, "extend"))
                EM_deselect_all(em);
        
-       selectrandom_mesh(em, RNA_float_get(op->ptr, "percentage")/100.0f);
+       selectrandom_mesh(em, RNA_float_get(op->ptr, "percent")/100.0f);
                
        WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
        
@@ -3652,8 +3652,8 @@ void MESH_OT_select_random(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* props */
-       RNA_def_float_percentage(ot->srna, "percentage", 50.f, 0.0f, 100.0f, "Percentage", "Percentage of elements to select randomly.", 0.f, 100.0f);
-       RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "");
+       RNA_def_float_percentage(ot->srna, "percent", 50.f, 0.0f, 100.0f, "Percent", "Percentage of elements to select randomly.", 0.f, 100.0f);
+       RNA_def_boolean(ot->srna, "extend", FALSE, "Extend Selection", "Extend selection instead of deselecting everything first.");
 }
 
 void EM_select_by_material(EditMesh *em, int index) 
index 5366446c8ae5ce1f329324ad5a78f48ec7693257..a0223997cfbe45aaf24396b631985546e6b242a3 100644 (file)
@@ -996,11 +996,11 @@ static int object_select_random_exec(bContext *C, wmOperator *op)
                }
                CTX_DATA_END;
        }
-       percent = RNA_float_get(op->ptr, "percent");
+       percent = RNA_float_get(op->ptr, "percent")/100.0f;
                
        CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
                if (BLI_frand() < percent) {
-                               ED_base_object_select(base, BA_SELECT);
+                       ED_base_object_select(base, BA_SELECT);
                }
        }
        CTX_DATA_END;
@@ -1013,7 +1013,7 @@ static int object_select_random_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_select_random(wmOperatorType *ot)
 {
        /* identifiers */
-       ot->name= "Random select";
+       ot->name= "Select Random";
        ot->description = "Set select on random visible objects.";
        ot->idname= "OBJECT_OT_select_random";
        
@@ -1026,8 +1026,8 @@ void OBJECT_OT_select_random(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* properties */
-       RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first.");
-       RNA_def_float_percentage(ot->srna, "percent", 0.5f, 0.0f, 1.0f, "Percent", "percentage of objects to randomly select", 0.0001f, 1.0f);
+       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.");
 }