diff options
author | Richard Antalik <richardantalik@gmail.com> | 2022-06-24 11:23:31 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2022-06-24 11:23:31 +0300 |
commit | e08c9324823b24168cdf278c5c9b7ec519335112 (patch) | |
tree | a3c95f37303f729b1be7b0f05d63bb6f8f3b9d63 | |
parent | 3323cd9c9aa07cfc131b295977cd921fe7c547f0 (diff) |
Fix T98925: Editor panels are broken
Commit 277fa2f441f4 added channels region to unintended editors if sequencer was
used in area. This caused issues with some editors having 2 tool regions and
non functioning side panel.
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D15253
-rw-r--r-- | source/blender/blenkernel/BKE_screen.h | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/screen.c | 11 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_300.c | 33 |
3 files changed, 48 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index 4dda21d99b8..3922bfb6c0d 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -440,6 +440,14 @@ void BKE_region_callback_free_gizmomap_set(void (*callback)(struct wmGizmoMap *) void BKE_region_callback_refresh_tag_gizmomap_set(void (*callback)(struct wmGizmoMap *)); /** + * Find a region of type \a region_type in provided \a regionbase. + * + * \note this is useful for versioning where either the #Area or #SpaceLink regionbase are typical + * inputs + */ +struct ARegion *BKE_region_find_in_listbase_by_type(const struct ListBase *regionbase, + const int region_type); +/** * Find a region of type \a region_type in the currently active space of \a area. * * \note This does _not_ work if the region to look up is not in the active space. diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index ebc87c6ccc0..12dc1b6d1fa 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -856,6 +856,17 @@ void BKE_screen_remove_unused_scrverts(bScreen *screen) /* ***************** Utilities ********************** */ +ARegion *BKE_region_find_in_listbase_by_type(const ListBase *regionbase, const int region_type) +{ + LISTBASE_FOREACH (ARegion *, region, regionbase) { + if (region->regiontype == region_type) { + return region; + } + } + + return NULL; +} + ARegion *BKE_area_find_region_type(const ScrArea *area, int region_type) { if (area) { diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index 844354c8bc3..57fd71f8933 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -798,13 +798,16 @@ void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports)) continue; } SpaceSeq *sseq = (SpaceSeq *)sl; + ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase : + &sl->regionbase; sseq->flag |= SEQ_CLAMP_VIEW; if (ELEM(sseq->view, SEQ_VIEW_PREVIEW, SEQ_VIEW_SEQUENCE_PREVIEW)) { continue; } - ARegion *timeline_region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); + ARegion *timeline_region = BKE_region_find_in_listbase_by_type(regionbase, + RGN_TYPE_WINDOW); if (timeline_region == NULL) { continue; @@ -2869,16 +2872,19 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase : &sl->regionbase; - ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_CHANNELS); + ARegion *region = BKE_region_find_in_listbase_by_type(regionbase, RGN_TYPE_CHANNELS); if (!region) { - ARegion *tools_region = BKE_area_find_region_type(area, RGN_TYPE_TOOLS); + /* Find sequencer tools region. */ + ARegion *tools_region = BKE_region_find_in_listbase_by_type(regionbase, + RGN_TYPE_TOOLS); region = do_versions_add_region(RGN_TYPE_CHANNELS, "channels region"); BLI_insertlinkafter(regionbase, tools_region, region); region->alignment = RGN_ALIGN_LEFT; region->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL; } - ARegion *timeline_region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); + ARegion *timeline_region = BKE_region_find_in_listbase_by_type(regionbase, + RGN_TYPE_WINDOW); if (timeline_region != NULL) { timeline_region->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL; } @@ -3176,5 +3182,24 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) */ { /* Keep this block, even when empty. */ + + /* Fix for T98925 - remove channels region, that was initialized in incorrect editor types. */ + for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { + LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { + LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) { + if (ELEM(sl->spacetype, SPACE_ACTION, SPACE_CLIP, SPACE_GRAPH, SPACE_NLA, SPACE_SEQ)) { + continue; + } + + ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase : + &sl->regionbase; + ARegion *channels_region = BKE_region_find_in_listbase_by_type(regionbase, + RGN_TYPE_CHANNELS); + if (channels_region) { + BLI_freelinkN(regionbase, channels_region); + } + } + } + } } } |