diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2016-06-08 16:51:01 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2016-06-08 17:05:23 +0300 |
commit | fc96110bb56f15b947de8e29a12731fe35aa8dff (patch) | |
tree | 87d6bf75570179c37ba2fed63cb2bc58c10f177e /source/blender/windowmanager/intern | |
parent | 37fc4b575fcf8bff2401aefa84df5537fe0d744f (diff) |
Make uiLists placed in popups usable
It's still not completely working - there are still some glitches - but far better than before.
To make buttons of the uiList work, you have to add a 'check' callback to the operator that invokes the menu. Only if it returns True, the uiList gets refreshed. To avoid this we have to make the region refresh tagging in the entire button handling a bit smarter.
Changes I had to do:
* Call uiList handling from menu/popup handling if needed.
* Make uiList handling use special popup refresh tag if placed in menu.
* Allow popups invoked from py operator to tag for refresh by using operator 'check' callback.
* Tag popup for refresh when resizing uiList.
Mostly fixes T48612.
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index b4295bb2607..866e332b34f 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1391,7 +1391,7 @@ static void dialog_exec_cb(bContext *C, void *arg1, void *arg2) } } -static void dialog_check_cb(bContext *C, void *op_ptr, void *UNUSED(arg)) +static void popup_check_cb(bContext *C, void *op_ptr, void *UNUSED(arg)) { wmOperator *op = op_ptr; if (op->type->check) { @@ -1423,7 +1423,7 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData) layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style); - UI_block_func_set(block, dialog_check_cb, op, NULL); + UI_block_func_set(block, popup_check_cb, op, NULL); uiLayoutOperatorButs(C, layout, op, NULL, 'H', UI_LAYOUT_OP_SHOW_TITLE); @@ -1463,9 +1463,13 @@ static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData) layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style); + UI_block_func_set(block, popup_check_cb, op, NULL); + /* since ui is defined the auto-layout args are not used */ uiLayoutOperatorButs(C, layout, op, NULL, 'V', 0); + UI_block_func_set(block, NULL, NULL, NULL); + UI_block_bounds_set_popup(block, 4, 0, 0); return block; |