diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2019-09-20 13:03:32 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2019-09-20 13:13:28 +0300 |
commit | 09b728ff3e3702ab7718f8604a8712ce34783803 (patch) | |
tree | 7c0f8df987019f3454dde30039c8aec91dc973a0 /source/blender/editors/space_file/space_file.c | |
parent | 078fcc62534c21fd02b6549d51669763649a20f9 (diff) |
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
Diffstat (limited to 'source/blender/editors/space_file/space_file.c')
-rw-r--r-- | source/blender/editors/space_file/space_file.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index d6a4eafc658..34429570671 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -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); } |