[Bf-blender-cvs] [3cc7e2ad9d7] master: Fix various issues with regions in Asset Browser

Julian Eisel noreply at git.blender.org
Thu Jan 14 13:46:57 CET 2021


Commit: 3cc7e2ad9d7531fa8af2e2bba542fed5c5cba3ff
Author: Julian Eisel
Date:   Thu Jan 14 13:29:36 2021 +0100
Branches: master
https://developer.blender.org/rB3cc7e2ad9d7531fa8af2e2bba542fed5c5cba3ff

Fix various issues with regions in Asset Browser

Fixes a number of glitches, e.g. the sidebar disappearing when selecting an
asset or wrong AZones (the little chevrons to indicate a hidden region).

There were a couple of issues:
* Execution region was created, but not used.
* If an execution region already existed when refreshing the area, it was
  tagged as hidden, not removed.
* The sidebar was always set to be hidden on refreshes.
* When toggling from Asset Browser to File Browser as regular editor (i.e. not
  opened temporary via Ctrl+O or such), the sidebar region wasn't removed.

Adresses T83644.

===================================================================

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 aedc6228355..9fb69c7301a 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -104,6 +104,7 @@ static ARegion *file_tool_props_region_ensure(ScrArea *area, ARegion *region_pre
   BLI_insertlinkafter(&area->regionbase, region_prev, region);
   region->regiontype = RGN_TYPE_TOOL_PROPS;
   region->alignment = RGN_ALIGN_RIGHT;
+  region->flag = RGN_FLAG_HIDDEN;
 
   return region;
 }
@@ -246,13 +247,13 @@ static void file_ensure_valid_region_state(bContext *C,
   BLI_assert(region_tools);
 
   if (sfile->browse_mode == FILE_BROWSE_MODE_ASSETS) {
-    ARegion *region_execute = file_execute_region_ensure(area, region_tools);
-    ARegion *region_props = file_tool_props_region_ensure(area, region_execute);
-
-    /* Hide specific regions by default. */
-    region_props->flag |= RGN_FLAG_HIDDEN;
-    region_execute->flag |= RGN_FLAG_HIDDEN;
+    file_tool_props_region_ensure(area, region_tools);
 
+    ARegion *region_execute = BKE_area_find_region_type(area, RGN_TYPE_EXECUTE);
+    if (region_execute) {
+      ED_region_remove(C, area, region_execute);
+      needs_init = true;
+    }
     ARegion *region_ui = BKE_area_find_region_type(area, RGN_TYPE_UI);
     if (region_ui) {
       ED_region_remove(C, area, region_ui);
@@ -281,11 +282,12 @@ static void file_ensure_valid_region_state(bContext *C,
     ARegion *region_ui = file_ui_region_ensure(area, region_tools);
     UNUSED_VARS(region_ui);
 
+    if (region_execute) {
+      ED_region_remove(C, area, region_execute);
+      needs_init = true;
+    }
     if (region_props) {
-      BLI_assert(region_execute);
-
       ED_region_remove(C, area, region_props);
-      ED_region_remove(C, area, region_execute);
       needs_init = true;
     }
   }



More information about the Bf-blender-cvs mailing list