diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-04-26 19:36:56 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-04-26 19:36:56 +0300 |
commit | a7c5d2e159d59e045983009e191c94c1bf561f5d (patch) | |
tree | f0432d6c29fab29c749a9f635a4d919338533822 /source/blender/editors/space_view3d | |
parent | edd1512741f9a8fd9c3d93f47ccf367932cff32a (diff) |
Pass graph to depth functions
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 21 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_intern.h | 4 |
3 files changed, 20 insertions, 11 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 5f2e12fd938..df4723f3df3 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -784,7 +784,9 @@ static void drawrenderborder(ARegion *ar, View3D *v3d) immUnbindProgram(); } -void ED_view3d_draw_depth(Scene *scene, ARegion *ar, View3D *v3d, bool alphaoverride) +void ED_view3d_draw_depth( + struct Depsgraph *graph, + Scene *scene, ARegion *ar, View3D *v3d, bool alphaoverride) { RegionView3D *rv3d = ar->regiondata; @@ -826,7 +828,7 @@ void ED_view3d_draw_depth(Scene *scene, ARegion *ar, View3D *v3d, bool alphaover else #endif /* WITH_OPENGL_LEGACY */ { - DRW_draw_depth_loop(scene, ar, v3d); + DRW_draw_depth_loop(graph, scene, ar, v3d); } if (rv3d->rflag & RV3D_CLIPPING) { diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 019a431fc19..028d613ba8c 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -729,13 +729,14 @@ static void viewops_data_create_ex(bContext *C, wmOperator *op, const wmEvent *e } else if (use_orbit_zbuf) { Scene *scene = CTX_data_scene(C); + struct Depsgraph *graph = CTX_data_depsgraph(C); float fallback_depth_pt[3]; view3d_operator_needs_opengl(C); /* needed for zbuf drawing */ negate_v3_v3(fallback_depth_pt, rv3d->ofs); - if ((vod->use_dyn_ofs = ED_view3d_autodist(scene, vod->ar, vod->v3d, + if ((vod->use_dyn_ofs = ED_view3d_autodist(graph, scene, vod->ar, vod->v3d, event->mval, vod->dyn_ofs, true, fallback_depth_pt))) { if (rv3d->is_persp) { @@ -3277,6 +3278,7 @@ static int viewcenter_pick_invoke(bContext *C, wmOperator *op, const wmEvent *ev ARegion *ar = CTX_wm_region(C); if (rv3d) { + struct Depsgraph *graph = CTX_data_depsgraph(C); float new_ofs[3]; const int smooth_viewtx = WM_operator_smooth_viewtx_get(op); @@ -3284,7 +3286,7 @@ static int viewcenter_pick_invoke(bContext *C, wmOperator *op, const wmEvent *ev view3d_operator_needs_opengl(C); - if (ED_view3d_autodist(scene, ar, v3d, event->mval, new_ofs, false, NULL)) { + if (ED_view3d_autodist(graph, scene, ar, v3d, event->mval, new_ofs, false, NULL)) { /* pass */ } else { @@ -3571,7 +3573,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) ED_view3d_dist_range_get(v3d, dist_range); /* Get Z Depths, needed for perspective, nice for ortho */ - ED_view3d_draw_depth(scene, ar, v3d, true); + ED_view3d_draw_depth(CTX_data_depsgraph(C), scene, ar, v3d, true); { /* avoid allocating the whole depth buffer */ @@ -4672,8 +4674,9 @@ void ED_view3d_cursor3d_position(bContext *C, float fp[3], const int mval[2]) } if (U.uiflag & USER_ZBUF_CURSOR) { /* maybe this should be accessed some other way */ + struct Depsgraph *graph = CTX_data_depsgraph(C); view3d_operator_needs_opengl(C); - if (ED_view3d_autodist(scene, ar, v3d, mval, fp, true, NULL)) + if (ED_view3d_autodist(graph, scene, ar, v3d, mval, fp, true, NULL)) depth_used = true; } @@ -4849,7 +4852,7 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg * \param fallback_depth_pt: Use this points depth when no depth can be found. */ bool ED_view3d_autodist( - Scene *scene, ARegion *ar, View3D *v3d, + struct Depsgraph *graph, Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3], const bool alphaoverride, const float fallback_depth_pt[3]) { @@ -4859,7 +4862,7 @@ bool ED_view3d_autodist( bool depth_ok = false; /* Get Z Depths, needed for perspective, nice for ortho */ - ED_view3d_draw_depth(scene, ar, v3d, alphaoverride); + ED_view3d_draw_depth(graph, scene, ar, v3d, alphaoverride); /* Attempt with low margin's first */ i = 0; @@ -4887,12 +4890,14 @@ bool ED_view3d_autodist( } } -void ED_view3d_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) +void ED_view3d_autodist_init( + struct Depsgraph *graph, + Scene *scene, ARegion *ar, View3D *v3d, int mode) { /* Get Z Depths, needed for perspective, nice for ortho */ switch (mode) { case 0: - ED_view3d_draw_depth(scene, ar, v3d, true); + ED_view3d_draw_depth(graph, scene, ar, v3d, true); break; case 1: ED_view3d_draw_depth_gpencil(scene, ar, v3d); diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index c30b7076ac6..51293f41fa5 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -211,7 +211,9 @@ void draw_sim_debug_data(Scene *scene, View3D *v3d, ARegion *ar); void view3d_main_region_draw(const struct bContext *C, struct ARegion *ar); void view3d_draw_region_info(const struct bContext *C, struct ARegion *ar); -void ED_view3d_draw_depth(Scene *scene, struct ARegion *ar, View3D *v3d, bool alphaoverride); +void ED_view3d_draw_depth( + struct Depsgraph *graph, + Scene *scene, struct ARegion *ar, View3D *v3d, bool alphaoverride); /* view3d_draw_legacy.c */ void view3d_main_region_draw_legacy(const struct bContext *C, struct ARegion *ar); |