Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Poirier <theeth@yahoo.com>2009-11-30 01:16:29 +0300
committerMartin Poirier <theeth@yahoo.com>2009-11-30 01:16:29 +0300
commitcd154da9732962870339952898499ed1b1c32d93 (patch)
treef59446523990d985a92542ab781d7707c8753009 /source/blender/editors/object/object_select.c
parent92b4316708bad0448f4c433ef9c6c2d3cc1f4fb5 (diff)
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.
Diffstat (limited to 'source/blender/editors/object/object_select.c')
-rw-r--r--source/blender/editors/object/object_select.c55
1 files changed, 35 insertions, 20 deletions
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 20f3ea3df9e..5366446c8ae 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -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;
-
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
- if (base->flag & SELECT) {
- ok= a= 1;
- break;
+ /* 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;
+ }
}
- else ok=1;
+ CTX_DATA_END;
}
- 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);
+ 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;
+ }
}
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 ****************************/