[Bf-blender-cvs] [4a74b3803ae] temp-lanpr-cleanup: Fix empty file options region in regular editor
Julian Eisel
noreply at git.blender.org
Wed Sep 25 03:50:39 CEST 2019
Commit: 4a74b3803ae1b5276ab1fd5a71e1bf6ec655f42a
Author: Julian Eisel
Date: Fri Sep 20 12:03:32 2019 +0200
Branches: temp-lanpr-cleanup
https://developer.blender.org/rB4a74b3803ae1b5276ab1fd5a71e1bf6ec655f42a
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
===================================================================
M source/blender/editors/space_file/space_file.c
===================================================================
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 2f0e796d500..e0e015266af 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -279,6 +279,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();
@@ -341,8 +342,30 @@ static void file_refresh(const bContext *C, ScrArea *sa)
}
/* Might be called with NULL sa, see file_main_region_draw() below. */
- if (sa) {
- file_ensure_valid_region_state((bContext *)C, wm, win, sa, sfile, params);
+ if (sa && BKE_area_find_region_type(sa, RGN_TYPE_TOOLS) == NULL) {
+ /* Create TOOLS region. */
+ file_tools_region(sa);
+
+ ED_area_initialize(wm, win, sa);
+ }
+
+ /* 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) {
+ region_props->flag |= RGN_FLAG_HIDDEN;
+ }
+
+ 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);
More information about the Bf-blender-cvs
mailing list