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-07-25 04:02:12 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-07-25 04:02:12 +0300
commit2e112f591413eb8b49595c209298d61fec612476 (patch)
treeda3f2c2ed43eaf574616b301554656a9ad109a65 /source/blender/editors
parentd8514482fe6b750070270ac886d49d06d28a9a9b (diff)
Keymap: Use 1..4 to change UV select modes
Support for sync selection switching which keys apply.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/ED_object.h1
-rw-r--r--source/blender/editors/mesh/editmesh_select.c12
-rw-r--r--source/blender/editors/mesh/mesh_ops.c18
-rw-r--r--source/blender/editors/object/object_ops.c24
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c10
5 files changed, 49 insertions, 16 deletions
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index 38545137740..9fd5cc99073 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -112,6 +112,7 @@ void ED_keymap_proportional_obmode(struct wmKeyConfig *keyconf, struct wmKeyMap
void ED_keymap_proportional_maskmode(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap);
void ED_keymap_proportional_editmode(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap,
const bool do_connected);
+void ED_keymap_editmesh_elem_mode(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap);
void ED_object_base_select(struct Base *base, eObjectSelect_Mode mode);
void ED_object_base_activate(struct bContext *C, struct Base *base);
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 2e7cf1fc76f..cdb8981801a 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -1462,6 +1462,18 @@ static int edbm_select_mode_exec(bContext *C, wmOperator *op)
static int edbm_select_mode_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
+ /* Bypass when in UV non sync-select mode, fall through to keymap that edits. */
+ if (CTX_wm_space_image(C)) {
+ ToolSettings *ts = CTX_data_tool_settings(C);
+ if ((ts->uv_flag & UV_SYNC_SELECTION) == 0) {
+ return OPERATOR_PASS_THROUGH;
+ }
+ /* Bypass when no action is needed. */
+ if (!RNA_struct_property_is_set(op->ptr, "type")) {
+ return OPERATOR_CANCELLED;
+ }
+ }
+
/* detecting these options based on shift/ctrl here is weak, but it's done
* to make this work when clicking buttons or menus */
if (!RNA_struct_property_is_set(op->ptr, "use_extend"))
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 0fcc5ada854..79c8f5c0b09 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -335,22 +335,8 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "MESH_OT_bevel", BKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "vertex_only", true);
- /* selecting */
- for (int i = 0; i < 4; i++) {
- const bool is_extend = (i & 1);
- const bool is_expand = (i & 2);
- const int key_modifier = (is_extend ? KM_SHIFT : 0) | (is_expand ? KM_CTRL : 0);
- for (int j = 0; j < 3; j++) {
- kmi = WM_keymap_add_item(keymap, "MESH_OT_select_mode", ONEKEY + j, KM_PRESS, key_modifier, 0);
- RNA_enum_set(kmi->ptr, "type", SCE_SELECT_VERTEX << j);
- if (is_extend) {
- RNA_boolean_set(kmi->ptr, "use_extend", true);
- }
- if (is_expand) {
- RNA_boolean_set(kmi->ptr, "use_expand", true);
- }
- }
- }
+ /* Selec Vert/Edge/Face. */
+ ED_keymap_editmesh_elem_mode(keyconf, keymap);
/* standard mouse selection goes via space_view3d */
kmi = WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 5a83d085aee..7b6c1156874 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -40,6 +40,7 @@
#include "BKE_context.h"
#include "RNA_access.h"
+#include "RNA_enum_types.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -490,3 +491,26 @@ void ED_keymap_proportional_editmode(struct wmKeyConfig *UNUSED(keyconf), struct
RNA_string_set(kmi->ptr, "value_2", "CONNECTED");
}
}
+
+/**
+ * Map 1..3 to Vert/Edge/Face.
+ */
+void ED_keymap_editmesh_elem_mode(struct wmKeyConfig *UNUSED(keyconf), struct wmKeyMap *keymap)
+{
+ for (int i = 0; i < 4; i++) {
+ const bool is_extend = (i & 1);
+ const bool is_expand = (i & 2);
+ const int key_modifier = (is_extend ? KM_SHIFT : 0) | (is_expand ? KM_CTRL : 0);
+ for (int j = 0; j < 3; j++) {
+ wmKeyMapItem *kmi = WM_keymap_add_item(
+ keymap, "MESH_OT_select_mode", ONEKEY + j, KM_PRESS, key_modifier, 0);
+ RNA_enum_set(kmi->ptr, "type", SCE_SELECT_VERTEX << j);
+ if (is_extend) {
+ RNA_boolean_set(kmi->ptr, "use_extend", true);
+ }
+ if (is_expand) {
+ RNA_boolean_set(kmi->ptr, "use_expand", true);
+ }
+ }
+ }
+}
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 51e2c1b6334..32bf32b03ab 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -80,6 +80,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
+#include "RNA_enum_types.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -4404,6 +4405,15 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_uv_sculpt");
#endif
+ /* Select Element (Sync Select: on) */
+ ED_keymap_editmesh_elem_mode(keyconf, keymap);
+ /* Hack to prevent fall-through, when the button isn't visible. */
+ WM_keymap_add_item(keymap, "MESH_OT_select_mode", FOURKEY, KM_PRESS, 0, 0);
+ /* Select Element (Sync Select: off) */
+ WM_keymap_add_context_enum_set_items(
+ keymap, rna_enum_mesh_select_mode_uv_items, "tool_settings.uv_select_mode",
+ ONEKEY, KM_PRESS, 0, 0);
+
/* Mark edge seam */
WM_keymap_add_item(keymap, "UV_OT_mark_seam", EKEY, KM_PRESS, KM_CTRL, 0);