Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-01-18 17:58:02 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-01-19 13:12:22 +0300
commite46c49ff3dd67c7d759b581b677b4ab90cee3c46 (patch)
tree30164c0344ba42ca408d3b66a3a7bedccb50a150 /source/blender/blenkernel
parent9cac97fb3cb2c737266bc3c8b34494fbea5ff7f2 (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/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_camera.h3
-rw-r--r--source/blender/blenkernel/intern/camera.c7
2 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_camera.h b/source/blender/blenkernel/BKE_camera.h
index f69ac7e01cd..d5bf2177f71 100644
--- a/source/blender/blenkernel/BKE_camera.h
+++ b/source/blender/blenkernel/BKE_camera.h
@@ -39,6 +39,7 @@ extern "C" {
#include "DNA_vec_types.h"
struct Camera;
+struct Depsgraph;
struct Main;
struct Object;
struct RegionView3D;
@@ -113,7 +114,7 @@ typedef struct CameraParams {
void BKE_camera_params_init(CameraParams *params);
void BKE_camera_params_from_object(CameraParams *params, const struct Object *camera);
-void BKE_camera_params_from_view3d(CameraParams *params, const struct View3D *v3d, const struct RegionView3D *rv3d);
+void BKE_camera_params_from_view3d(CameraParams *params, const struct Depsgraph *depsgraph, const struct View3D *v3d, const struct RegionView3D *rv3d);
void BKE_camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float aspx, float aspy);
void BKE_camera_params_compute_matrix(CameraParams *params);
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index 4993caf14f1..869e312614e 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -57,6 +57,8 @@
#include "BKE_scene.h"
#include "BKE_screen.h"
+#include "DEG_depsgraph_query.h"
+
#include "MEM_guardedalloc.h"
#include "GPU_compositing.h"
@@ -262,7 +264,7 @@ void BKE_camera_params_from_object(CameraParams *params, const Object *ob)
}
}
-void BKE_camera_params_from_view3d(CameraParams *params, const View3D *v3d, const RegionView3D *rv3d)
+void BKE_camera_params_from_view3d(CameraParams *params, const Depsgraph *depsgraph, const View3D *v3d, const RegionView3D *rv3d)
{
/* common */
params->lens = v3d->lens;
@@ -271,7 +273,8 @@ void BKE_camera_params_from_view3d(CameraParams *params, const View3D *v3d, cons
if (rv3d->persp == RV3D_CAMOB) {
/* camera view */
- BKE_camera_params_from_object(params, v3d->camera);
+ Object *camera_object = DEG_get_evaluated_object(depsgraph, v3d->camera);
+ BKE_camera_params_from_object(params, camera_object);
params->zoom = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom);