diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-10-26 18:34:18 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-10-26 18:37:59 +0300 |
commit | 5b3af3dd46307fcf5389f1ede9cfb9da77b120a4 (patch) | |
tree | 78e88295a45f5fe14bff9b02bdceb1216f21e3cc /source/blender | |
parent | 3751eb18c3156589fdb6296c1cc6ab0e9ec8b4d4 (diff) |
Fix T46537: UV Image Editor. UV Sculpt toggle button doesn't show hotkey label when active.
Poll function of that keymap was slightly... agressive.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface.c | 1 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_ops.c | 2 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_uv.c | 23 |
4 files changed, 19 insertions, 8 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index e9bc0f90598..28e1f541240 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1093,7 +1093,6 @@ static bool ui_but_event_property_operator_string(const bContext *C, uiBut *but, /* check each until one works... */ for (i = 0; (i < num_ops) && (ctx_toggle_opnames[i]); i++) { - printf("\t%s\n", ctx_toggle_opnames[i]); if (WM_key_event_operator_string(C, ctx_toggle_opnames[i], WM_OP_INVOKE_REGION_WIN, prop_path, false, buf_len, buf)) { diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index fd7e053fea3..f1e35f84576 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -184,6 +184,7 @@ void PAINT_OT_add_simple_uvs(struct wmOperatorType *ot); /* uv sculpting */ int uv_sculpt_poll(struct bContext *C); +int uv_sculpt_keymap_poll(struct bContext *C); void SCULPT_OT_uv_sculpt_stroke(struct wmOperatorType *ot); diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 05eda4da63b..cee92abe03d 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -1487,7 +1487,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf) RNA_boolean_set(kmi->ptr, "deselect", true); keymap = WM_keymap_find(keyconf, "UV Sculpt", 0, 0); - keymap->poll = uv_sculpt_poll; + keymap->poll = uv_sculpt_keymap_poll; kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", QKEY, KM_PRESS, 0, 0); RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_uv_sculpt"); diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 405ac3f6808..b8fec17ca5a 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -157,7 +157,7 @@ static Brush *uv_sculpt_brush(bContext *C) } -static int uv_sculpt_brush_poll(bContext *C) +static int uv_sculpt_brush_poll_do(bContext *C, const bool check_region) { BMEditMesh *em; int ret; @@ -175,13 +175,19 @@ static int uv_sculpt_brush_poll(bContext *C) em = BKE_editmesh_from_object(obedit); ret = EDBM_mtexpoly_check(em); - if (ret) { + if (ret && check_region) { ARegion *ar = CTX_wm_region(C); - if ((toolsettings->use_uv_sculpt) && ar->regiontype == RGN_TYPE_WINDOW) - return 1; + if (!((toolsettings->use_uv_sculpt) && (ar->regiontype == RGN_TYPE_WINDOW))) { + ret = 0; + } } - return 0; + return ret; +} + +static int uv_sculpt_brush_poll(bContext *C) +{ + return uv_sculpt_brush_poll_do(C, true); } static void brush_drawcursor_uvsculpt(bContext *C, int x, int y, void *UNUSED(customdata)) @@ -252,7 +258,12 @@ void ED_space_image_uv_sculpt_update(wmWindowManager *wm, Scene *scene) int uv_sculpt_poll(bContext *C) { - return uv_sculpt_brush_poll(C); + return uv_sculpt_brush_poll_do(C, true); +} + +int uv_sculpt_keymap_poll(bContext *C) +{ + return uv_sculpt_brush_poll_do(C, false); } /*********** Improved Laplacian Relaxation Operator ************************/ |