diff options
author | Julian Eisel <julian@blender.org> | 2020-11-03 02:21:26 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-11-03 14:27:20 +0300 |
commit | c32bee0099f917012298b99884aa881877c800b0 (patch) | |
tree | 46e0b7d076abcd3ab36572a9b2037a9b2ae9cff0 /source | |
parent | bc0a6b0400ceeda971384bd88014ea7eb6007ad0 (diff) |
Cleanup: Use recently added helper function to find File Browser UI data
`ED_fileselect_handler_area_find()` was added in a750acab78cf and makes this
case more readable and avoids code duplication as well.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index ee0c7df99e7..071951abda3 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -3484,25 +3484,15 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op) if (handler->is_fileselect == false) { continue; } - bScreen *screen = CTX_wm_screen(C); - bool cancel_handler = true; - /* Find the area with the file selector for this handler. */ - ED_screen_areas_iter (win, screen, area) { - if (area->spacetype == SPACE_FILE) { - SpaceFile *sfile = area->spacedata.first; + ScrArea *file_area = ED_fileselect_handler_area_find(win, handler->op); - if (sfile->op == handler->op) { - CTX_wm_area_set(C, area); - wm_handler_fileselect_do(C, &win->modalhandlers, handler, EVT_FILESELECT_CANCEL); - cancel_handler = false; - break; - } - } + if (file_area) { + CTX_wm_area_set(C, file_area); + wm_handler_fileselect_do(C, &win->modalhandlers, handler, EVT_FILESELECT_CANCEL); } - /* If not found we stop the handler without changing the screen. */ - if (cancel_handler) { + else { wm_handler_fileselect_do( C, &win->modalhandlers, handler, EVT_FILESELECT_EXTERNAL_CANCEL); } |