diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-17 23:28:49 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-17 23:51:08 +0300 |
commit | 728d99f44683c78bffa5be8b109bb05f99828617 (patch) | |
tree | 276d113721ec94d85392f037699e2bb0f56d3881 /source/blender/blenloader/intern | |
parent | 3022dd2b27fdfd8aca369bfb0e390965de448b7a (diff) |
Fix T64775: crash loading Eevee files with DoF, after recent changes
Version after lib linking due to following ID pointers.
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 23e8aba8c7b..4d4dc227589 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -1084,6 +1084,32 @@ void do_versions_after_linking_280(Main *bmain) BKE_rigidbody_constraints_collection_validate(scene, rbw); } } + + if (!MAIN_VERSION_ATLEAST(bmain, 280, 69)) { + /* Unify DOF settings (EEVEE part only) */ + const int SCE_EEVEE_DOF_ENABLED = (1 << 7); + LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { + if (STREQ(scene->r.engine, RE_engine_id_BLENDER_EEVEE)) { + if (scene->eevee.flag & SCE_EEVEE_DOF_ENABLED) { + Object *cam_ob = scene->camera; + if (cam_ob && cam_ob->type == OB_CAMERA) { + Camera *cam = cam_ob->data; + cam->dof.flag |= CAM_DOF_ENABLED; + } + } + } + } + + LISTBASE_FOREACH (Camera *, camera, &bmain->cameras) { + camera->dof.focus_object = camera->dof_ob; + camera->dof.focus_distance = camera->dof_distance; + camera->dof.aperture_fstop = camera->gpu_dof.fstop; + camera->dof.aperture_rotation = camera->gpu_dof.rotation; + camera->dof.aperture_ratio = camera->gpu_dof.ratio; + camera->dof.aperture_blades = camera->gpu_dof.num_blades; + camera->dof_ob = NULL; + } + } } /* NOTE: This version patch is intended for versions < 2.52.2, @@ -3423,31 +3449,5 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) light->sun_angle = 2.0f * atanf(light->area_size); } } - - /* Unify DOF settings (EEVEE part only) */ - if (!DNA_struct_elem_find(fd->filesdna, "Camera", "CameraDOFSettings", "dof")) { - const int SCE_EEVEE_DOF_ENABLED = (1 << 7); - LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { - if (STREQ(scene->r.engine, RE_engine_id_BLENDER_EEVEE)) { - if (scene->eevee.flag & SCE_EEVEE_DOF_ENABLED) { - Object *cam_ob = scene->camera; - if (cam_ob && cam_ob->type == OB_CAMERA) { - Camera *cam = cam_ob->data; - cam->dof.flag |= CAM_DOF_ENABLED; - } - } - } - } - - LISTBASE_FOREACH (Camera *, camera, &bmain->cameras) { - camera->dof.focus_object = camera->dof_ob; - camera->dof.focus_distance = camera->dof_distance; - camera->dof.aperture_fstop = camera->gpu_dof.fstop; - camera->dof.aperture_rotation = camera->gpu_dof.rotation; - camera->dof.aperture_ratio = camera->gpu_dof.ratio; - camera->dof.aperture_blades = camera->gpu_dof.num_blades; - camera->dof_ob = NULL; - } - } } } |