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
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')
-rw-r--r--source/blender/windowmanager/WM_api.h10
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c1
-rw-r--r--source/blender/windowmanager/intern/wm_gesture_ops.c19
-rw-r--r--source/blender/windowmanager/intern/wm_operator_props.c16
4 files changed, 35 insertions, 11 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index b15ce2d11ad..45f6e188483 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -364,6 +364,7 @@ void WM_operator_properties_select_action(struct wmOperatorType *ot, int
void WM_operator_properties_select_action_simple(struct wmOperatorType *ot, int default_action);
void WM_operator_properties_select_random(struct wmOperatorType *ot);
int WM_operator_properties_select_random_seed_increment_get(wmOperator *op);
+void WM_operator_properties_select_operation(struct wmOperatorType *ot);
struct CheckerIntervalParams {
int nth; /* bypass when set to zero */
int skip;
@@ -375,14 +376,6 @@ void WM_operator_properties_checker_interval_from_op(
bool WM_operator_properties_checker_interval_test(
const struct CheckerIntervalParams *op_params, int depth);
-
-/* MOVE THIS SOMEWHERE ELSE */
-#define SEL_TOGGLE 0
-#define SEL_SELECT 1
-#define SEL_DESELECT 2
-#define SEL_INVERT 3
-
-
/* flags for WM_operator_properties_filesel */
#define WM_FILESEL_RELPATH (1 << 0)
@@ -391,7 +384,6 @@ bool WM_operator_properties_checker_interval_test(
#define WM_FILESEL_FILEPATH (1 << 3)
#define WM_FILESEL_FILES (1 << 4)
-
/* operator as a python command (resultuing string must be freed) */
char *WM_operator_pystring_ex(struct bContext *C, struct wmOperator *op,
const bool all_args, const bool macro_args,
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
index 0b54f0cbec1..d0f6ab9f451 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
@@ -39,6 +39,7 @@
#include "BKE_global.h"
#include "ED_screen.h"
+#include "ED_select_utils.h"
#include "ED_view3d.h"
#include "GPU_glew.h"
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);