diff options
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 3342d3244e0..3c63832c575 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -526,6 +526,21 @@ void do_versions_after_linking_280(Main *main) if (!MAIN_VERSION_ATLEAST(main, 280, 1)) { do_version_workspaces_after_lib_link(main); } + + { + /* Cleanup any remaining SceneRenderLayer data for files that were created + * with Blender 2.8 before the SceneRenderLayer > RenderLayer refactor. */ + for (Scene *scene = main->scene.first; scene; scene = scene->id.next) { + for (SceneRenderLayer *srl = scene->r.layers.first; srl; srl = srl->next) { + if (srl->prop) { + IDP_FreeProperty(srl->prop); + MEM_freeN(srl->prop); + } + BKE_freestyle_config_free(&srl->freestyleConfig); + } + BLI_freelistN(&scene->r.layers); + } + } } static void do_version_layer_collections_idproperties(ListBase *lb) @@ -730,7 +745,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main) { if ((DNA_struct_elem_find(fd->filesdna, "SceneLayer", "FreestyleConfig", "freestyle_config") == false) && - DNA_struct_elem_find(fd->filesdna, "Scene", "ListBase", "render_layers")) { + DNA_struct_elem_find(fd->filesdna, "Scene", "ListBase", "render_layers")) + { for (Scene *scene = main->scene.first; scene; scene = scene->id.next) { SceneLayer *scene_layer; for (scene_layer = scene->render_layers.first; scene_layer; scene_layer = scene_layer->next) { @@ -740,15 +756,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main) scene_layer->pass_alpha_threshold = 0.5f; BKE_freestyle_config_init(&scene_layer->freestyle_config); } - - for (SceneRenderLayer *srl = scene->r.layers.first; srl; srl = srl->next) { - if (srl->prop) { - IDP_FreeProperty(srl->prop); - MEM_freeN(srl->prop); - } - BKE_freestyle_config_free(&srl->freestyleConfig); - } - BLI_freelistN(&scene->r.layers); } } } |