diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-11-22 20:36:52 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-11-22 20:42:18 +0300 |
commit | 94d40aca0c635305f73beb8a87b100633fc2d9ba (patch) | |
tree | c736a2c5f7e37ed6e77122142fc7892dcf44e7a4 /source | |
parent | 73c4ba18d50bc03465927e22b5d0085bf7d523a2 (diff) |
Fix doversion crash with 2.8 files that had freestyle 2.8
Crash introduced on: 3a95bdfc65d883e7db006fd
We can't decrease user count of freestyle linestyle IDs before linking.
Moving doversion for after linking.
And for the records we are simply removing the freestyle data altogether.
This is only for files created with 2.8, so it should be fine.
Diffstat (limited to 'source')
-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); } } } |