1. Extend option for 3d view border select now does something (default True to keep same behavior)

2. Add action parameter to Select_All_Toggle operators, rename to Select_All.
Options are Toggle (default), Select, Deselect, Invert (same as select swap). This makes it possible to map separate hotkeys for select all and deselect all.

NOTE for Aligorith: I didn't change animation operators for select_all which already had an Invert operator. These should be fixed eventually.
This commit is contained in:
Martin Poirier 2009-11-29 22:16:29 +00:00
parent 92b4316708
commit cd154da973
36 changed files with 571 additions and 234 deletions

@ -399,7 +399,7 @@ def bvh_node_dict2armature(context, bvh_nodes, IMPORT_START_FRAME= 1, IMPORT_LOO
#XXX - sloppy operator code
bpy.ops.armature.delete()
bpy.ops.armature.select_all_toggle()
bpy.ops.armature.select_all()
bpy.ops.armature.delete()
ZERO_AREA_BONES= []
@ -484,7 +484,7 @@ def bvh_node_dict2armature(context, bvh_nodes, IMPORT_START_FRAME= 1, IMPORT_LOO
pass
bpy.ops.pose.select_all_toggle() # set
bpy.ops.pose.select_all() # set
bpy.ops.anim.keyframe_insert_menu(type=-4) # XXX - -4 ???

@ -1277,7 +1277,7 @@ def load_obj(filepath,
# deselect all
# if context.selected_objects:
# bpy.ops.OBJECT_OT_select_all_toggle()
# bpy.ops.OBJECT_OT_select_all()
scene = context.scene
# scn = bpy.data.scenes.active
@ -1640,5 +1640,5 @@ menu_item = dynamic_menu.add(bpy.types.INFO_MT_file_import, menu_func)
# search image in bpy.config.textureDir - load_image
# replaced BPyImage.comprehensiveImageLoad with a simplified version that only checks additional directory specified, but doesn't search dirs recursively (obj_image_load)
# bitmask won't work? - 132
# uses operator bpy.ops.OBJECT_OT_select_all_toggle() to deselect all (not necessary?)
# uses operator bpy.ops.OBJECT_OT_select_all() to deselect all (not necessary?)
# uses bpy.sys.time()

@ -75,7 +75,7 @@ class IMAGE_MT_select(bpy.types.Menu):
layout.separator()
layout.operator("uv.select_all_toggle")
layout.operator("uv.select_all")
layout.operator("uv.select_inverse")
layout.operator("uv.unlink_selection")

@ -364,7 +364,7 @@ class VIEW3D_MT_select_object(bpy.types.Menu):
layout.separator()
layout.operator("object.select_all_toggle", text="Select/Deselect All")
layout.operator("object.select_all", text="Select/Deselect All")
layout.operator("object.select_inverse", text="Inverse")
layout.operator("object.select_random", text="Random")
layout.operator("object.select_mirror", text="Mirror")
@ -388,7 +388,7 @@ class VIEW3D_MT_select_pose(bpy.types.Menu):
layout.separator()
layout.operator("pose.select_all_toggle", text="Select/Deselect All")
layout.operator("pose.select_all", text="Select/Deselect All")
layout.operator("pose.select_inverse", text="Inverse")
layout.operator("pose.select_constraint_target", text="Constraint Target")
layout.operator("pose.select_linked", text="Linked")
@ -419,7 +419,7 @@ class VIEW3D_MT_select_particle(bpy.types.Menu):
layout.separator()
layout.operator("particle.select_all_toggle", text="Select/Deselect All")
layout.operator("particle.select_all", text="Select/Deselect All")
layout.operator("particle.select_linked")
layout.operator("particle.select_inverse")
@ -445,7 +445,7 @@ class VIEW3D_MT_select_edit_mesh(bpy.types.Menu):
layout.separator()
layout.operator("mesh.select_all_toggle", text="Select/Deselect All")
layout.operator("mesh.select_all", text="Select/Deselect All")
layout.operator("mesh.select_inverse", text="Inverse")
layout.separator()
@ -494,7 +494,7 @@ class VIEW3D_MT_select_edit_curve(bpy.types.Menu):
layout.separator()
layout.operator("curve.select_all_toggle", text="Select/Deselect All")
layout.operator("curve.select_all", text="Select/Deselect All")
layout.operator("curve.select_inverse")
layout.operator("curve.select_random")
layout.operator("curve.select_every_nth")
@ -523,7 +523,7 @@ class VIEW3D_MT_select_edit_surface(bpy.types.Menu):
layout.separator()
layout.operator("curve.select_all_toggle", text="Select/Deselect All")
layout.operator("curve.select_all", text="Select/Deselect All")
layout.operator("curve.select_inverse")
layout.operator("curve.select_random")
layout.operator("curve.select_every_nth")
@ -566,7 +566,7 @@ class VIEW3D_MT_select_edit_lattice(bpy.types.Menu):
layout.separator()
layout.operator("lattice.select_all_toggle", text="Select/Deselect All")
layout.operator("lattice.select_all", text="Select/Deselect All")
class VIEW3D_MT_select_edit_armature(bpy.types.Menu):
@ -580,7 +580,7 @@ class VIEW3D_MT_select_edit_armature(bpy.types.Menu):
layout.separator()
layout.operator("armature.select_all_toggle", text="Select/Deselect All")
layout.operator("armature.select_all", text="Select/Deselect All")
layout.operator("armature.select_inverse", text="Inverse")
layout.separator()

@ -878,27 +878,37 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
{
ListBase *markers= context_get_markers(C);
TimeMarker *marker;
int select= RNA_int_get(op->ptr, "select_type");
int action = RNA_enum_get(op->ptr, "action");
if(markers == NULL)
return OPERATOR_CANCELLED;
if(RNA_boolean_get(op->ptr, "select_swap")) {
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
for(marker= markers->first; marker; marker= marker->next) {
if(marker->flag & SELECT)
if(marker->flag & SELECT) {
action = SEL_DESELECT;
break;
}
}
if(marker)
select= 0;
else
select= 1;
}
for(marker= markers->first; marker; marker= marker->next) {
if(select)
switch (action) {
case SEL_SELECT:
marker->flag |= SELECT;
else
break;
case SEL_DESELECT:
marker->flag &= ~SELECT;
break;
case SEL_INVERT:
if (marker->flag & SELECT) {
marker->flag &= ~SELECT;
} else {
marker->flag |= SELECT;
}
break;
}
}
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
@ -906,31 +916,22 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
static int ed_marker_select_all_invoke(bContext *C, wmOperator *op, wmEvent *evt)
{
RNA_boolean_set(op->ptr, "select_swap", 1);
return ed_marker_select_all_exec(C, op);
}
static void MARKER_OT_select_all_toggle(wmOperatorType *ot)
static void MARKER_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
ot->name= "(De)select all markers";
ot->description= "(de)select all time markers.";
ot->idname= "MARKER_OT_select_all_toggle";
ot->description= "Change selection of all time markers.";
ot->idname= "MARKER_OT_select_all";
/* api callbacks */
ot->exec= ed_marker_select_all_exec;
ot->invoke= ed_marker_select_all_invoke;
ot->poll= ED_operator_areaactive;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* rna */
RNA_def_boolean(ot->srna, "select_swap", 0, "Select Swap", "");
RNA_def_int(ot->srna, "select_type", 0, INT_MIN, INT_MAX, "Select Type", "", INT_MIN, INT_MAX);
WM_operator_properties_select_all(ot);
}
/* ******************************* remove marker ***************** */
@ -987,7 +988,7 @@ void ED_operatortypes_marker(void)
WM_operatortype_append(MARKER_OT_duplicate);
WM_operatortype_append(MARKER_OT_select);
WM_operatortype_append(MARKER_OT_select_border);
WM_operatortype_append(MARKER_OT_select_all_toggle);
WM_operatortype_append(MARKER_OT_select_all);
WM_operatortype_append(MARKER_OT_delete);
}
@ -1002,7 +1003,7 @@ void ED_marker_keymap(wmKeyConfig *keyconf)
WM_keymap_verify_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", 1);
WM_keymap_verify_item(keymap, "MARKER_OT_select_border", BKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "MARKER_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "MARKER_OT_select_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "MARKER_OT_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "MARKER_OT_delete", DELKEY, KM_PRESS, 0, 0);

@ -45,7 +45,7 @@ void ARMATURE_OT_subdivide_multi(struct wmOperatorType *ot);
void ARMATURE_OT_parent_set(struct wmOperatorType *ot);
void ARMATURE_OT_parent_clear(struct wmOperatorType *ot);
void ARMATURE_OT_select_all_toggle(struct wmOperatorType *ot);
void ARMATURE_OT_select_all(struct wmOperatorType *ot);
void ARMATURE_OT_select_inverse(struct wmOperatorType *ot);
void ARMATURE_OT_select_hierarchy(struct wmOperatorType *ot);
void ARMATURE_OT_select_linked(struct wmOperatorType *ot);
@ -80,7 +80,7 @@ void POSE_OT_scale_clear(struct wmOperatorType *ot);
void POSE_OT_copy(struct wmOperatorType *ot);
void POSE_OT_paste(struct wmOperatorType *ot);
void POSE_OT_select_all_toggle(struct wmOperatorType *ot);
void POSE_OT_select_all(struct wmOperatorType *ot);
void POSE_OT_select_inverse(struct wmOperatorType *ot);
void POSE_OT_select_parent(struct wmOperatorType *ot);
void POSE_OT_select_hierarchy(struct wmOperatorType *ot);

@ -77,7 +77,7 @@ void ED_operatortypes_armature(void)
WM_operatortype_append(ARMATURE_OT_parent_set);
WM_operatortype_append(ARMATURE_OT_parent_clear);
WM_operatortype_append(ARMATURE_OT_select_all_toggle);
WM_operatortype_append(ARMATURE_OT_select_all);
WM_operatortype_append(ARMATURE_OT_select_inverse);
WM_operatortype_append(ARMATURE_OT_select_hierarchy);
WM_operatortype_append(ARMATURE_OT_select_linked);
@ -120,7 +120,7 @@ void ED_operatortypes_armature(void)
WM_operatortype_append(POSE_OT_copy);
WM_operatortype_append(POSE_OT_paste);
WM_operatortype_append(POSE_OT_select_all_toggle);
WM_operatortype_append(POSE_OT_select_all);
WM_operatortype_append(POSE_OT_select_inverse);
WM_operatortype_append(POSE_OT_select_parent);
@ -219,7 +219,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "ARMATURE_OT_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_parent_clear", PKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_select_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);
kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
@ -295,7 +295,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
kmi= WM_keymap_add_item(keymap, "POSE_OT_paste", VKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "flipped", 1);
WM_keymap_add_item(keymap, "POSE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "POSE_OT_select_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "POSE_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "POSE_OT_select_parent", PKEY, KM_PRESS, KM_SHIFT, 0);

@ -3993,25 +3993,38 @@ void ARMATURE_OT_select_inverse(wmOperatorType *ot)
}
static int armature_de_select_all_exec(bContext *C, wmOperator *op)
{
int sel=1;
int action = RNA_enum_get(op->ptr, "action");
/* Determine if there are any selected bones
And therefore whether we are selecting or deselecting */
if (CTX_DATA_COUNT(C, selected_bones) > 0) sel=0;
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
/* Determine if there are any selected bones
And therefore whether we are selecting or deselecting */
if (CTX_DATA_COUNT(C, selected_bones) > 0)
action = SEL_DESELECT;
}
/* Set the flags */
CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones) {
/* ignore bone if selection can't change */
if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
if (sel==1) {
/* select bone */
switch (action) {
case SEL_SELECT:
ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
if(ebone->parent)
ebone->parent->flag |= (BONE_TIPSEL);
}
else {
/* deselect bone */
break;
case SEL_DESELECT:
ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
break;
case SEL_INVERT:
if (ebone->flag & BONE_SELECTED) {
ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
} else {
ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
if(ebone->parent)
ebone->parent->flag |= (BONE_TIPSEL);
}
break;
}
}
}
@ -4022,12 +4035,12 @@ static int armature_de_select_all_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
void ARMATURE_OT_select_all_toggle(wmOperatorType *ot)
void ARMATURE_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
ot->name= "deselect all editbone";
ot->idname= "ARMATURE_OT_select_all_toggle";
ot->idname= "ARMATURE_OT_select_all";
/* api callbacks */
ot->exec= armature_de_select_all_exec;
@ -4036,6 +4049,7 @@ void ARMATURE_OT_select_all_toggle(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
/* ********************* select hierarchy operator ************** */
@ -5077,20 +5091,35 @@ void POSE_OT_select_inverse(wmOperatorType *ot)
}
static int pose_de_select_all_exec(bContext *C, wmOperator *op)
{
int sel=1;
int action = RNA_enum_get(op->ptr, "action");
/* Determine if there are any selected bones and therefore whether we are selecting or deselecting */
// NOTE: we have to check for > 1 not > 0, since there is almost always an active bone that can't be cleared...
if (CTX_DATA_COUNT(C, selected_pose_bones) > 1) sel=0;
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
/* Determine if there are any selected bones and therefore whether we are selecting or deselecting */
// NOTE: we have to check for > 1 not > 0, since there is almost always an active bone that can't be cleared...
if (CTX_DATA_COUNT(C, selected_pose_bones) > 1)
action = SEL_DESELECT;
}
/* Set the flags */
CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones) {
/* select pchan only if selectable, but deselect works always */
if (sel==0) {
switch (action) {
case SEL_SELECT:
if ((pchan->bone->flag & BONE_UNSELECTABLE)==0)
pchan->bone->flag |= BONE_SELECTED;
break;
case SEL_DESELECT:
pchan->bone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
break;
case SEL_INVERT:
if (pchan->bone->flag & BONE_SELECTED) {
pchan->bone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
} else if ((pchan->bone->flag & BONE_UNSELECTABLE)==0) {
pchan->bone->flag |= BONE_SELECTED;
}
break;
}
else if ((pchan->bone->flag & BONE_UNSELECTABLE)==0)
pchan->bone->flag |= BONE_SELECTED;
}
CTX_DATA_END;
@ -5099,12 +5128,12 @@ static int pose_de_select_all_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
void POSE_OT_select_all_toggle(wmOperatorType *ot)
void POSE_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
ot->name= "deselect all bones";
ot->idname= "POSE_OT_select_all_toggle";
ot->idname= "POSE_OT_select_all";
/* api callbacks */
ot->exec= pose_de_select_all_exec;
@ -5113,6 +5142,7 @@ void POSE_OT_select_all_toggle(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
static int pose_select_parent_exec(bContext *C, wmOperator *op)

@ -84,7 +84,7 @@ void CURVE_OT_smooth_radius(struct wmOperatorType *ot);
void CURVE_OT_de_select_first(struct wmOperatorType *ot);
void CURVE_OT_de_select_last(struct wmOperatorType *ot);
void CURVE_OT_select_all_toggle(struct wmOperatorType *ot);
void CURVE_OT_select_all(struct wmOperatorType *ot);
void CURVE_OT_select_inverse(struct wmOperatorType *ot);
void CURVE_OT_select_linked(struct wmOperatorType *ot);
void CURVE_OT_select_row(struct wmOperatorType *ot);

@ -139,7 +139,7 @@ void ED_operatortypes_curve(void)
WM_operatortype_append(CURVE_OT_de_select_first);
WM_operatortype_append(CURVE_OT_de_select_last);
WM_operatortype_append(CURVE_OT_select_all_toggle);
WM_operatortype_append(CURVE_OT_select_all);
WM_operatortype_append(CURVE_OT_select_inverse);
WM_operatortype_append(CURVE_OT_select_linked);
WM_operatortype_append(CURVE_OT_select_row);
@ -222,7 +222,7 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "OBJECT_OT_curve_add", AKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "CURVE_OT_vertex_add", LEFTMOUSE, KM_CLICK, KM_CTRL, 0);
WM_keymap_add_item(keymap, "CURVE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "CURVE_OT_select_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "CURVE_OT_select_row", RKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "CURVE_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "CURVE_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);

@ -83,6 +83,9 @@
#include "RNA_access.h"
#include "RNA_define.h"
void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatus);
static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short selstatus);
/* still need to eradicate a few :( */
#define callocstructN(x,y,name) (x*)MEM_callocN((y)* sizeof(x),name)
@ -363,6 +366,26 @@ void free_editNurb(Object *obedit)
}
}
void CU_deselect_all(Object *obedit)
{
ListBase *editnurb= curve_get_editcurve(obedit);
if (editnurb) {
selectend_nurb(obedit, FIRST, 0, DESELECT); /* set first control points as unselected */
select_adjacent_cp(editnurb, 1, 1, DESELECT); /* cascade selection */
}
}
void CU_select_all(Object *obedit)
{
ListBase *editnurb= curve_get_editcurve(obedit);
if (editnurb) {
selectend_nurb(obedit, FIRST, 0, DESELECT); /* set first control points as unselected */
select_adjacent_cp(editnurb, 1, 1, DESELECT); /* cascade selection */
}
}
/******************** separate operator ***********************/
static int separate_exec(bContext *C, wmOperator *op)
@ -1580,26 +1603,67 @@ static int de_select_all_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
ListBase *editnurb= curve_get_editcurve(obedit);
int action = RNA_enum_get(op->ptr, "action");
if(nurb_has_selected_cps(editnurb)) { /* deselect all */
selectend_nurb(obedit, FIRST, 0, DESELECT); /* set first control points as unselected */
select_adjacent_cp(editnurb, 1, 1, DESELECT); /* cascade selection */
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
if(nurb_has_selected_cps(editnurb))
action = SEL_DESELECT;
}
switch (action) {
case SEL_SELECT:
CU_select_all(obedit);
break;
case SEL_DESELECT:
CU_deselect_all(obedit);
break;
case SEL_INVERT:
{
Curve *cu= obedit->data;
Nurb *nu;
BPoint *bp;
BezTriple *bezt;
int a;
for(nu= editnurb->first; nu; nu= nu->next) {
if(nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
while(a--) {
if(bezt->hide==0) {
bezt->f2 ^= SELECT; /* always do the center point */
if((cu->drawflag & CU_HIDE_HANDLES)==0) {
bezt->f1 ^= SELECT;
bezt->f3 ^= SELECT;
}
}
bezt++;
}
}
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
while(a--) {
swap_selection_bpoint(bp);
bp++;
}
}
}
break;
}
}
else { /* select all */
selectend_nurb(obedit, FIRST, 0, SELECT); /* set first control points as selected */
select_adjacent_cp(editnurb, 1, 1, SELECT); /* cascade selection */
}
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
return OPERATOR_FINISHED;
}
void CURVE_OT_select_all_toggle(wmOperatorType *ot)
void CURVE_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Select or Deselect All";
ot->idname= "CURVE_OT_select_all_toggle";
ot->idname= "CURVE_OT_select_all";
/* api callbacks */
ot->exec= de_select_all_exec;

@ -43,6 +43,10 @@ void ED_operatortypes_curve(void);
void ED_keymap_curve (struct wmKeyConfig *keyconf);
/* editcurve.c */
void CU_deselect_all(struct Object *obedit);
void CU_select_all(struct Object *obedit);
void undo_push_curve (struct bContext *C, char *name);
ListBase *curve_get_editcurve(struct Object *ob);

@ -126,6 +126,7 @@ void EM_select_face_fgon(struct EditMesh *em, struct EditFace *efa, int val);
void EM_select_swap(struct EditMesh *em);
void EM_toggle_select_all(struct EditMesh *em);
void EM_select_all(struct EditMesh *em);
void EM_deselect_all(struct EditMesh *em);
void EM_selectmode_flush(struct EditMesh *em);
void EM_deselect_flush(struct EditMesh *em);
void EM_selectmode_set(struct EditMesh *em);
@ -168,8 +169,8 @@ void EM_automerge(struct Scene *scene, struct Object *obedit, int update);
/* editface.c */
struct MTFace *EM_get_active_mtface(struct EditMesh *em, struct EditFace **act_efa, struct MCol **mcol, int sloppy);
int face_select(struct bContext *C, struct Object *ob, short mval[2], int extend);
void face_borderselect(struct bContext *C, struct Object *ob, struct rcti *rect, int select);
void deselectall_tface(struct Object *ob);
void face_borderselect(struct bContext *C, struct Object *ob, struct rcti *rect, int select, int extend);
void selectall_tface(struct Object *ob, int action);
void select_linked_tfaces(struct bContext *C, struct Object *ob, short mval[2], int mode);
/* object_vgroup.c */

@ -115,6 +115,10 @@ void latt_to_key(struct Lattice *lt, struct KeyBlock *kb);
void key_to_curve(struct KeyBlock *kb, struct Curve *cu, struct ListBase *nurb);
void curve_to_key(struct Curve *cu, struct KeyBlock *kb, struct ListBase *nurb);
/* object_lattice.c */
void ED_setflagsLatt(struct Object *obedit, int flag);
/* object_modifier.c */
enum {
MODIFIER_APPLY_DATA=1,

@ -57,7 +57,7 @@ void PE_update_object(struct Scene *scene, struct Object *ob, int useflag);
/* selection tools */
int PE_mouse_particles(struct bContext *C, short *mval, int extend);
int PE_border_select(struct bContext *C, struct rcti *rect, int select);
int PE_border_select(struct bContext *C, struct rcti *rect, int select, int extend);
int PE_circle_select(struct bContext *C, int selecting, short *mval, float rad);
int PE_lasso_select(struct bContext *C, short mcords[][2], short moves, short select);

@ -378,34 +378,44 @@ void select_linked_tfaces(bContext *C, Object *ob, short mval[2], int mode)
object_facesel_flush_dm(ob);
}
void deselectall_tface(Object *ob)
void selectall_tface(Object *ob, int action)
{
Mesh *me;
MFace *mface;
int a, sel;
int a;
me= get_mesh(ob);
if(me==0) return;
mface= me->mface;
a= me->totface;
sel= 0;
while(a--) {
if(mface->flag & ME_HIDE);
else if(mface->flag & ME_FACE_SEL) {
sel= 1;
break;
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
mface= me->mface;
a= me->totface;
while(a--) {
if((mface->flag & ME_HIDE) == 0 && mface->flag & ME_FACE_SEL) {
action = SEL_DESELECT;
break;
}
mface++;
}
mface++;
}
mface= me->mface;
a= me->totface;
while(a--) {
if(mface->flag & ME_HIDE);
else {
if(sel) mface->flag &= ~ME_FACE_SEL;
else mface->flag |= ME_FACE_SEL;
if((mface->flag & ME_HIDE) == 0) {
switch (action) {
case SEL_SELECT:
mface->flag |= ME_FACE_SEL;
break;
case SEL_DESELECT:
mface->flag &= ~ME_FACE_SEL;
break;
case SEL_INVERT:
mface->flag ^= ME_FACE_SEL;
break;
}
}
mface++;
}
@ -815,7 +825,7 @@ int face_select(struct bContext *C, Object *ob, short mval[2], int extend)
return 1;
}
void face_borderselect(struct bContext *C, Object *ob, rcti *rect, int select)
void face_borderselect(struct bContext *C, Object *ob, rcti *rect, int select, int extend)
{
Mesh *me;
MFace *mface;
@ -837,6 +847,14 @@ void face_borderselect(struct bContext *C, Object *ob, rcti *rect, int select)
sy= (rect->ymax-rect->ymin+1);
if(sx*sy<=0) return;
if (extend == 0 && select) {
mface= me->mface;
for(a=1; a<=me->totface; a++, mface++) {
if((mface->flag & ME_HIDE) == 0)
mface->flag &= ~ME_FACE_SEL;
}
}
view3d_validate_backbuf(&vc);
ibuf = IMB_allocImBuf(sx,sy,32,IB_rect,0);

@ -3372,12 +3372,31 @@ void EM_select_all(EditMesh *em)
EM_set_flag_all(em, SELECT);
}
static int toggle_select_all_exec(bContext *C, wmOperator *op)
void EM_deselect_all(EditMesh *em)
{
EM_clear_flag_all(em, SELECT);
}
static int select_all_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
int action = RNA_enum_get(op->ptr, "action");
EM_toggle_select_all(em);
switch (action) {
case SEL_TOGGLE:
EM_toggle_select_all(em);
break;
case SEL_SELECT:
EM_select_all(em);
break;
case SEL_DESELECT:
EM_deselect_all(em);
break;
case SEL_INVERT:
EM_select_swap(em);
break;
}
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@ -3385,19 +3404,21 @@ static int toggle_select_all_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
void MESH_OT_select_all_toggle(wmOperatorType *ot)
void MESH_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Select/Deselect All";
ot->description= "(de)select all vertices, edges or faces.";
ot->idname= "MESH_OT_select_all_toggle";
ot->description= "Change selection of all vertices, edges or faces.";
ot->idname= "MESH_OT_select_all";
/* api callbacks */
ot->exec= toggle_select_all_exec;
ot->exec= select_all_exec;
ot->poll= ED_operator_editmesh;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
/* ******************** **************** */

@ -141,7 +141,7 @@ void MESH_OT_knife_cut(struct wmOperatorType *ot);
/* ******************* editmesh_mods.c */
void MESH_OT_loop_select(struct wmOperatorType *ot);
void MESH_OT_select_all_toggle(struct wmOperatorType *ot);
void MESH_OT_select_all(struct wmOperatorType *ot);
void MESH_OT_select_more(struct wmOperatorType *ot);
void MESH_OT_select_less(struct wmOperatorType *ot);
void MESH_OT_select_inverse(struct wmOperatorType *ot);

@ -68,7 +68,7 @@
void ED_operatortypes_mesh(void)
{
WM_operatortype_append(MESH_OT_select_all_toggle);
WM_operatortype_append(MESH_OT_select_all);
WM_operatortype_append(MESH_OT_select_more);
WM_operatortype_append(MESH_OT_select_less);
WM_operatortype_append(MESH_OT_select_inverse);
@ -222,7 +222,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "MESH_OT_select_shortest_path", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "MESH_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MESH_OT_select_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MESH_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "MESH_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "MESH_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);

@ -189,49 +189,63 @@ MetaElem *add_metaball_primitive(bContext *C, int type, int newname)
/***************************** Select/Deselect operator *****************************/
/* Select or deselect all MetaElements */
static int select_deselect_all_metaelems_exec(bContext *C, wmOperator *op)
static int select_all_exec(bContext *C, wmOperator *op)
{
//Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
MetaBall *mb = (MetaBall*)obedit->data;
MetaElem *ml;
int any_sel= 0;
/* Is any metaelem selected? */
int action = RNA_enum_get(op->ptr, "action");
ml= mb->editelems->first;
if(ml) {
while(ml) {
if(ml->flag & SELECT) break;
ml= ml->next;
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
while(ml) {
if(ml->flag & SELECT) {
action = SEL_DESELECT;
break;
}
ml= ml->next;
}
}
if(ml) any_sel= 1;
ml= mb->editelems->first;
while(ml) {
if(any_sel) ml->flag &= ~SELECT;
else ml->flag |= SELECT;
switch (action) {
case SEL_SELECT:
ml->flag |= SELECT;
break;
case SEL_DESELECT:
ml->flag &= ~SELECT;
break;
case SEL_INVERT:
ml->flag ^= SELECT;
break;
}
ml= ml->next;
}
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, mb);
//DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
}
return OPERATOR_FINISHED;
}
void MBALL_OT_select_deselect_all_metaelems(wmOperatorType *ot)
void MBALL_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Select/Deselect All";
ot->description= "(de)select all metaelements.";
ot->idname= "MBALL_OT_select_deselect_all_metaelems";
ot->description= "Change selection of all meta elements.";
ot->idname= "MBALL_OT_select_all";
/* callback functions */
ot->exec= select_deselect_all_metaelems_exec;
ot->exec= select_all_exec;
ot->poll= ED_operator_editmball;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
/***************************** Select inverse operator *****************************/

@ -39,7 +39,7 @@ void MBALL_OT_reveal_metaelems(struct wmOperatorType *ot);
void MBALL_OT_delete_metaelems(struct wmOperatorType *ot);
void MBALL_OT_duplicate_metaelems(struct wmOperatorType *ot);
void MBALL_OT_select_deselect_all_metaelems(struct wmOperatorType *ot);
void MBALL_OT_select_all(struct wmOperatorType *ot);
void MBALL_OT_select_inverse_metaelems(struct wmOperatorType *ot);
void MBALL_OT_select_random_metaelems(struct wmOperatorType *ot);

@ -46,7 +46,7 @@ void ED_operatortypes_metaball(void)
WM_operatortype_append(MBALL_OT_hide_metaelems);
WM_operatortype_append(MBALL_OT_reveal_metaelems);
WM_operatortype_append(MBALL_OT_select_deselect_all_metaelems);
WM_operatortype_append(MBALL_OT_select_all);
WM_operatortype_append(MBALL_OT_select_inverse_metaelems);
WM_operatortype_append(MBALL_OT_select_random_metaelems);
}
@ -68,7 +68,7 @@ void ED_keymap_metaball(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "MBALL_OT_delete_metaelems", DELKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MBALL_OT_duplicate_metaelems", DKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "MBALL_OT_select_deselect_all_metaelems", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MBALL_OT_select_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MBALL_OT_select_inverse_metaelems", IKEY, KM_PRESS, KM_CTRL, 0);
}

@ -81,7 +81,7 @@ void OBJECT_OT_shade_smooth(struct wmOperatorType *ot);
void OBJECT_OT_shade_flat(struct wmOperatorType *ot);
/* object_select.c */
void OBJECT_OT_select_all_toggle(struct wmOperatorType *ot);
void OBJECT_OT_select_all(struct wmOperatorType *ot);
void OBJECT_OT_select_inverse(struct wmOperatorType *ot);
void OBJECT_OT_select_random(struct wmOperatorType *ot);
void OBJECT_OT_select_by_type(struct wmOperatorType *ot);
@ -124,7 +124,7 @@ void make_editLatt(Object *obedit);
void load_editLatt(Object *obedit);
void remake_editLatt(Object *obedit);
void LATTICE_OT_select_all_toggle(struct wmOperatorType *ot);
void LATTICE_OT_select_all(struct wmOperatorType *ot);
void LATTICE_OT_make_regular(struct wmOperatorType *ot);
/* object_group.c */

@ -38,6 +38,8 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "RNA_access.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_key.h"
@ -154,7 +156,7 @@ void load_editLatt(Object *obedit)
/************************** Operators *************************/
static void setflagsLatt(Object *obedit, int flag)
void ED_setflagsLatt(Object *obedit, int flag)
{
Lattice *lt= obedit->data;
BPoint *bp;
@ -172,49 +174,71 @@ static void setflagsLatt(Object *obedit, int flag)
}
}
int de_select_all_exec(bContext *C, wmOperator *op)
int select_all_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
Lattice *lt= obedit->data;
BPoint *bp;
int a, deselect= 0;
bp= lt->editlatt->def;
a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
while(a--) {
if(bp->hide==0) {
if(bp->f1) {
deselect= 1;
break;
int a;
int action = RNA_enum_get(op->ptr, "action");
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
bp= lt->editlatt->def;
a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
while(a--) {
if(bp->hide==0) {
if(bp->f1) {
action = SEL_DESELECT;
break;
}
}
bp++;
}
bp++;
}
if(deselect)
setflagsLatt(obedit, 0);
else
setflagsLatt(obedit, 1);
switch (action) {
case SEL_SELECT:
ED_setflagsLatt(obedit, 1);
break;
case SEL_DESELECT:
ED_setflagsLatt(obedit, 0);
break;
case SEL_INVERT:
bp= lt->editlatt->def;
a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
while(a--) {
if(bp->hide==0) {
bp->f1 ^= 1;
}
bp++;
}
break;
}
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
return OPERATOR_FINISHED;
}
void LATTICE_OT_select_all_toggle(wmOperatorType *ot)
void LATTICE_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Select or Deselect All";
ot->description= "Toggle (de)select all UVW control points.";
ot->idname= "LATTICE_OT_select_all_toggle";
ot->description= "Change selection of all UVW control points.";
ot->idname= "LATTICE_OT_select_all";
/* api callbacks */
ot->exec= de_select_all_exec;
ot->exec= select_all_exec;
ot->poll= ED_operator_editlattice;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
int make_regular_poll(bContext *C)
@ -308,7 +332,7 @@ int mouse_lattice(bContext *C, short mval[2], int extend)
if(bp) {
if(extend==0) {
setflagsLatt(vc.obedit, 0);
ED_setflagsLatt(vc.obedit, 0);
bp->f1 |= SELECT;
}
else

@ -98,7 +98,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_select_inverse);
WM_operatortype_append(OBJECT_OT_select_random);
WM_operatortype_append(OBJECT_OT_select_all_toggle);
WM_operatortype_append(OBJECT_OT_select_all);
WM_operatortype_append(OBJECT_OT_select_by_type);
WM_operatortype_append(OBJECT_OT_select_by_layer);
WM_operatortype_append(OBJECT_OT_select_linked);
@ -180,7 +180,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_shape_key_mirror);
WM_operatortype_append(OBJECT_OT_shape_key_move);
WM_operatortype_append(LATTICE_OT_select_all_toggle);
WM_operatortype_append(LATTICE_OT_select_all);
WM_operatortype_append(LATTICE_OT_make_regular);
WM_operatortype_append(OBJECT_OT_group_add);
@ -261,7 +261,7 @@ void ED_keymap_object(wmKeyConfig *keyconf)
/* object mode supports PET now */
ED_object_generic_keymap(keyconf, keymap, TRUE);
WM_keymap_add_item(keymap, "OBJECT_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_select_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_select_linked", LKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_select_grouped", GKEY, KM_PRESS, KM_SHIFT, 0);
@ -329,7 +329,7 @@ void ED_keymap_object(wmKeyConfig *keyconf)
keymap= WM_keymap_find(keyconf, "Lattice", 0, 0);
keymap->poll= ED_operator_editlattice;
WM_keymap_add_item(keymap, "LATTICE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "LATTICE_OT_select_all", AKEY, KM_PRESS, 0, 0);
/* menus */
WM_keymap_add_menu(keymap, "VIEW3D_MT_hook", HKEY, KM_PRESS, KM_CTRL, 0);

@ -707,49 +707,64 @@ void OBJECT_OT_select_inverse(wmOperatorType *ot)
/**************************** (De)select All ****************************/
static int object_select_de_select_all_exec(bContext *C, wmOperator *op)
static int object_select_all_exec(bContext *C, wmOperator *op)
{
int action = RNA_enum_get(op->ptr, "action");
int a=0, ok=0;
/* passthrough if no objects are visible */
if (CTX_DATA_COUNT(C, visible_bases) == 0) return OPERATOR_PASS_THROUGH;
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
if (base->flag & SELECT) {
action = SEL_DESELECT;
break;
}
}
CTX_DATA_END;
}
CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
if (base->flag & SELECT) {
ok= a= 1;
switch (action) {
case SEL_SELECT:
ED_base_object_select(base, BA_SELECT);
break;
case SEL_DESELECT:
ED_base_object_select(base, BA_DESELECT);
break;
case SEL_INVERT:
if (base->flag & SELECT) {
ED_base_object_select(base, BA_DESELECT);
} else {
ED_base_object_select(base, BA_SELECT);
}
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_select_all_toggle(wmOperatorType *ot)
void OBJECT_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
ot->name= "deselect all";
ot->description = "(de)select all visible objects in scene.";
ot->idname= "OBJECT_OT_select_all_toggle";
ot->description = "Change selection of all visible objects in scene.";
ot->idname= "OBJECT_OT_select_all";
/* api callbacks */
ot->exec= object_select_de_select_all_exec;
ot->exec= object_select_all_exec;
ot->poll= ED_operator_scene_editable;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
/**************************** Select Mirror ****************************/

@ -1261,29 +1261,51 @@ static void toggle_key_select(PEData *data, int point_index, int key_index)
/************************ de select all operator ************************/
static int de_select_all_exec(bContext *C, wmOperator *op)
static int select_all_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
PTCacheEdit *edit= PE_get_current(scene, ob);
POINT_P; KEY_K;
int sel= 0;
LOOP_VISIBLE_POINTS {
LOOP_SELECTED_KEYS {
sel= 1;
key->flag &= ~PEK_SELECT;
point->flag |= PEP_EDIT_RECALC;
int action = RNA_enum_get(op->ptr, "action");
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
LOOP_VISIBLE_POINTS {
LOOP_SELECTED_KEYS {
action = SEL_DESELECT;
break;
}
if (action == SEL_DESELECT)
break;
}
}
if(sel==0) {
LOOP_VISIBLE_POINTS {
LOOP_KEYS {
if(!(key->flag & PEK_SELECT)) {
LOOP_VISIBLE_POINTS {
LOOP_VISIBLE_KEYS {
switch (action) {
case SEL_SELECT:
if ((key->flag & PEK_SELECT) == 0) {
key->flag |= PEK_SELECT;
point->flag |= PEP_EDIT_RECALC;
}
break;
case SEL_DESELECT:
if (key->flag & PEK_SELECT) {
key->flag &= ~PEK_SELECT;
point->flag |= PEP_EDIT_RECALC;
}
break;
case SEL_INVERT:
if ((key->flag & PEK_SELECT) == 0) {
key->flag |= PEK_SELECT;
point->flag |= PEP_EDIT_RECALC;
} else {
key->flag &= ~PEK_SELECT;
point->flag |= PEP_EDIT_RECALC;
}
break;
}
}
}
@ -1294,18 +1316,20 @@ static int de_select_all_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
void PARTICLE_OT_select_all_toggle(wmOperatorType *ot)
void PARTICLE_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Select or Deselect All";
ot->idname= "PARTICLE_OT_select_all_toggle";
ot->name= "Selection of all particles";
ot->idname= "PARTICLE_OT_select_all";
/* api callbacks */
ot->exec= de_select_all_exec;
ot->exec= select_all_exec;
ot->poll= PE_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
/************************ pick select operator ************************/
@ -1472,7 +1496,7 @@ void PARTICLE_OT_select_linked(wmOperatorType *ot)
/************************ border select operator ************************/
int PE_border_select(bContext *C, rcti *rect, int select)
int PE_border_select(bContext *C, rcti *rect, int select, int extend)
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
@ -1482,6 +1506,17 @@ int PE_border_select(bContext *C, rcti *rect, int select)
if(!PE_start_edit(edit))
return OPERATOR_CANCELLED;
if (extend == 0 && select) {
POINT_P; KEY_K;
LOOP_VISIBLE_POINTS {
LOOP_SELECTED_KEYS {
key->flag &= ~PEK_SELECT;
point->flag |= PEP_EDIT_RECALC;
}
}
}
PE_set_view3d_data(C, &data);
data.rect= rect;
data.select= select;

@ -36,7 +36,7 @@
struct wmOperatorType;
/* particle_edit.c */
void PARTICLE_OT_select_all_toggle(struct wmOperatorType *ot);
void PARTICLE_OT_select_all(struct wmOperatorType *ot);
void PARTICLE_OT_select_first(struct wmOperatorType *ot);
void PARTICLE_OT_select_last(struct wmOperatorType *ot);
void PARTICLE_OT_select_linked(struct wmOperatorType *ot);

@ -43,7 +43,7 @@
static void operatortypes_particle(void)
{
WM_operatortype_append(PARTICLE_OT_select_all_toggle);
WM_operatortype_append(PARTICLE_OT_select_all);
WM_operatortype_append(PARTICLE_OT_select_first);
WM_operatortype_append(PARTICLE_OT_select_last);
WM_operatortype_append(PARTICLE_OT_select_linked);
@ -94,7 +94,7 @@ static void keymap_particle(wmKeyConfig *keyconf)
keymap= WM_keymap_find(keyconf, "Particle", 0, 0);
keymap->poll= PE_poll;
WM_keymap_add_item(keymap, "PARTICLE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PARTICLE_OT_select_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PARTICLE_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "PARTICLE_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "PARTICLE_OT_select_linked", LKEY, KM_PRESS, 0, 0);

@ -96,7 +96,7 @@ void BRUSH_OT_curve_preset(struct wmOperatorType *ot);
void PAINT_OT_face_select_linked(struct wmOperatorType *ot);
void PAINT_OT_face_select_linked_pick(struct wmOperatorType *ot);
void PAINT_OT_face_deselect_all(struct wmOperatorType *ot);
void PAINT_OT_face_select_all(struct wmOperatorType *ot);
int facemask_paint_poll(struct bContext *C);

@ -137,7 +137,7 @@ void ED_operatortypes_paint(void)
/* face-select */
WM_operatortype_append(PAINT_OT_face_select_linked);
WM_operatortype_append(PAINT_OT_face_select_linked_pick);
WM_operatortype_append(PAINT_OT_face_deselect_all);
WM_operatortype_append(PAINT_OT_face_select_all);
}
static void ed_keymap_paint_brush_switch(wmKeyMap *keymap, const char *path)
@ -238,7 +238,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
keymap= WM_keymap_find(keyconf, "Face Mask", 0, 0);
keymap->poll= facemask_paint_poll;
WM_keymap_add_item(keymap, "PAINT_OT_face_deselect_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PAINT_OT_face_select_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PAINT_OT_face_select_linked", LKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "PAINT_OT_face_select_linked_pick", LKEY, KM_PRESS, 0, 0);

@ -273,22 +273,24 @@ void PAINT_OT_face_select_linked_pick(wmOperatorType *ot)
}
static int face_deselect_all_exec(bContext *C, wmOperator *op)
static int face_select_all_exec(bContext *C, wmOperator *op)
{
deselectall_tface(CTX_data_active_object(C));
selectall_tface(CTX_data_active_object(C), RNA_enum_get(op->ptr, "action"));
ED_region_tag_redraw(CTX_wm_region(C));
return OPERATOR_FINISHED;
}
void PAINT_OT_face_deselect_all(wmOperatorType *ot)
void PAINT_OT_face_select_all(wmOperatorType *ot)
{
ot->name= "Select Linked";
ot->description= "Select linked faces under the mouse.";
ot->idname= "PAINT_OT_face_deselect_all";
ot->name= "Face Selection";
ot->description= "Change selection for all faces.";
ot->idname= "PAINT_OT_face_select_all";
ot->exec= face_deselect_all_exec;
ot->exec= face_select_all_exec;
ot->poll= facemask_paint_poll;
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}

@ -1262,7 +1262,7 @@ static void do_nurbs_box_select__doSelect(void *userData, Nurb *nu, BPoint *bp,
}
}
}
static void do_nurbs_box_select(ViewContext *vc, rcti *rect, int select)
static void do_nurbs_box_select(ViewContext *vc, rcti *rect, int select, int extend)
{
struct { ViewContext vc; rcti *rect; int select; } data;
@ -1270,6 +1270,10 @@ static void do_nurbs_box_select(ViewContext *vc, rcti *rect, int select)
data.rect = rect;
data.select = select;
if (extend == 0 && select) {
CU_deselect_all(vc->obedit);
}
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
nurbs_foreachScreenVert(vc, do_nurbs_box_select__doSelect, &data);
}
@ -1282,7 +1286,7 @@ static void do_lattice_box_select__doSelect(void *userData, BPoint *bp, int x, i
bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT);
}
}
static void do_lattice_box_select(ViewContext *vc, rcti *rect, int select)
static void do_lattice_box_select(ViewContext *vc, rcti *rect, int select, int extend)
{
struct { ViewContext vc; rcti *rect; int select, pass, done; } data;
@ -1290,6 +1294,10 @@ static void do_lattice_box_select(ViewContext *vc, rcti *rect, int select)
data.rect = rect;
data.select = select;
if (extend == 0 && select) {
ED_setflagsLatt(vc->obedit, 0);
}
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
lattice_foreachScreenVert(vc, do_lattice_box_select__doSelect, &data);
}
@ -1327,7 +1335,7 @@ static void do_mesh_box_select__doSelectFace(void *userData, EditFace *efa, int
EM_select_face_fgon(data->vc.em, efa, data->select);
}
}
static void do_mesh_box_select(ViewContext *vc, rcti *rect, int select)
static void do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int extend)
{
struct { ViewContext vc; rcti *rect; short select, pass, done; } data;
ToolSettings *ts= vc->scene->toolsettings;
@ -1339,6 +1347,11 @@ static void do_mesh_box_select(ViewContext *vc, rcti *rect, int select)
data.pass = 0;
data.done = 0;
if (extend == 0 && select)
{
EM_deselect_all(vc->em);
}
bbsel= EM_init_backbuf_border(vc, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
@ -1387,6 +1400,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
MetaElem *ml;
unsigned int buffer[4*MAXPICKBUF];
int a, index;
int extend;
short hits, selecting;
view3d_operator_needs_opengl(C);
@ -1399,31 +1413,41 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
rect.ymin= RNA_int_get(op->ptr, "ymin");
rect.xmax= RNA_int_get(op->ptr, "xmax");
rect.ymax= RNA_int_get(op->ptr, "ymax");
extend = RNA_boolean_get(op->ptr, "extend");
if(obedit==NULL && (paint_facesel_test(OBACT))) {
face_borderselect(C, obact, &rect, selecting);
face_borderselect(C, obact, &rect, selecting, extend);
return OPERATOR_FINISHED;
}
else if(obedit==NULL && (obact && obact->mode & OB_MODE_PARTICLE_EDIT)) {
return PE_border_select(C, &rect, selecting);
return PE_border_select(C, &rect, selecting, extend);
}
if(obedit) {
if(obedit->type==OB_MESH) {
Mesh *me= obedit->data;
vc.em= me->edit_mesh;
do_mesh_box_select(&vc, &rect, selecting);
do_mesh_box_select(&vc, &rect, selecting, extend);
// if (EM_texFaceCheck())
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
}
else if(ELEM(obedit->type, OB_CURVE, OB_SURF)) {
do_nurbs_box_select(&vc, &rect, selecting);
do_nurbs_box_select(&vc, &rect, selecting, extend);
}
else if(obedit->type==OB_MBALL) {
MetaBall *mb = (MetaBall*)obedit->data;
hits= view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect);
if (extend == 0 && selecting) {
ml= mb->editelems->first;
while(ml) {
ml->flag &= ~SELECT;
ml= ml->next;
}
}
ml= mb->editelems->first;
while(ml) {
@ -1452,6 +1476,17 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
for(ebone= arm->edbo->first; ebone; ebone= ebone->next)
ebone->flag &= ~BONE_DONE;
if (extend==0 && selecting) {
/* Set the flags */
CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones) {
/* ignore bone if selection can't change */
if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
}
}
CTX_DATA_END;
}
hits= view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect);
/* first we only check points inside the border */
@ -1500,7 +1535,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
ED_armature_sync_selection(arm->edbo);
}
else if(obedit->type==OB_LATTICE) {
do_lattice_box_select(&vc, &rect, selecting);
do_lattice_box_select(&vc, &rect, selecting, extend);
}
}
else { /* no editmode, unified for bones and objects */
@ -1516,6 +1551,25 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
else
bone_only= 0;
if (extend == 0 && selecting) {
base= FIRSTBASE;
if (bone_only) {
CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones) {
pchan->bone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
}
CTX_DATA_END;
} else {
while(base) {
Base *next = base->next;
if(base->lay & v3d->lay) {
ED_base_object_select(base, BA_DESELECT);
}
base= next;
}
}
}
/* selection buffer now has bones potentially too, so we add MAXPICKBUF */
vbuffer = MEM_mallocN(4 * (totobj+MAXPICKBUF) * sizeof(unsigned int), "selection buffer");
hits= view3d_opengl_select(&vc, vbuffer, 4*(totobj+MAXPICKBUF), &rect);

@ -1323,7 +1323,7 @@ void UV_OT_select_inverse(wmOperatorType *ot)
/* ******************** (de)select all operator **************** */
static int de_select_all_exec(bContext *C, wmOperator *op)
static int select_all_exec(bContext *C, wmOperator *op)
{
Scene *scene;
ToolSettings *ts;
@ -1332,7 +1332,7 @@ static int de_select_all_exec(bContext *C, wmOperator *op)
EditFace *efa;
Image *ima;
MTFace *tf;
int sel;
int action = RNA_enum_get(op->ptr, "action");
scene= CTX_data_scene(C);
ts= CTX_data_tool_settings(C);
@ -1341,18 +1341,33 @@ static int de_select_all_exec(bContext *C, wmOperator *op)
ima= CTX_data_edit_image(C);
if(ts->uv_flag & UV_SYNC_SELECTION) {
EM_toggle_select_all(em);
switch (action) {
case SEL_TOGGLE:
EM_toggle_select_all(em);
break;
case SEL_SELECT:
EM_select_all(em);
break;
case SEL_DESELECT:
EM_deselect_all(em);
break;
case SEL_INVERT:
EM_select_swap(em);
break;
}
}
else {
sel= 0;
for(efa= em->faces.first; efa; efa= efa->next) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
for(efa= em->faces.first; efa; efa= efa->next) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(uvedit_face_visible(scene, ima, efa, tf)) {
if(tf->flag & (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4)) {
sel= 1;
break;
if(uvedit_face_visible(scene, ima, efa, tf)) {
if(tf->flag & (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4)) {
action = SEL_DESELECT;
break;
}
}
}
}
@ -1361,13 +1376,27 @@ static int de_select_all_exec(bContext *C, wmOperator *op)
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(uvedit_face_visible(scene, ima, efa, tf)) {
if(efa->v4) {
if(sel) tf->flag &= ~(TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4);
else tf->flag |= (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4);
}
else {
if(sel) tf->flag &= ~(TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4);
else tf->flag |= (TF_SEL1+TF_SEL2+TF_SEL3);
char select_flag;
if(efa->v4)
select_flag = (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4);
else
select_flag = (TF_SEL1+TF_SEL2+TF_SEL3);
switch (action) {
case SEL_SELECT:
tf->flag |= select_flag;
break;
case SEL_DESELECT:
tf->flag &= ~select_flag;
break;
case SEL_INVERT:
if ((tf->flag & select_flag) == select_flag) {
tf->flag &= ~select_flag;
} else {
tf->flag &= ~select_flag;
}
break;
}
}
}
@ -1379,17 +1408,19 @@ static int de_select_all_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
void UV_OT_select_all_toggle(wmOperatorType *ot)
void UV_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Select or Deselect All";
ot->description= "(de)select all UV vertices.";
ot->idname= "UV_OT_select_all_toggle";
ot->description= "Change selection of all UV vertices.";
ot->idname= "UV_OT_select_all";
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
ot->exec= de_select_all_exec;
ot->exec= select_all_exec;
ot->poll= ED_operator_uvedit;
WM_operator_properties_select_all(ot);
}
/* ******************** mouse select operator **************** */
@ -3065,7 +3096,7 @@ void UV_OT_tile_set(wmOperatorType *ot)
void ED_operatortypes_uvedit(void)
{
WM_operatortype_append(UV_OT_select_all_toggle);
WM_operatortype_append(UV_OT_select_all);
WM_operatortype_append(UV_OT_select_inverse);
WM_operatortype_append(UV_OT_select);
WM_operatortype_append(UV_OT_select_loop);
@ -3121,7 +3152,7 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
/* selection manipulation */
WM_keymap_add_item(keymap, "UV_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "UV_OT_unlink_selection", LKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "UV_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "UV_OT_select_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "UV_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "UV_OT_select_pinned", PKEY, KM_PRESS, KM_SHIFT, 0);

@ -197,6 +197,13 @@ void WM_operator_properties_create_ptr(struct PointerRNA *ptr, struct wmOperato
void WM_operator_properties_free(struct PointerRNA *ptr);
void WM_operator_properties_filesel(struct wmOperatorType *ot, int filter, short type);
void WM_operator_properties_gesture_border(wmOperatorType *ot, int extend);
void WM_operator_properties_select_all(wmOperatorType *ot);
/* MOVE THIS SOMEWHERE ELSE */
#define SEL_TOGGLE 0
#define SEL_SELECT 1
#define SEL_DESELECT 2
#define SEL_INVERT 3
/* operator as a python command (resultuing string must be free'd) */
char *WM_operator_pystring(struct bContext *C, struct wmOperatorType *ot, struct PointerRNA *opptr, int all_args);

@ -668,6 +668,18 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type)
RNA_def_property_flag(prop, PROP_HIDDEN);
}
void WM_operator_properties_select_all(wmOperatorType *ot) {
static EnumPropertyItem select_all_actions[] = {
{SEL_TOGGLE, "TOGGLE", 0, "Toggle", "Toggle selection for all elements"},
{SEL_SELECT, "SELECT", 0, "Select", "Select all elements"},
{SEL_DESELECT, "DESELECT", 0, "Deselect", "Deselect all elements"},
{SEL_INVERT, "INVERT", 0, "Invert", "Invert selection of all elements"},
{0, NULL, 0, NULL, NULL}
};
RNA_def_enum(ot->srna, "action", select_all_actions, SEL_TOGGLE, "Action", "Selection action to execute");
}
void WM_operator_properties_gesture_border(wmOperatorType *ot, int extend)
{
RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX);
@ -677,7 +689,7 @@ void WM_operator_properties_gesture_border(wmOperatorType *ot, int extend)
RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
if(extend)
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first.");
RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first.");
}