From bc3139d79226896cf6c2b0813a1188eda70fad09 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Fri, 17 May 2019 16:57:31 +0200 Subject: Cycles/Eevee: unify depth of field settings for cameras There is now a checkbox to enable/disable depth of field per camera. For Eevee this replace the scene level setting. For Cycles there is now only an F-Stop value, no longer a Radius. Existing files are converted based on Cycles or Eevee being set in the scene. Differential Revision: https://developer.blender.org/D4882 --- .../blender/draw/engines/workbench/workbench_effect_dof.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'source/blender/draw/engines/workbench') diff --git a/source/blender/draw/engines/workbench/workbench_effect_dof.c b/source/blender/draw/engines/workbench/workbench_effect_dof.c index ee8c8a0343f..6886b73650c 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_dof.c +++ b/source/blender/draw/engines/workbench/workbench_effect_dof.c @@ -136,7 +136,9 @@ void workbench_dof_engine_init(WORKBENCH_Data *vedata, Object *camera) WORKBENCH_PrivateData *wpd = stl->g_data; WORKBENCH_FramebufferList *fbl = vedata->fbl; - if ((wpd->shading.flag & V3D_SHADING_DEPTH_OF_FIELD) == 0 || (camera == NULL)) { + Camera *cam = camera != NULL ? camera->data : NULL; + if ((wpd->shading.flag & V3D_SHADING_DEPTH_OF_FIELD) == 0 || (cam == NULL) || + ((cam->dof.flag & CAM_DOF_ENABLED) == 0)) { wpd->dof_enabled = false; return; } @@ -231,11 +233,10 @@ void workbench_dof_engine_init(WORKBENCH_Data *vedata, Object *camera) const DRWContextState *draw_ctx = DRW_context_state_get(); const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph); RegionView3D *rv3d = draw_ctx->rv3d; - Camera *cam = (Camera *)camera->data; /* Parameters */ /* TODO UI Options */ - float fstop = cam->gpu_dof.fstop; + float fstop = cam->dof.aperture_fstop; float sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y); float focus_dist = BKE_camera_object_dof_distance(camera); float focal_len = cam->lens; @@ -265,9 +266,9 @@ void workbench_dof_engine_init(WORKBENCH_Data *vedata, Object *camera) wpd->dof_near_far[0] = -cam->clip_start; wpd->dof_near_far[1] = -cam->clip_end; - float blades = cam->gpu_dof.num_blades; - float rotation = cam->gpu_dof.rotation; - float ratio = 1.0f / cam->gpu_dof.ratio; + float blades = cam->dof.aperture_blades; + float rotation = cam->dof.aperture_rotation; + float ratio = 1.0f / cam->dof.aperture_ratio; if (wpd->dof_ubo == NULL || blades != wpd->dof_blades || rotation != wpd->dof_rotation || ratio != wpd->dof_ratio) { -- cgit v1.2.3