Fix: Timeline versioning conflict with pre-2.80 files

Move the versioning code that switches the Timeline editor to Dope
Sheet from the 'first' to the 'after linking' versioning stage.

There was already versioning code that effectively turns the Dope
Sheet back into a Timeline, for pre-2.80 files, and this runs in the
'after linking' stage. The 5.0 versioning code now correctly runs
after this.

Fixes: #147742

Pull Request: https://projects.blender.org/blender/blender/pulls/147734
This commit is contained in:
Sybren A. Stüvel
2025-10-13 12:53:50 +02:00
parent 0c22ef5ae7
commit 84d99a5902

View File

@@ -2687,6 +2687,39 @@ void do_versions_after_linking_500(FileData *fd, Main *bmain)
}
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 500, 100)) {
/* Note: this HAS to happen in the 'after linking' stage, because
* #do_version_area_change_space_to_space_action() basically performs the opposite operation
* and is called from #do_versions_after_linking_280(). */
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
if (!ELEM(sl->spacetype, SPACE_ACTION)) {
continue;
}
SpaceAction *saction = reinterpret_cast<SpaceAction *>(sl);
const eAnimEdit_Context dopesheet_mode = eAnimEdit_Context(saction->mode);
if (dopesheet_mode != SACTCONT_TIMELINE) {
continue;
}
/* Switching to dopesheet since that is the closest to the timeline view. */
saction->mode = SACTCONT_DOPESHEET;
/* The multiplication by 2 assumes that the time control footer has the same size as the
* header. The header is only shown if there is enough space for both. */
const bool show_header = area->winy > (HEADERY * UI_SCALE_FAC) * 2;
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
if (!show_header && region->regiontype == RGN_TYPE_HEADER) {
region->flag |= RGN_FLAG_HIDDEN;
}
if (region->regiontype == RGN_TYPE_FOOTER) {
region->flag &= ~RGN_FLAG_HIDDEN;
}
}
}
}
}
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 500, 101)) {
const uint8_t default_flags = DNA_struct_default_get(ToolSettings)->fix_to_cam_flag;
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
@@ -3836,35 +3869,6 @@ void blo_do_versions_500(FileData *fd, Library * /*lib*/, Main *bmain)
}
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 500, 100)) {
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
if (!ELEM(sl->spacetype, SPACE_ACTION)) {
continue;
}
SpaceAction *saction = reinterpret_cast<SpaceAction *>(sl);
if (saction->mode != SACTCONT_TIMELINE) {
continue;
}
/* Switching to dopesheet since that is the closest to the timeline view. */
saction->mode = SACTCONT_DOPESHEET;
/* The multiplication by 2 assumes that the time control footer has the same size as the
* header. The header is only shown if there is enough space for both. */
const bool show_header = area->winy > (HEADERY * UI_SCALE_FAC) * 2;
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
if (!show_header && region->regiontype == RGN_TYPE_HEADER) {
region->flag |= RGN_FLAG_HIDDEN;
}
if (region->regiontype == RGN_TYPE_FOOTER) {
region->flag &= ~RGN_FLAG_HIDDEN;
}
}
}
}
}
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 500, 102)) {
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
scene->r.time_jump_delta = 1.0f;