diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-06-04 18:14:09 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-06-04 19:26:02 +0300 |
commit | 5158896d7db6b9b9b9bb789073f835648d881a7f (patch) | |
tree | cd314807223538289917706440a507dc94f57a8a /source/blender/blenloader/intern | |
parent | 0dbbc5aac7125475b0c0b2523892e7d3bae34b05 (diff) |
Fix T65486: Cycles f-stop value from old files not preserved
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r-- | source/blender/blenloader/intern/versioning_cycles.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/source/blender/blenloader/intern/versioning_cycles.c b/source/blender/blenloader/intern/versioning_cycles.c index 9bfbf4477ab..1740faca265 100644 --- a/source/blender/blenloader/intern/versioning_cycles.c +++ b/source/blender/blenloader/intern/versioning_cycles.c @@ -80,14 +80,6 @@ static bool cycles_property_boolean(IDProperty *idprop, const char *name, bool d return (prop) ? IDP_Int(prop) : default_value; } -static const char *cycles_property_string(IDProperty *idprop, - const char *name, - const char *default_value) -{ - IDProperty *prop = IDP_GetPropertyTypeFromGroup(idprop, name, IDP_STRING); - return (prop) ? IDP_String(prop) : default_value; -} - static void displacement_node_insert(bNodeTree *ntree) { bool need_update = false; @@ -500,7 +492,7 @@ void do_versions_after_linking_cycles(Main *bmain) 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"); + const bool is_fstop = cycles_property_int(ccamera, "aperture_type", 0) == 1; camera->dof.aperture_fstop = cycles_property_float(ccamera, "aperture_fstop", 5.6f); camera->dof.aperture_blades = cycles_property_int(ccamera, "aperture_blades", 0); @@ -510,7 +502,10 @@ void do_versions_after_linking_cycles(Main *bmain) float aperture_size = cycles_property_float(ccamera, "aperture_size", 0.0f); - if (STREQ(aperture_type, "RADIUS") && aperture_size > 0.0f) { + if (is_fstop) { + continue; + } + else if (aperture_size > 0.0f) { if (camera->type == CAM_ORTHO) { camera->dof.aperture_fstop = 1.0f / (2.0f * aperture_size); } |