diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-11-20 23:49:49 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-11-20 23:50:46 +0300 |
commit | b7ee0912a7776f444041f25b3103c6b30f4c771a (patch) | |
tree | 9262de57c69057719292111da2e316038a8fd7f7 /source/blender | |
parent | 3a13b89296a851027ba4cec34f8c36600cfdd1f2 (diff) |
Fix T57921: Crash when loading 2.7x .blend with scene without any render layer.
We need at least one view layer, always. :)
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 3211033c327..70c8e374096 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -454,6 +454,7 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene) /* Handle legacy render layers. */ bool have_override = false; + const bool need_default_renderlayer = scene->r.layers.first == NULL; for (SceneRenderLayer *srl = scene->r.layers.first; srl; srl = srl->next) { ViewLayer *view_layer = BKE_view_layer_add(scene, srl->name); @@ -541,9 +542,9 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene) BLI_freelistN(&scene->r.layers); - /* If render layers included overrides, we also create a vanilla - * viewport layer without them. */ - if (have_override) { + /* If render layers included overrides, or there are no render layers, + * we also create a vanilla viewport layer. */ + if (have_override || need_default_renderlayer) { ViewLayer *view_layer = BKE_view_layer_add(scene, "Viewport"); /* Make it first in the list. */ |