Fix T46537: UV Image Editor. UV Sculpt toggle button doesn't show hotkey label when...
authorBastien Montagne <montagne29@wanadoo.fr>
Mon, 26 Oct 2015 15:34:18 +0000 (16:34 +0100)
committerBastien Montagne <montagne29@wanadoo.fr>
Mon, 26 Oct 2015 15:37:59 +0000 (16:37 +0100)
Poll function of that keymap was slightly... agressive.

source/blender/editors/interface/interface.c
source/blender/editors/sculpt_paint/paint_intern.h
source/blender/editors/sculpt_paint/paint_ops.c
source/blender/editors/sculpt_paint/sculpt_uv.c

index e9bc0f905984e9bd9936c7647aaae1e6e091229e..28e1f541240a0be2b0aee7dd67bd14f381f350a2 100644 (file)
@@ -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))
                                {
index fd7e053fea37d7d012ab7658eb373f7a03ac27d9..f1e35f84576621b39cc315852c04fb94fa984a71 100644 (file)
@@ -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);
 
index 05eda4da63b436f7e307221d2604a96cbfa9acaa..cee92abe03d6e08f106ada01491f497e8b6139a8 100644 (file)
@@ -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");
index 405ac3f68081ab35f48670b4be3d5427f0cadc7c..b8fec17ca5a18805a0a490f120e18b953a678943 100644 (file)
@@ -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 ************************/