Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Antalik <richardantalik@gmail.com>2022-06-24 11:23:31 +0300
committerThomas Dinges <blender@dingto.org>2022-06-24 12:12:21 +0300
commita66bc632ab3d2d587796f1bb6032353963e396f5 (patch)
tree17df4af832444e4c78cc966b9d3985352e330489
parent2d54b0f275dfc4060607eca10886dc8af7751824 (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.h8
-rw-r--r--source/blender/blenkernel/intern/screen.c11
-rw-r--r--source/blender/blenloader/intern/versioning_300.c33
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 d2112e27836..bafbb7712ab 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -795,13 +795,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;
@@ -2588,16 +2591,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;
}
@@ -2775,5 +2781,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);
+ }
+ }
+ }
+ }
}
}