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.
This commit is contained in:
parent
6704372f04
commit
3cc7e2ad9d
Notes:
blender-bot
2023-02-14 06:47:29 +01:00
Referenced by issue #84276, Asset Browser: Sidebar is hidden when clicking to add a custom thumbnail Referenced by issue #84278, Asset Browser: Sidebar doesn't hide when clicking the gear icon once
|
@ -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,13 +282,14 @@ 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_props) {
|
||||
BLI_assert(region_execute);
|
||||
|
||||
ED_region_remove(C, area, region_props);
|
||||
if (region_execute) {
|
||||
ED_region_remove(C, area, region_execute);
|
||||
needs_init = true;
|
||||
}
|
||||
if (region_props) {
|
||||
ED_region_remove(C, area, region_props);
|
||||
needs_init = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (needs_init) {
|
||||
|
|
Loading…
Reference in New Issue