diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-17 23:53:39 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-17 23:56:29 +0300 |
commit | 572754f894cef9497aeab156e00e99a1a9f1fcd9 (patch) | |
tree | 246fc56984208bfd9427556f97b602a1987aa655 /source/blender/blenloader/intern | |
parent | 728d99f44683c78bffa5be8b109bb05f99828617 (diff) |
Fix T64775: crash loading Eevee files with DoF, after recent changes
Additional fix to ensure Cycles versioning is done after Eevee.
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r-- | source/blender/blenloader/intern/versioning_cycles.c | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/source/blender/blenloader/intern/versioning_cycles.c b/source/blender/blenloader/intern/versioning_cycles.c index 81a2dd8e0ce..93813df3c13 100644 --- a/source/blender/blenloader/intern/versioning_cycles.c +++ b/source/blender/blenloader/intern/versioning_cycles.c @@ -425,47 +425,6 @@ void blo_do_versions_cycles(FileData *UNUSED(fd), Library *UNUSED(lib), Main *bm } } } - - if (!MAIN_VERSION_ATLEAST(bmain, 280, 69)) { - /* Unify Cycles and Eevee depth of field. */ - Scene *scene = bmain->scenes.first; - const char *engine = (scene) ? scene->r.engine : "CYCLES"; - - if (STREQ(engine, RE_engine_id_CYCLES)) { - for (Camera *camera = bmain->cameras.first; camera; camera = camera->id.next) { - IDProperty *ccamera = cycles_properties_from_ID(&camera->id); - if (ccamera) { - const char *aperture_type = cycles_property_string(ccamera, "aperture_type", "RADIUS"); - - camera->dof.aperture_fstop = cycles_property_float(ccamera, "aperture_fstop", 5.6f); - camera->dof.aperture_blades = cycles_property_int(ccamera, "aperture_blades", 0); - camera->dof.aperture_rotation = cycles_property_float(ccamera, "aperture_rotation", 0.0); - camera->dof.aperture_ratio = cycles_property_float(ccamera, "aperture_ratio", 1.0f); - camera->dof.flag |= CAM_DOF_ENABLED; - - float aperture_size = cycles_property_float(ccamera, "aperture_size", 0.0f); - - if (STREQ(aperture_type, "RADIUS") && aperture_size > 0.0f) { - if (camera->type == CAM_ORTHO) { - camera->dof.aperture_fstop = 1.0f / (2.0f * aperture_size); - } - else { - camera->dof.aperture_fstop = (camera->lens * 1e-3f) / (2.0f * aperture_size); - } - - continue; - } - } - - /* No depth of field, set default settings. */ - camera->dof.aperture_fstop = 5.6f; - camera->dof.aperture_blades = 0; - camera->dof.aperture_rotation = 0.0f; - camera->dof.aperture_ratio = 1.0f; - camera->dof.flag &= ~CAM_DOF_ENABLED; - } - } - } } void do_versions_after_linking_cycles(Main *bmain) @@ -531,4 +490,45 @@ void do_versions_after_linking_cycles(Main *bmain) light_emission_unify(light, engine); } } + + if (!MAIN_VERSION_ATLEAST(bmain, 280, 69)) { + /* Unify Cycles and Eevee depth of field. */ + Scene *scene = bmain->scenes.first; + const char *engine = (scene) ? scene->r.engine : "CYCLES"; + + if (STREQ(engine, RE_engine_id_CYCLES)) { + for (Camera *camera = bmain->cameras.first; camera; camera = camera->id.next) { + IDProperty *ccamera = cycles_properties_from_ID(&camera->id); + if (ccamera) { + const char *aperture_type = cycles_property_string(ccamera, "aperture_type", "RADIUS"); + + camera->dof.aperture_fstop = cycles_property_float(ccamera, "aperture_fstop", 5.6f); + camera->dof.aperture_blades = cycles_property_int(ccamera, "aperture_blades", 0); + camera->dof.aperture_rotation = cycles_property_float(ccamera, "aperture_rotation", 0.0); + camera->dof.aperture_ratio = cycles_property_float(ccamera, "aperture_ratio", 1.0f); + camera->dof.flag |= CAM_DOF_ENABLED; + + float aperture_size = cycles_property_float(ccamera, "aperture_size", 0.0f); + + if (STREQ(aperture_type, "RADIUS") && aperture_size > 0.0f) { + if (camera->type == CAM_ORTHO) { + camera->dof.aperture_fstop = 1.0f / (2.0f * aperture_size); + } + else { + camera->dof.aperture_fstop = (camera->lens * 1e-3f) / (2.0f * aperture_size); + } + + continue; + } + } + + /* No depth of field, set default settings. */ + camera->dof.aperture_fstop = 5.6f; + camera->dof.aperture_blades = 0; + camera->dof.aperture_rotation = 0.0f; + camera->dof.aperture_ratio = 1.0f; + camera->dof.flag &= ~CAM_DOF_ENABLED; + } + } + } } |