Fix T62310: Batch generate data-block previews broken.

Some uninitialized colormanagement data was breaking RNA acces for them,
exposed in batch preview management when generating previews for scenes
because we have to backup/restore scene and all its settings
before/after rendering it...
This commit is contained in:
Bastien Montagne
2019-03-11 16:49:29 +01:00
parent 19af5bd57e
commit 1bc8ddbc6c
3 changed files with 33 additions and 1 deletions

View File

@@ -24,7 +24,7 @@
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 280
#define BLENDER_SUBVERSION 47
#define BLENDER_SUBVERSION 48
/* Several breakages with 280, e.g. collections vs layers */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0

View File

@@ -780,6 +780,18 @@ void BKE_scene_init(Scene *sce)
BLI_strncpy(sce->sequencer_colorspace_settings.name, colorspace_name,
sizeof(sce->sequencer_colorspace_settings.name));
/* Those next two sets (render and baking settings) are not currently in use,
* but are exposed to RNA API and hence must have valid data. */
BKE_color_managed_display_settings_init(&sce->r.im_format.display_settings);
BKE_color_managed_view_settings_init_render(&sce->r.im_format.view_settings,
&sce->r.im_format.display_settings,
"Filmic");
BKE_color_managed_display_settings_init(&sce->r.bake.im_format.display_settings);
BKE_color_managed_view_settings_init_render(&sce->r.bake.im_format.view_settings,
&sce->r.bake.im_format.display_settings,
"Filmic");
/* Safe Areas */
copy_v2_fl2(sce->safe_areas.title, 10.0f / 100.0f, 5.0f / 100.0f);
copy_v2_fl2(sce->safe_areas.action, 3.5f / 100.0f, 3.5f / 100.0f);

View File

@@ -2874,6 +2874,26 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 280, 48)) {
for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
/* Those are not currently used, but are accessible through RNA API and were not
* properly initialized previously. This is mere copy of BKE_init_scene() code. */
if (scene->r.im_format.view_settings.look[0] == '\0') {
BKE_color_managed_display_settings_init(&scene->r.im_format.display_settings);
BKE_color_managed_view_settings_init_render(&scene->r.im_format.view_settings,
&scene->r.im_format.display_settings,
"Filmic");
}
if (scene->r.bake.im_format.view_settings.look[0] == '\0') {
BKE_color_managed_display_settings_init(&scene->r.bake.im_format.display_settings);
BKE_color_managed_view_settings_init_render(&scene->r.bake.im_format.view_settings,
&scene->r.bake.im_format.display_settings,
"Filmic");
}
}
}
{
/* Versioning code until next subversion bump goes here. */
}