Fix crash loading pre 2.5 test file (Cycles test failure)

fa0f295b53 exposed that there was a region missing because of some
faulty versioning.

The `fluid_motion_blur.blend` Cycles test file was crashing. Seems like
this is a pre 2.5 file that was resaved in newer versions, but the
preview region for the Sequencer was missing. Before mentioned commit,
the region would be broken when activating the preview view mode in the
Sequencer, now it would crash even on startup.

Ensure the region exists, as expected.
This commit is contained in:
Julian Eisel 2023-04-05 16:50:10 +02:00
parent 68ec019a40
commit 56640440f0
3 changed files with 15 additions and 1 deletions

@ -72,6 +72,8 @@
#include "readfile.h"
#include "versioning_common.h"
#include <errno.h>
/* Make preferences read-only, use versioning_userdef.c. */
@ -100,7 +102,7 @@ static void area_add_header_region(ScrArea *area, ListBase *lb)
region->v2d.flag = (V2D_PIXELOFS_X | V2D_PIXELOFS_Y);
}
static void sequencer_init_preview_region(ARegion *region)
void sequencer_init_preview_region(ARegion *region)
{
/* XXX a bit ugly still, copied from space_sequencer */
/* NOTE: if you change values here, also change them in space_sequencer.c, sequencer_new */

@ -2277,10 +2277,20 @@ static void version_ensure_missing_regions(ScrArea *area, SpaceLink *sl)
break;
}
case SPACE_SEQ: {
ARegion *region;
do_versions_ensure_region(regionbase,
RGN_TYPE_CHANNELS,
"versioning: channels region for sequencer",
RGN_TYPE_TOOLS);
region = do_versions_ensure_region(regionbase,
RGN_TYPE_PREVIEW,
"versioning: preview region for sequencer",
RGN_TYPE_CHANNELS);
sequencer_init_preview_region(region);
region->flag &= ~RGN_FLAG_HIDDEN;
break;
}
}

@ -108,6 +108,8 @@ struct bNodeSocket *version_node_add_socket_if_not_exist(struct bNodeTree *ntree
void version_socket_update_is_used(bNodeTree *ntree);
ARegion *do_versions_add_region(int regiontype, const char *name);
void sequencer_init_preview_region(ARegion *region);
#ifdef __cplusplus
}
#endif