Commit: 5b3af3dd46307fcf5389f1ede9cfb9da77b120a4 Author: Bastien Montagne Date: Mon Oct 26 16:34:18 2015 +0100 Branches: master https://developer.blender.org/rB5b3af3dd46307fcf5389f1ede9cfb9da77b120a4
Fix T46537: UV Image Editor. UV Sculpt toggle button doesn't show hotkey label when active. Poll function of that keymap was slightly... agressive. =================================================================== M source/blender/editors/interface/interface.c M source/blender/editors/sculpt_paint/paint_intern.h M source/blender/editors/sculpt_paint/paint_ops.c M source/blender/editors/sculpt_paint/sculpt_uv.c =================================================================== diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index e9bc0f9..28e1f54 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 fd7e053..f1e35f8 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 05eda4d..cee92ab 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 405ac3f..b8fec17 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 ************************/ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs