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:
authorCampbell Barton <ideasman42@gmail.com>2018-08-14 03:28:41 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-08-14 18:48:55 +0300
commite88e80a6a0c8976ac2d245c274ca5a0388736743 (patch)
tree870bc13538dfb5b55d4063cdab0aa611573dde60 /source/blender/windowmanager/intern
parentd92d310b158d4b946aa8b811248b25e7a39f7a1a (diff)
3D View boarder/lasso select tool options
Add tool options to control how select operates (add/sub/set/and/xor). Note: edit mode armature select still needs to support all options, this is complicated by how it handles partial end-point selection.
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r--source/blender/windowmanager/intern/wm_gesture_ops.c19
-rw-r--r--source/blender/windowmanager/intern/wm_operator_props.c16
2 files changed, 33 insertions, 2 deletions
diff --git a/source/blender/windowmanager/intern/wm_gesture_ops.c b/source/blender/windowmanager/intern/wm_gesture_ops.c
index 01184f47920..a4d811bf91b 100644
--- a/source/blender/windowmanager/intern/wm_gesture_ops.c
+++ b/source/blender/windowmanager/intern/wm_gesture_ops.c
@@ -49,6 +49,7 @@
#include "wm_event_system.h"
#include "ED_screen.h"
+#include "ED_select_utils.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -86,13 +87,22 @@ static void gesture_modal_state_to_operator(wmOperator *op, int modal_state)
case GESTURE_MODAL_SELECT:
case GESTURE_MODAL_DESELECT:
if ((prop = RNA_struct_find_property(op->ptr, "deselect"))) {
- RNA_property_boolean_set(op->ptr, prop, (modal_state == GESTURE_MODAL_DESELECT));
+ if (!RNA_property_is_set(op->ptr, prop)) {
+ RNA_property_boolean_set(op->ptr, prop, (modal_state == GESTURE_MODAL_DESELECT));
+ }
+ }
+ if ((prop = RNA_struct_find_property(op->ptr, "mode"))) {
+ if (!RNA_property_is_set(op->ptr, prop)) {
+ RNA_property_enum_set(op->ptr, prop, (modal_state == GESTURE_MODAL_DESELECT) ? SEL_OP_SUB : SEL_OP_ADD);
+ }
}
break;
case GESTURE_MODAL_IN:
case GESTURE_MODAL_OUT:
if ((prop = RNA_struct_find_property(op->ptr, "zoom_out"))) {
- RNA_property_boolean_set(op->ptr, prop, (modal_state == GESTURE_MODAL_OUT));
+ if (!RNA_property_is_set(op->ptr, prop)) {
+ RNA_property_boolean_set(op->ptr, prop, (modal_state == GESTURE_MODAL_OUT));
+ }
}
break;
}
@@ -107,6 +117,11 @@ static int gesture_modal_state_from_operator(wmOperator *op)
return RNA_property_boolean_get(op->ptr, prop) ? GESTURE_MODAL_DESELECT : GESTURE_MODAL_SELECT;
}
}
+ if ((prop = RNA_struct_find_property(op->ptr, "mode"))) {
+ if (RNA_property_is_set(op->ptr, prop)) {
+ return RNA_property_enum_get(op->ptr, prop) == SEL_OP_SUB ? GESTURE_MODAL_DESELECT : GESTURE_MODAL_SELECT;
+ }
+ }
if ((prop = RNA_struct_find_property(op->ptr, "zoom_out"))) {
if (RNA_property_is_set(op->ptr, prop)) {
return RNA_property_boolean_get(op->ptr, prop) ? GESTURE_MODAL_OUT : GESTURE_MODAL_IN;
diff --git a/source/blender/windowmanager/intern/wm_operator_props.c b/source/blender/windowmanager/intern/wm_operator_props.c
index d4fb7279abc..ceb0fb75f78 100644
--- a/source/blender/windowmanager/intern/wm_operator_props.c
+++ b/source/blender/windowmanager/intern/wm_operator_props.c
@@ -39,6 +39,8 @@
#include "RNA_define.h"
#include "RNA_enum_types.h"
+#include "ED_select_utils.h"
+
#include "WM_api.h"
#include "WM_types.h"
@@ -250,6 +252,20 @@ void WM_operator_properties_gesture_border(wmOperatorType *ot)
WM_operator_properties_gesture_border_ex(ot, false, false);
}
+void WM_operator_properties_select_operation(wmOperatorType *ot)
+{
+ static const EnumPropertyItem select_mode_items[] = {
+ {SEL_OP_ADD, "ADD", 0, "Add", ""},
+ {SEL_OP_SUB, "SUB", 0, "Subtract", ""},
+ {SEL_OP_SET, "SET", 0, "Set", ""},
+ {SEL_OP_AND, "AND", 0, "And", ""},
+ {SEL_OP_XOR, "XOR", 0, "Xor", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+ PropertyRNA *prop = RNA_def_enum(ot->srna, "mode", select_mode_items, SEL_OP_ADD, "Mode", "");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+}
+
void WM_operator_properties_gesture_border_zoom(wmOperatorType *ot)
{
WM_operator_properties_border(ot);