Fix empty file options region in regular editor
This would happen when opening a file browser as regular editor, opening a temporary file browser from there (e.g. Ctrl+O) and cancelling the operation. In some cases this would cause most of the editor to be filled with an empty operator options region: * Go to Shading workspace * File -> Append * Cancel
This commit is contained in:
parent
078fcc6253
commit
09b728ff3e
|
@ -225,6 +225,7 @@ static void file_refresh(const bContext *C, ScrArea *sa)
|
|||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
FileSelectParams *params = ED_fileselect_get_params(sfile);
|
||||
struct FSMenu *fsmenu = ED_fsmenu_get();
|
||||
ARegion *region_tool_props = BKE_area_find_region_type(sa, RGN_TYPE_TOOL_PROPS);
|
||||
|
||||
if (!sfile->folders_prev) {
|
||||
sfile->folders_prev = folderlist_new();
|
||||
|
@ -293,8 +294,9 @@ static void file_refresh(const bContext *C, ScrArea *sa)
|
|||
|
||||
ED_area_initialize(wm, win, sa);
|
||||
}
|
||||
if (sa && sfile->op && BKE_area_find_region_type(sa, RGN_TYPE_TOOL_PROPS) == NULL) {
|
||||
/* Create TOOL_PROPS region. */
|
||||
|
||||
/* If there's an file-operation, ensure we have the option region */
|
||||
if (sa && sfile->op && (region_tool_props == NULL)) {
|
||||
ARegion *region_props = file_tool_props_region(sa);
|
||||
|
||||
if (params->flag & FILE_HIDE_TOOL_PROPS) {
|
||||
|
@ -303,6 +305,14 @@ static void file_refresh(const bContext *C, ScrArea *sa)
|
|||
|
||||
ED_area_initialize(wm, win, sa);
|
||||
}
|
||||
/* If there's _no_ file-operation, ensure we _don't_ have the option region */
|
||||
else if (sa && (sfile->op == NULL) && (region_tool_props != NULL)) {
|
||||
/* Remove TOOL_PROPS region. */
|
||||
ED_region_exit((bContext *)C, region_tool_props);
|
||||
BKE_area_region_free(sa->type, region_tool_props);
|
||||
BLI_remlink(&sa->regionbase, region_tool_props);
|
||||
MEM_freeN(region_tool_props);
|
||||
}
|
||||
|
||||
ED_area_tag_redraw(sa);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue