forked from bartvdbraak/blender
patch [#33738] Extend Selection option unified and added to few operators
from Sebastian Nell (codemanx), with minor edits
This commit is contained in:
parent
45c453c9b1
commit
5e6917a18e
@ -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'}
|
||||
|
@ -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 ********************* */
|
||||
|
@ -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 ************* */
|
||||
|
@ -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 *******************/
|
||||
|
@ -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))
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user