diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-09-30 18:59:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-09-30 18:59:31 +0300 |
commit | 5940f6b3d9cfa99a1b893b6149d36ee0a8c51584 (patch) | |
tree | 0f57b988058f2099808be12a6a59f5043c70b457 /source/blender/editors/interface/interface_query.c | |
parent | 68c2f7a2d06fa1146f862e4f0959d9aeb60d7456 (diff) |
Fix T58683: Reload Scripts breaks toolbar button formatting
Add a function which clears internal cached operator pointers,
run before reloading scripts.
Diffstat (limited to 'source/blender/editors/interface/interface_query.c')
-rw-r--r-- | source/blender/editors/interface/interface_query.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c index 457d01c5dc8..34b1070f8b4 100644 --- a/source/blender/editors/interface/interface_query.c +++ b/source/blender/editors/interface/interface_query.c @@ -137,15 +137,15 @@ bool ui_but_has_array_value(const uiBut *but) PROP_COORDS)); } +static wmOperatorType *g_ot_tool_set_by_id = NULL; bool UI_but_is_tool(const uiBut *but) { /* very evil! */ if (but->optype != NULL) { - static wmOperatorType *ot = NULL; - if (ot == NULL) { - ot = WM_operatortype_find("WM_OT_tool_set_by_id", false); + if (g_ot_tool_set_by_id == NULL) { + g_ot_tool_set_by_id = WM_operatortype_find("WM_OT_tool_set_by_id", false); } - if (but->optype == ot) { + if (but->optype == g_ot_tool_set_by_id) { return true; } } @@ -615,3 +615,14 @@ ARegion *ui_screen_region_find_mouse_over(bScreen *screen, const wmEvent *event) } /** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Manage Internal State + * \{ */ + +void ui_interface_tag_script_reload_queries(void) +{ + g_ot_tool_set_by_id = NULL; +} + +/** \} */ |