Fix T46537: UV Image Editor. UV Sculpt toggle button doesn't show hotkey label when active.
Poll function of that keymap was slightly... agressive.
This commit is contained in:
parent
3751eb18c3
commit
5b3af3dd46
Notes:
blender-bot
2023-02-14 08:31:08 +01:00
Referenced by commit 2c3985d9e6
, Fix T47842: UV sculpt brush widgets are available when not in uv sculpt mode.
Referenced by issue #47842, UV sculpt brush widgets are available when not in uv sculpt mode.
Referenced by issue #46537, UV Image Editor. UV Sculpt toggle button doesn't show hotkey label when active
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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 ************************/
|
||||
|
|
Loading…
Reference in New Issue