From e46c49ff3dd67c7d759b581b677b4ab90cee3c46 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 18 Jan 2018 15:58:02 +0100 Subject: 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 --- source/blender/editors/sculpt_paint/paint_image_proj.c | 6 ++++-- source/blender/editors/sculpt_paint/sculpt.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/sculpt_paint') diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 7148469a9d8..4a14e985827 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -227,6 +227,7 @@ typedef struct ProjPaintState { View3D *v3d; RegionView3D *rv3d; ARegion *ar; + const Depsgraph *depsgraph; Scene *scene; int source; /* PROJ_SRC_**** */ @@ -3133,7 +3134,7 @@ static void proj_paint_state_viewport_init( ED_view3d_ob_project_mat_get_from_obmat(ps->rv3d, ps->obmat, ps->projectMat); - ps->is_ortho = ED_view3d_clip_range_get(ps->v3d, ps->rv3d, &ps->clipsta, &ps->clipend, true); + ps->is_ortho = ED_view3d_clip_range_get(ps->depsgraph, ps->v3d, ps->rv3d, &ps->clipsta, &ps->clipend, true); } else { /* re-projection */ @@ -5098,6 +5099,7 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int ps->rv3d = CTX_wm_region_view3d(C); ps->ar = CTX_wm_region(C); + ps->depsgraph = CTX_data_depsgraph(C); ps->scene = scene; ps->ob = ob; /* allow override of active object */ @@ -5508,7 +5510,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) array = (float *)IDP_Array(view_data); memcpy(array, rv3d->winmat, sizeof(rv3d->winmat)); array += sizeof(rv3d->winmat) / sizeof(float); memcpy(array, rv3d->viewmat, sizeof(rv3d->viewmat)); array += sizeof(rv3d->viewmat) / sizeof(float); - is_ortho = ED_view3d_clip_range_get(v3d, rv3d, &array[0], &array[1], true); + is_ortho = ED_view3d_clip_range_get(CTX_data_depsgraph(C), v3d, rv3d, &array[0], &array[1], true); /* using float for a bool is dodgy but since its an extra member in the array... * easier then adding a single bool prop */ array[2] = is_ortho ? 1.0f : 0.0f; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 69cf114f4b7..c9d550aa4bd 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4692,7 +4692,7 @@ static float sculpt_raycast_init( RegionView3D *rv3d = vc->ar->regiondata; /* TODO: what if the segment is totally clipped? (return == 0) */ - ED_view3d_win_to_segment(vc->ar, vc->v3d, mouse, ray_start, ray_end, true); + ED_view3d_win_to_segment(vc->depsgraph, vc->ar, vc->v3d, mouse, ray_start, ray_end, true); invert_m4_m4(obimat, ob->obmat); mul_m4_v3(obimat, ray_start); -- cgit v1.2.3