patch [#33738] Extend Selection option unified and added to few operators
authorCampbell Barton <ideasman42@gmail.com>
Sat, 12 Jan 2013 10:48:10 +0000 (10:48 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 12 Jan 2013 10:48:10 +0000 (10:48 +0000)
from Sebastian Nell (codemanx), with minor edits

release/scripts/startup/bl_operators/object.py
source/blender/editors/armature/editarmature.c
source/blender/editors/armature/poseobject.c
source/blender/editors/curve/editcurve.c
source/blender/editors/mesh/editmesh_select.c
source/blender/editors/mesh/editmesh_tools.c

index 9e449f325d6d8d184da55a0166d1b523e611dbc8..d6a0e30b11044655fb3d50eeae4481d65908af3c 100644 (file)
@@ -110,6 +110,12 @@ class SelectCamera(Operator):
     bl_label = "Select Camera"
     bl_options = {'REGISTER', 'UNDO'}
 
+    extend = BoolProperty(
+           name="Extend",
+           description="Extend the selection",
+           default=False
+           )
+
     def execute(self, context):
         scene = context.scene
         view = context.space_data
@@ -123,6 +129,8 @@ class SelectCamera(Operator):
         elif camera.name not in scene.objects:
             self.report({'WARNING'}, "Active camera is not in this scene")
         else:
+            if not self.extend:
+                bpy.ops.object.select_all(action='DESELECT')
             context.scene.objects.active = camera
             camera.select = True
             return {'FINISHED'}
index 37314373e9884e2bf4bf8e950f1e3c40b2305a82..4a987d15380c254be32c7ada3915afbe39223604 100644 (file)
@@ -4349,7 +4349,7 @@ void ARMATURE_OT_select_hierarchy(wmOperatorType *ot)
        /* props */
        RNA_def_enum(ot->srna, "direction", direction_items,
                     BONE_SELECT_PARENT, "Direction", "");
-       RNA_def_boolean(ot->srna, "extend", 0, "Add to Selection", "");
+       RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend the selection");
 }
 
 /* ***************** EditBone Alignment ********************* */
index 49d4b670cde18516dc7231adbbec331543ff5759..38924105316efe18fff5a392b875695d6a59854c 100644 (file)
@@ -576,7 +576,7 @@ void POSE_OT_select_hierarchy(wmOperatorType *ot)
        
        /* props */
        ot->prop = RNA_def_enum(ot->srna, "direction", direction_items, BONE_SELECT_PARENT, "Direction", "");
-       RNA_def_boolean(ot->srna, "extend", 0, "Add to Selection", "");
+       RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend the selection");
 }
 
 /* ******************* select grouped operator ************* */
index 53e610401b7e0ccb29b07f512c30ce59648b5ee5..69c4b387856c2d8aefd0b406739516c992905652 100644 (file)
@@ -5510,7 +5510,7 @@ void CURVE_OT_select_random(wmOperatorType *ot)
 
        /* properties */
        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");
+       RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend the selection");
 }
 
 /********************* every nth number of point *******************/
index 0af2913dae00300bb2e642e04abf67cf52aeee75..f552a7b46c124ca522b0b1f9d7a4a98e818b7289 100644 (file)
@@ -1758,7 +1758,7 @@ void MESH_OT_select_shortest_path(wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
        
        /* properties */
-       RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "");
+       RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend the selection");
 }
 
 /* ************************************************** */
@@ -2835,6 +2835,9 @@ static int edbm_select_non_manifold_exec(bContext *C, wmOperator *op)
        BMEdge *e;
        BMIter iter;
 
+       if (!RNA_boolean_get(op->ptr, "extend"))
+               EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+
        /* Selects isolated verts, and edges that do not have 2 neighboring
         * faces
         */
@@ -2874,6 +2877,9 @@ void MESH_OT_select_non_manifold(wmOperatorType *ot)
        
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+       /* props */
+       RNA_def_boolean(ot->srna, "extend", true, "Extend", "Extend the selection");
 }
 
 static int edbm_select_random_exec(bContext *C, wmOperator *op)
@@ -2938,8 +2944,7 @@ void MESH_OT_select_random(wmOperatorType *ot)
        /* props */
        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", 0,
-                       "Extend Selection", "Extend selection instead of deselecting everything first");
+       RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend the selection");
 }
 
 static int edbm_select_next_loop_exec(bContext *C, wmOperator *UNUSED(op))
index 1ab130a950f166474491c7ec9f01ed347f5a228f..951c8b4e9b304abbf82bcec27176d18017b3abd7 100644 (file)
@@ -3838,6 +3838,9 @@ static int edbm_select_face_by_sides_exec(bContext *C, wmOperator *op)
        const int numverts = RNA_int_get(op->ptr, "number");
        const int type = RNA_enum_get(op->ptr, "type");
 
+       if (!RNA_boolean_get(op->ptr, "extend"))
+               EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+
        BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
 
                int select;
@@ -3897,9 +3900,10 @@ void MESH_OT_select_face_by_sides(wmOperatorType *ot)
        /* properties */
        RNA_def_int(ot->srna, "number", 4, 3, INT_MAX, "Number of Vertices", "", 3, INT_MAX);
        RNA_def_enum(ot->srna, "type", type_items, 1, "Type", "Type of comparison to make");
+       RNA_def_boolean(ot->srna, "extend", TRUE, "Extend", "Extend the selection");
 }
 
-static int edbm_select_loose_verts_exec(bContext *C, wmOperator *UNUSED(op))
+static int edbm_select_loose_verts_exec(bContext *C, wmOperator *op)
 {
        Object *obedit = CTX_data_edit_object(C);
        BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -3907,6 +3911,9 @@ static int edbm_select_loose_verts_exec(bContext *C, wmOperator *UNUSED(op))
        BMEdge *eed;
        BMIter iter;
 
+       if (!RNA_boolean_get(op->ptr, "extend"))
+               EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+
        BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
                if (!eve->e) {
                        BM_vert_select_set(em->bm, eve, TRUE);
@@ -3938,6 +3945,9 @@ void MESH_OT_select_loose_verts(wmOperatorType *ot)
 
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+       /* props */
+       RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend the selection");
 }
 
 static int edbm_select_mirror_exec(bContext *C, wmOperator *op)