2.5
authorMichael Fox <mfoxdogg@gmail.com>
Tue, 30 Dec 2008 03:38:18 +0000 (03:38 +0000)
committerMichael Fox <mfoxdogg@gmail.com>
Tue, 30 Dec 2008 03:38:18 +0000 (03:38 +0000)
*******

Small commit, moved selection Operators to Object editor (object_edit.c) as per kaito's request

- normal selection and border/circle select are still in view3d as they depend too much on view3d

source/blender/editors/object/object_edit.c
source/blender/editors/object/object_intern.h
source/blender/editors/object/object_ops.c
source/blender/editors/space_view3d/view3d_intern.h
source/blender/editors/space_view3d/view3d_ops.c
source/blender/editors/space_view3d/view3d_select.c

index 4e32c6a..f3cd39b 100644 (file)
@@ -1026,7 +1026,213 @@ void OBJECT_OT_clear_parent(wmOperatorType *ot)
 }
 
 /* ***************************** */
+/* ****** Select by Type ****** */
+static EnumPropertyItem prop_select_object_types[] = {
+       {OB_EMPTY, "EMPTY", "Empty", ""},
+       {OB_MESH, "MESH", "Mesh", ""},
+       {OB_CURVE, "CURVE", "Curve", ""},
+       {OB_SURF, "SURFACE", "Surface", ""},
+       {OB_FONT, "TEXT", "Text", ""},
+       {OB_MBALL, "META", "Meta", ""},
+       {OB_LAMP, "LAMP", "Lamp", ""},
+       {OB_CAMERA, "CAMERA", "Camera", ""},
+       {OB_LATTICE, "LATTICE", "Lattice", ""},
+       {0, NULL, NULL, NULL}
+};
+
+static int object_select_by_type_exec(bContext *C, wmOperator *op)
+{
+       short obtype;
+       
+       obtype = RNA_enum_get(op->ptr, "type");
+               
+       CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+               if(base->object->type==obtype) {
+                       ED_base_object_select(base, BA_SELECT);
+               }
+       }
+       CTX_DATA_END;
+       
+       /* undo? */
+       WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+       
+       return OPERATOR_FINISHED;
+}
 
+void OBJECT_OT_select_by_type(wmOperatorType *ot)
+{
+       PropertyRNA *prop;
+       
+       /* identifiers */
+       ot->name= "Select By Type";
+       ot->idname= "OBJECT_OT_select_by_type";
+       
+       /* api callbacks */
+       ot->invoke= WM_menu_invoke;
+       ot->exec= object_select_by_type_exec;
+       ot->poll= ED_operator_view3d_active;
+       
+       prop = RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_items(prop, prop_select_object_types);
+
+}
+
+/* ****** selection by layer *******/
+
+static int object_select_by_layer_exec(bContext *C, wmOperator *op)
+{
+       unsigned int layernum;
+       
+       layernum = RNA_int_get(op->ptr, "layer");
+               
+       CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+               if(base->lay == (1<< (layernum -1)))
+                       ED_base_object_select(base, BA_SELECT);
+       }
+       CTX_DATA_END;
+       
+       /* undo? */
+       WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+       
+       return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_select_by_layer(wmOperatorType *ot)
+{
+       PropertyRNA *prop;
+       
+       /* identifiers */
+       ot->name= "Selection by layer";
+       ot->idname= "OBJECT_OT_select_by_layer";
+       
+       /* api callbacks */
+       /*ot->invoke = XXX - need a int grid popup*/
+       ot->exec= object_select_by_layer_exec;
+       ot->poll= ED_operator_view3d_active;
+       
+       prop = RNA_def_property(ot->srna, "layer", PROP_INT, PROP_UNSIGNED);
+       RNA_def_property_ui_range(prop, 1, 20,1, 1);
+       RNA_def_property_ui_text(prop, "layer", "The layer to select objects in");
+       RNA_def_property_int_default(prop, 2);
+
+}
+
+/* ****** invert selection *******/
+static int object_select_invert_exec(bContext *C, wmOperator *op)
+{
+       ScrArea *sa= CTX_wm_area(C);
+       View3D *v3d= sa->spacedata.first;
+               
+       CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+               if (base->flag & SELECT)
+                       ED_base_object_select(base, BA_DESELECT);
+               else
+                       ED_base_object_select(base, BA_SELECT);
+       }
+       CTX_DATA_END;
+       
+       /* undo? */
+       WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+       
+       return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_select_invert(wmOperatorType *ot)
+{
+       
+       /* identifiers */
+       ot->name= "Invert selection";
+       ot->idname= "OBJECT_OT_select_invert";
+       
+       /* api callbacks */
+       ot->exec= object_select_invert_exec;
+       ot->poll= ED_operator_view3d_active;
+
+}
+/* ****** (de)select All *******/
+
+static int object_de_select_all_exec(bContext *C, wmOperator *op)
+{
+       ScrArea *sa= CTX_wm_area(C);
+       View3D *v3d= sa->spacedata.first;
+       int a=0, ok=0; 
+       
+       CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+               if (base->flag & SELECT) {
+                       ok= a= 1;
+                       break;
+               }
+               else ok=1;
+       }
+       CTX_DATA_END;
+       
+       if (!ok) return OPERATOR_PASS_THROUGH;
+       
+       CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+               if (a) ED_base_object_select(base, BA_DESELECT);
+               else ED_base_object_select(base, BA_SELECT);
+       }
+       CTX_DATA_END;
+       
+       /* undo? */
+       WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+       
+       return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_de_select_all(wmOperatorType *ot)
+{
+       
+       /* identifiers */
+       ot->name= "deselect all";
+       ot->idname= "OBJECT_OT_de_select_all";
+       
+       /* api callbacks */
+       ot->exec= object_de_select_all_exec;
+       ot->poll= ED_operator_view3d_active;
+
+}
+/* ****** random selection *******/
+
+static int object_select_random_exec(bContext *C, wmOperator *op)
+{      
+       ScrArea *sa= CTX_wm_area(C);
+       View3D *v3d= sa->spacedata.first;
+       int percent;
+       
+       percent = RNA_int_get(op->ptr, "percent");
+               
+       CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+               if ((!base->flag & SELECT && (BLI_frand() * 100) < percent)) {
+                               ED_base_object_select(base, BA_SELECT);
+               }
+       }
+       CTX_DATA_END;
+       
+       /* undo? */
+       WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+       
+       return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_select_random(wmOperatorType *ot)
+{
+       PropertyRNA *prop;
+       
+       /* identifiers */
+       ot->name= "Random selection";
+       ot->idname= "OBJECT_OT_select_random";
+       
+       /* api callbacks */
+       /*ot->invoke= object_select_random_invoke XXX - need a number popup ;*/
+       ot->exec = object_select_random_exec;
+       ot->poll= ED_operator_view3d_active;
+       
+       prop = RNA_def_property(ot->srna, "percent", PROP_INT, PROP_NONE);
+       RNA_def_property_ui_range(prop, 1, 100,1, 1);
+       RNA_def_property_ui_text(prop, "Percent", "Max persentage that will be selected");
+       RNA_def_property_int_default(prop, 50);
+}
 void clear_track(Scene *scene, View3D *v3d)
 {
        Base *base;
index adbf459..fac827d 100644 (file)
 /* object_edit.c */
 void OBJECT_OT_make_parent(wmOperatorType *ot);
 void OBJECT_OT_clear_parent(wmOperatorType *ot);
+void OBJECT_OT_de_select_all(struct wmOperatorType *ot);
+void OBJECT_OT_select_invert(struct wmOperatorType *ot);
+void OBJECT_OT_select_random(struct wmOperatorType *ot);
+void OBJECT_OT_select_by_type(struct wmOperatorType *ot);
+void OBJECT_OT_select_by_layer(struct wmOperatorType *ot);
+
+
 
 #endif /* ED_OBJECT_INTERN_H */
 
index c4f1120..12846ea 100644 (file)
@@ -64,6 +64,11 @@ void ED_operatortypes_object(void)
 {
        WM_operatortype_append(OBJECT_OT_make_parent);
        WM_operatortype_append(OBJECT_OT_clear_parent);
+       WM_operatortype_append(OBJECT_OT_select_invert);
+       WM_operatortype_append(OBJECT_OT_select_random);
+       WM_operatortype_append(OBJECT_OT_de_select_all);
+       WM_operatortype_append(OBJECT_OT_select_by_type);
+       WM_operatortype_append(OBJECT_OT_select_by_layer);
        
 }
 
@@ -72,6 +77,11 @@ void ED_keymap_object(wmWindowManager *wm)
 {
        ListBase *keymap= WM_keymap_listbase(wm, "View3D Object", SPACE_VIEW3D, 0);
        
+       WM_keymap_add_item(keymap, "OBJECT_OT_de_select_all",AKEY, KM_PRESS, 0, 0);
+       WM_keymap_add_item(keymap, "OBJECT_OT_select_invert", IKEY, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_add_item(keymap, "OBJECT_OT_select_random",PADASTERKEY, KM_PRESS, 0, 0);
+       WM_keymap_add_item(keymap, "OBJECT_OT_select_by_type",PADASTERKEY, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_add_item(keymap, "OBJECT_OT_select_by_layer",PADASTERKEY, KM_PRESS, KM_ALT, 0);
        WM_keymap_verify_item(keymap, "OBJECT_OT_make_parent", PKEY, KM_PRESS, KM_CTRL, 0);
        WM_keymap_verify_item(keymap, "OBJECT_OT_clear_parent", PKEY, KM_PRESS, KM_ALT, 0);
        
index 1c4bae5..ecab49d 100644 (file)
@@ -118,13 +118,9 @@ void view3d_update_depths(ARegion *ar, View3D *v3d);
 
 /* view3d_select.c */
 void VIEW3D_OT_select(struct wmOperatorType *ot);
-void VIEW3D_OT_de_select_all(struct wmOperatorType *ot);
-void VIEW3D_OT_select_invert(struct wmOperatorType *ot);
-void VIEW3D_OT_select_random(struct wmOperatorType *ot);
-void VIEW3D_OT_select_by_type(struct wmOperatorType *ot);
-void VIEW3D_OT_select_by_layer(struct wmOperatorType *ot);
-void VIEW3D_OT_borderselect(struct wmOperatorType *ot);
+void VIEW3D_OT_select_extend(struct wmOperatorType *ot);
 void VIEW3D_OT_circle_select(struct wmOperatorType *ot);
+void VIEW3D_OT_borderselect(struct wmOperatorType *ot);
 
 /* view3d_view.c */
 void VIEW3D_OT_smoothview(struct wmOperatorType *ot);
index e20752e..debbf9c 100644 (file)
@@ -70,11 +70,7 @@ void view3d_operatortypes(void)
        WM_operatortype_append(VIEW3D_OT_viewnumpad);
        WM_operatortype_append(VIEW3D_OT_viewcenter);
        WM_operatortype_append(VIEW3D_OT_select);
-       WM_operatortype_append(VIEW3D_OT_select_invert);
-       WM_operatortype_append(VIEW3D_OT_select_random);
-       WM_operatortype_append(VIEW3D_OT_de_select_all);
-       WM_operatortype_append(VIEW3D_OT_select_by_type);
-       WM_operatortype_append(VIEW3D_OT_select_by_layer);
+       WM_operatortype_append(VIEW3D_OT_select_extend);
        WM_operatortype_append(VIEW3D_OT_borderselect);
        WM_operatortype_append(VIEW3D_OT_clipping);
        WM_operatortype_append(VIEW3D_OT_circle_select);
@@ -126,14 +122,14 @@ void view3d_keymap(wmWindowManager *wm)
 
        /* selection*/
        WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
-       WM_keymap_add_item(keymap, "VIEW3D_OT_de_select_all",AKEY, KM_PRESS, 0, 0);
-       WM_keymap_add_item(keymap, "VIEW3D_OT_select_invert", IKEY, KM_PRESS, KM_CTRL, 0);
-       WM_keymap_add_item(keymap, "VIEW3D_OT_select_random",PADASTERKEY, KM_PRESS, 0, 0);
-       WM_keymap_add_item(keymap, "VIEW3D_OT_select_by_type",PADASTERKEY, KM_PRESS, KM_CTRL, 0);
-       WM_keymap_add_item(keymap, "VIEW3D_OT_select_by_layer",PADASTERKEY, KM_PRESS, KM_ALT, 0);
        WM_keymap_add_item(keymap, "VIEW3D_OT_borderselect", BKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "VIEW3D_OT_circle_select", CKEY, KM_PRESS, 0, 0);
        
+       /* select extend*/      
+       RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select_extend", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "modifier", KM_SHIFT);
+       RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select_extend", SELECTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "modifier", KM_CTRL);
+       RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select_extend", SELECTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "modifier", KM_ALT);
+       
        WM_keymap_add_item(keymap, "VIEW3D_OT_clipping", BKEY, KM_PRESS, KM_ALT, 0);
        WM_keymap_add_item(keymap, "VIEW3D_OT_render_border", BKEY, KM_PRESS, KM_SHIFT, 0);
 
index 1f8910d..6464ed4 100644 (file)
@@ -845,7 +845,7 @@ static short mixed_bones_object_selectbuffer(Scene *scene, ARegion *ar, View3D *
 }
 
 /* mval is region coords */
-static void mouse_select(bContext *C, short *mval)
+static void mouse_select(bContext *C, short *mval, short modifier)
 {
        ARegion *ar= CTX_wm_region(C);
        View3D *v3d= (View3D *)CTX_wm_space_data(C);
@@ -861,10 +861,10 @@ static void mouse_select(bContext *C, short *mval)
        if(BASACT && BASACT->next) startbase= BASACT->next;
        
        /* This block uses the control key to make the object selected by its center point rather then its contents */
-       if(G.obedit==0 && ctrl) {
+       if(G.obedit==0 && modifier == KM_CTRL) {
                
                /* note; shift+alt goes to group-flush-selecting */
-               if(alt && ctrl
+               if(modifier == KM_ALT && modifier == KM_CTRL
                        basact= mouse_select_menu(scene, ar, v3d, NULL, 0, mval);
                else {
                        base= startbase;
@@ -898,7 +898,7 @@ static void mouse_select(bContext *C, short *mval)
                        for(a=0; a<hits; a++) if(buffer[4*a+3] & 0xFFFF0000) has_bones= 1;
 
                        /* note; shift+alt goes to group-flush-selecting */
-                       if(has_bones==0 && (alt)) 
+                       if(has_bones==0 && (modifier == KM_ALT)) 
                                basact= mouse_select_menu(scene, ar, v3d, buffer, hits, mval);
                        else {
                                static short lastmval[2]={-100, -100};
@@ -1025,11 +1025,11 @@ static void mouse_select(bContext *C, short *mval)
                        oldbasact= BASACT;
                        BASACT= basact;
                        
-                       if(shift==0) {
+                       if(modifier != KM_SHIFT) {
                                deselectall_except(scene, basact);
                                ED_base_object_select(basact, BA_SELECT);
                        }
-                       else if(shift && alt) {
+                       else if(modifier == KM_CTRL && modifier == KM_ALT) {
                                // XXX select_all_from_groups(basact);
                        }
                        else {
@@ -1443,7 +1443,7 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
        view3d_operator_needs_opengl(C);
        
-       mouse_select(C, mval);
+       mouse_select(C, mval, NULL);
        
        return OPERATOR_FINISHED;
 }
@@ -1460,214 +1460,48 @@ void VIEW3D_OT_select(wmOperatorType *ot)
        ot->poll= ED_operator_view3d_active;
 
 }
-
-/* ****** Select by Type ****** */
-static EnumPropertyItem prop_select_object_types[] = {
-       {OB_EMPTY, "EMPTY", "Empty", ""},
-       {OB_MESH, "MESH", "Mesh", ""},
-       {OB_CURVE, "CURVE", "Curve", ""},
-       {OB_SURF, "SURFACE", "Surface", ""},
-       {OB_FONT, "TEXT", "Text", ""},
-       {OB_MBALL, "META", "Meta", ""},
-       {OB_LAMP, "LAMP", "Lamp", ""},
-       {OB_CAMERA, "CAMERA", "Camera", ""},
-       {OB_LATTICE, "LATTICE", "Lattice", ""},
+static EnumPropertyItem prop_select_extend_types[] = {
+       {KM_SHIFT, "SHIFT", "Shift", ""},
+       {KM_CTRL, "CTRL", "Ctrl", ""},
+       {KM_ALT, "ALT", "Alt", ""},
        {0, NULL, NULL, NULL}
 };
 
-static int view3d_select_by_type_exec(bContext *C, wmOperator *op)
-{
-       short obtype;
-       
-       obtype = RNA_enum_get(op->ptr, "type");
-               
-       CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
-               if(base->object->type==obtype) {
-                       ED_base_object_select(base, BA_SELECT);
-               }
-       }
-       CTX_DATA_END;
-       
-       /* undo? */
-       WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
-       
-       return OPERATOR_FINISHED;
-}
-
-void VIEW3D_OT_select_by_type(wmOperatorType *ot)
+static int view3d_select_extend_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-       PropertyRNA *prop;
-       
-       /* identifiers */
-       ot->name= "Select By Type";
-       ot->idname= "VIEW3D_OT_select_by_type";
-       
-       /* api callbacks */
-       ot->invoke= WM_menu_invoke;
-       ot->exec= view3d_select_by_type_exec;
-       ot->poll= ED_operator_view3d_active;
+       ARegion *ar= CTX_wm_region(C);
+       short mval[2], modifier;        
        
-       prop = RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_items(prop, prop_select_object_types);
-
-}
-
-/* ****** selection by layer *******/
+       mval[0]= event->x - ar->winrct.xmin;
+       mval[1]= event->y - ar->winrct.ymin;
 
-static int view3d_select_by_layer_exec(bContext *C, wmOperator *op)
-{
-       unsigned int layernum;
+       modifier = RNA_enum_get(op->ptr, "modifier");
        
-       layernum = RNA_int_get(op->ptr, "layer");
-               
-       CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
-               if(base->lay == (1<< (layernum -1)))
-                       ED_base_object_select(base, BA_SELECT);
-       }
-       CTX_DATA_END;
+       view3d_operator_needs_opengl(C);        
        
-       /* undo? */
-       WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+       mouse_select(C, mval, modifier);
        
        return OPERATOR_FINISHED;
 }
 
-void VIEW3D_OT_select_by_layer(wmOperatorType *ot)
+void VIEW3D_OT_select_extend(wmOperatorType *ot)
 {
        PropertyRNA *prop;
        
        /* identifiers */
-       ot->name= "Selection by layer";
-       ot->idname= "VIEW3D_OT_select_by_layer";
+       ot->name= "Activate/Select Extend";
+       ot->idname= "VIEW3D_OT_select_extend";
        
        /* api callbacks */
-       /*ot->invoke = XXX - need a int grid popup*/
-       ot->exec= view3d_select_by_layer_exec;
-       ot->poll= ED_operator_view3d_active;
-       
-       prop = RNA_def_property(ot->srna, "layer", PROP_INT, PROP_UNSIGNED);
-       RNA_def_property_ui_range(prop, 1, 20,1, 1);
-       RNA_def_property_ui_text(prop, "layer", "The layer to select objects in");
-       RNA_def_property_int_default(prop, 2);
-
-}
-
-/* ****** invert selection *******/
-static int view3d_select_invert_exec(bContext *C, wmOperator *op)
-{
-       ScrArea *sa= CTX_wm_area(C);
-       View3D *v3d= sa->spacedata.first;
-               
-       CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
-               if (TESTBASE(v3d, base))
-                       ED_base_object_select(base, BA_DESELECT);
-               else
-                       ED_base_object_select(base, BA_SELECT);
-       }
-       CTX_DATA_END;
-       
-       /* undo? */
-       WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
-       
-       return OPERATOR_FINISHED;
-}
-
-void VIEW3D_OT_select_invert(wmOperatorType *ot)
-{
-       
-       /* identifiers */
-       ot->name= "Invert selection";
-       ot->idname= "VIEW3D_OT_select_invert";
-       
-       /* api callbacks */
-       ot->exec= view3d_select_invert_exec;
-       ot->poll= ED_operator_view3d_active;
-
-}
-/* ****** (de)select All *******/
-
-static int view3d_de_select_all_exec(bContext *C, wmOperator *op)
-{
-       ScrArea *sa= CTX_wm_area(C);
-       View3D *v3d= sa->spacedata.first;
-       int a=0, ok=0; 
-       
-       CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
-               if (TESTBASE(v3d, base)) {
-                       ok= a= 1;
-                       break;
-               }
-               else ok=1;
-       }
-       CTX_DATA_END;
-       
-       if (!ok) return OPERATOR_PASS_THROUGH;
-       
-       CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
-               if (a) ED_base_object_select(base, BA_DESELECT);
-               else ED_base_object_select(base, BA_SELECT);
-       }
-       CTX_DATA_END;
-       
-       /* undo? */
-       WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
-       
-       return OPERATOR_FINISHED;
-}
-
-void VIEW3D_OT_de_select_all(wmOperatorType *ot)
-{
-       
-       /* identifiers */
-       ot->name= "deselect all";
-       ot->idname= "VIEW3D_OT_de_select_all";
+       ot->invoke= view3d_select_invoke;
+       ot->poll= ED_operator_view3d_active;    
        
-       /* api callbacks */
-       ot->exec= view3d_de_select_all_exec;
-       ot->poll= ED_operator_view3d_active;
+       prop = RNA_def_property(ot->srna, "modifier", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_items(prop, prop_select_extend_types);
 
 }
-/* ****** random selection *******/
 
-static int view3d_select_random_exec(bContext *C, wmOperator *op)
-{      
-       ScrArea *sa= CTX_wm_area(C);
-       View3D *v3d= sa->spacedata.first;
-       int percent;
-       
-       percent = RNA_int_get(op->ptr, "percent");
-               
-       CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
-               if ((!TESTBASE(v3d, base) && (BLI_frand() * 100) < percent)) {
-                               ED_base_object_select(base, BA_SELECT);
-               }
-       }
-       CTX_DATA_END;
-       
-       /* undo? */
-       WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
-       
-       return OPERATOR_FINISHED;
-}
 
-void VIEW3D_OT_select_random(wmOperatorType *ot)
-{
-       PropertyRNA *prop;
-       
-       /* identifiers */
-       ot->name= "Random selection";
-       ot->idname= "VIEW3D_OT_select_random";
-       
-       /* api callbacks */
-       /*ot->invoke= view3d_select_random_invoke XXX - need a number popup ;*/
-       ot->exec = view3d_select_random_exec;
-       ot->poll= ED_operator_view3d_active;
-       
-       prop = RNA_def_property(ot->srna, "percent", PROP_INT, PROP_NONE);
-       RNA_def_property_ui_range(prop, 1, 100,1, 1);
-       RNA_def_property_ui_text(prop, "Percent", "Max persentage that will be selected");
-       RNA_def_property_int_default(prop, 50);
-}
 /* ------------------------------------------------------------------------- */
 
 /** The following functions are quick & dirty callback functions called