Cleanup: Use recently added helper function to find File Browser UI data
`ED_fileselect_handler_area_find()` was added in a750acab78
and makes this
case more readable and avoids code duplication as well.
This commit is contained in:
parent
bc0a6b0400
commit
c32bee0099
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue