diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-05-02 17:05:57 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-05-02 17:14:54 +0300 |
commit | 47239b40419750f0ad8284ba1de1012a638660fb (patch) | |
tree | f30d71f14eba9dc25fb1362f3fd27902ff232da4 /source/blender/editors/space_view3d | |
parent | 22855f1a60e381d67872e51ed770f67b8417d024 (diff) |
Cleanup: use depsgraph for scene/layer access
Diffstat (limited to 'source/blender/editors/space_view3d')
4 files changed, 22 insertions, 17 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 7e2789de33d..1f46a891e76 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -70,6 +70,8 @@ #include "ED_transform.h" #include "ED_gpencil.h" +#include "DEG_depsgraph_query.h" + #include "GPU_matrix.h" #include "GPU_immediate.h" #include "GPU_immediate_util.h" @@ -755,8 +757,9 @@ static void drawrenderborder(ARegion *ar, View3D *v3d) void ED_view3d_draw_depth( struct Depsgraph *graph, - Scene *scene, ARegion *ar, View3D *v3d, bool alphaoverride) + ARegion *ar, View3D *v3d, bool alphaoverride) { + Scene *scene = DAG_get_scene(graph); RegionView3D *rv3d = ar->regiondata; short zbuf = v3d->zbuf; @@ -797,7 +800,7 @@ void ED_view3d_draw_depth( else #endif /* WITH_OPENGL_LEGACY */ { - DRW_draw_depth_loop(graph, scene, ar, v3d); + DRW_draw_depth_loop(graph, 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 63024b489e1..156905cf681 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -77,6 +77,8 @@ #include "ED_gpencil.h" #include "ED_view3d.h" +#include "DEG_depsgraph_query.h" + #include "UI_resources.h" #include "PIL_time.h" /* smoothview */ @@ -742,7 +744,7 @@ static void viewops_data_create_ex( negate_v3_v3(fallback_depth_pt, rv3d->ofs); vod->use_dyn_ofs = ED_view3d_autodist( - graph, vod->scene, vod->ar, vod->v3d, + graph, vod->ar, vod->v3d, event->mval, vod->dyn_ofs, true, fallback_depth_pt); } else { @@ -3310,7 +3312,6 @@ static int viewcenter_pick_invoke(bContext *C, wmOperator *op, const wmEvent *ev { View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = CTX_wm_region_view3d(C); - Scene *scene = CTX_data_scene(C); ARegion *ar = CTX_wm_region(C); if (rv3d) { @@ -3322,7 +3323,7 @@ static int viewcenter_pick_invoke(bContext *C, wmOperator *op, const wmEvent *ev view3d_operator_needs_opengl(C); - if (ED_view3d_autodist(graph, scene, ar, v3d, event->mval, new_ofs, false, NULL)) { + if (ED_view3d_autodist(graph, ar, v3d, event->mval, new_ofs, false, NULL)) { /* pass */ } else { @@ -3580,7 +3581,6 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) ARegion *ar = CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = CTX_wm_region_view3d(C); - Scene *scene = CTX_data_scene(C); int gesture_mode; const int smooth_viewtx = WM_operator_smooth_viewtx_get(op); @@ -3609,7 +3609,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(CTX_data_depsgraph(C), scene, ar, v3d, true); + ED_view3d_draw_depth(CTX_data_depsgraph(C), ar, v3d, true); { /* avoid allocating the whole depth buffer */ @@ -4688,7 +4688,6 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot) /* note: cannot use event->mval here (called by object_add() */ void ED_view3d_cursor3d_position(bContext *C, float fp[3], const int mval[2]) { - Scene *scene = CTX_data_scene(C); ARegion *ar = CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = ar->regiondata; @@ -4712,8 +4711,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(graph, scene, ar, v3d, mval, fp, true, NULL)) + if (ED_view3d_autodist(graph, ar, v3d, mval, fp, true, NULL)) { depth_used = true; + } } if (depth_used == false) { @@ -4888,7 +4888,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( - struct Depsgraph *graph, Scene *scene, ARegion *ar, View3D *v3d, + struct Depsgraph *graph, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3], const bool alphaoverride, const float fallback_depth_pt[3]) { @@ -4898,7 +4898,7 @@ bool ED_view3d_autodist( bool depth_ok = false; /* Get Z Depths, needed for perspective, nice for ortho */ - ED_view3d_draw_depth(graph, scene, ar, v3d, alphaoverride); + ED_view3d_draw_depth(graph, ar, v3d, alphaoverride); /* Attempt with low margin's first */ i = 0; @@ -4928,16 +4928,19 @@ bool ED_view3d_autodist( void ED_view3d_autodist_init( struct Depsgraph *graph, - Scene *scene, ARegion *ar, View3D *v3d, int mode) + ARegion *ar, View3D *v3d, int mode) { /* Get Z Depths, needed for perspective, nice for ortho */ switch (mode) { case 0: - ED_view3d_draw_depth(graph, scene, ar, v3d, true); + ED_view3d_draw_depth(graph, ar, v3d, true); break; case 1: + { + Scene *scene = DAG_get_scene(graph); ED_view3d_draw_depth_gpencil(scene, ar, v3d); break; + } } } diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index dd9570eb656..f1b9fb575de 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -213,7 +213,7 @@ void view3d_draw_region_info(const struct bContext *C, struct ARegion *ar); void ED_view3d_draw_depth( struct Depsgraph *graph, - Scene *scene, struct ARegion *ar, View3D *v3d, bool alphaoverride); + struct ARegion *ar, View3D *v3d, bool alphaoverride); /* view3d_draw_legacy.c */ void view3d_main_region_draw_legacy(const struct bContext *C, struct ARegion *ar); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index b92431e6370..a1dcdd3abcf 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1117,7 +1117,6 @@ int view3d_opengl_select( { Depsgraph *graph = vc->depsgraph; Scene *scene = vc->scene; - SceneLayer *sl = vc->scene_layer; View3D *v3d = vc->v3d; ARegion *ar = vc->ar; rcti rect; @@ -1192,7 +1191,7 @@ int view3d_opengl_select( else #else { - DRW_draw_select_loop(vc, graph, scene, sl, v3d, ar, use_obedit_skip, use_nearest, &rect); + DRW_draw_select_loop(graph, v3d, ar, use_obedit_skip, use_nearest, &rect); } #endif /* WITH_OPENGL_LEGACY */ @@ -1209,7 +1208,7 @@ int view3d_opengl_select( else #else { - DRW_draw_select_loop(vc, graph, scene, sl, v3d, ar, use_obedit_skip, use_nearest, &rect); + DRW_draw_select_loop(graph, v3d, ar, use_obedit_skip, use_nearest, &rect); } #endif /* WITH_OPENGL_LEGACY */ |