diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-01-18 17:58:02 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-01-19 13:12:22 +0300 |
commit | e46c49ff3dd67c7d759b581b677b4ab90cee3c46 (patch) | |
tree | 30164c0344ba42ca408d3b66a3a7bedccb50a150 /source/blender/draw/engines/eevee | |
parent | 9cac97fb3cb2c737266bc3c8b34494fbea5ff7f2 (diff) |
Fix T53788: Camera animation not working
Both object level and camera datablock properties animation did not work with
copy on write enabled.
The root of the issue is going to the fact, that all interface elements are
referencing original datablock. For example, View3D has pointer to camera it's
using, and all areas which does access v3d->camera should in fact query for
the evaluated version of that camera, within the current context.
Annoying part of this change is that we now need to pass depsgraph in lots
of places. Which is rather annoying.
Alternative would be to cache evaluated camera in viewport itself, but then
it makes it annoying to keep things in sync.
Not sure if there is nicer solution here.
Reviewers: dfelinto, campbellbarton, mont29
Subscribers: dragoneex
Differential Revision: https://developer.blender.org/D3007
Diffstat (limited to 'source/blender/draw/engines/eevee')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_depth_of_field.c | 6 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_motion_blur.c | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_depth_of_field.c b/source/blender/draw/engines/eevee/eevee_depth_of_field.c index 36f433d5ffb..124873add96 100644 --- a/source/blender/draw/engines/eevee/eevee_depth_of_field.c +++ b/source/blender/draw/engines/eevee/eevee_depth_of_field.c @@ -45,6 +45,7 @@ #include "BKE_screen.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #include "eevee_private.h" #include "GPU_extensions.h" @@ -96,7 +97,8 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *v if (rv3d->persp == RV3D_CAMOB && v3d->camera) { const float *viewport_size = DRW_viewport_size_get(); - Camera *cam = (Camera *)v3d->camera->data; + Object *camera_object = DEG_get_evaluated_object(draw_ctx->depsgraph, v3d->camera); + Camera *cam = (Camera *)camera_object->data; /* Retreive Near and Far distance */ effects->dof_near_far[0] = -cam->clipsta; @@ -145,7 +147,7 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *v float rotation = cam->gpu_dof.rotation; float ratio = 1.0f / cam->gpu_dof.ratio; float sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y); - float focus_dist = BKE_camera_object_dof_distance(v3d->camera); + float focus_dist = BKE_camera_object_dof_distance(camera_object); float focal_len = cam->lens; UNUSED_VARS(rotation, ratio); diff --git a/source/blender/draw/engines/eevee/eevee_motion_blur.c b/source/blender/draw/engines/eevee/eevee_motion_blur.c index 10c8ab5744a..b05fbf8c7fb 100644 --- a/source/blender/draw/engines/eevee/eevee_motion_blur.c +++ b/source/blender/draw/engines/eevee/eevee_motion_blur.c @@ -40,6 +40,7 @@ #include "ED_screen.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #include "eevee_private.h" #include "GPU_texture.h" @@ -147,11 +148,12 @@ int EEVEE_motion_blur_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *veda float persmat[4][4]; float ctime = BKE_scene_frame_get(scene); float delta = BKE_collection_engine_property_value_get_float(props, "motion_blur_shutter"); + Object *camera_object = DEG_get_evaluated_object(draw_ctx->depsgraph, v3d->camera); /* Current matrix */ eevee_motion_blur_camera_get_matrix_at_time(scene, ar, rv3d, v3d, - v3d->camera, + camera_object, ctime, effects->current_ndc_to_world); @@ -165,7 +167,7 @@ int EEVEE_motion_blur_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *veda /* Past matrix */ eevee_motion_blur_camera_get_matrix_at_time(scene, ar, rv3d, v3d, - v3d->camera, + camera_object, ctime - delta, effects->past_world_to_ndc); @@ -173,7 +175,7 @@ int EEVEE_motion_blur_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *veda /* Future matrix */ eevee_motion_blur_camera_get_matrix_at_time(scene, ar, rv3d, v3d, - v3d->camera, + camera_object, ctime + delta, effects->future_world_to_ndc); #endif |