Fix T101533: Wrong DoF when a non-camera object is the active camera
Make sure non-camera data is not casted to a Camera pointer. Solution suggested by Damien Picard (@pioverfour).
This commit is contained in:
parent
331de028ef
commit
d0e9a8c46a
Notes:
blender-bot
2023-02-14 07:36:17 +01:00
Referenced by issue #100749, Blender LTS: Maintenance Task 3.3 Referenced by issue #101533, Regression: Stretched image in the viewport when viewed from the lamp object
|
@ -189,7 +189,7 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata),
|
|||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
|
||||
|
||||
Camera *cam = (camera != NULL) ? camera->data : NULL;
|
||||
Camera *cam = (camera != NULL && camera->type == OB_CAMERA) ? camera->data : NULL;
|
||||
|
||||
if (cam && (cam->dof.flag & CAM_DOF_ENABLED)) {
|
||||
RegionView3D *rv3d = draw_ctx->rv3d;
|
||||
|
|
|
@ -289,7 +289,7 @@ void GPENCIL_cache_init(void *ved)
|
|||
DRW_shgroup_call_procedural_triangles(grp, NULL, 1);
|
||||
}
|
||||
|
||||
Camera *cam = (pd->camera != NULL) ? pd->camera->data : NULL;
|
||||
Camera *cam = (pd->camera != NULL && pd->camera->type == OB_CAMERA) ? pd->camera->data : NULL;
|
||||
|
||||
/* Pseudo DOF setup. */
|
||||
if (cam && (cam->dof.flag & CAM_DOF_ENABLED)) {
|
||||
|
|
|
@ -128,7 +128,7 @@ void workbench_dof_engine_init(WORKBENCH_Data *vedata)
|
|||
camera = wpd->cam_original_ob;
|
||||
}
|
||||
|
||||
Camera *cam = camera != NULL ? camera->data : NULL;
|
||||
Camera *cam = camera != NULL && camera->type == OB_CAMERA ? 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;
|
||||
|
|
Loading…
Reference in New Issue