Merge branch 'master' into blender2.8
[blender.git] / source / blender / editors / interface / interface_eyedropper_depth.c
index b2ba7594fcb1f327b6b9412db36669179fc3544a..6e85d091fdb10ca9e5bed266a7caf774f17e3501 100644 (file)
@@ -44,6 +44,8 @@
 #include "BKE_screen.h"
 #include "BKE_unit.h"
 
+#include "DEG_depsgraph.h"
+
 #include "RNA_access.h"
 
 #include "UI_interface.h"
@@ -151,9 +153,10 @@ static void depthdropper_exit(bContext *C, wmOperator *op)
 static void depthdropper_depth_sample_pt(bContext *C, DepthDropper *ddr, int mx, int my, float *r_depth)
 {
        /* we could use some clever */
-       wmWindow *win = CTX_wm_window(C);
-       ScrArea *sa = BKE_screen_find_area_xy(win->screen, SPACE_TYPE_ANY, mx, my);
-       Scene *scene = win->screen->scene;
+       bScreen *screen = CTX_wm_screen(C);
+       ScrArea *sa = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, mx, my);
+       Scene *scene = CTX_data_scene(C);
+
        UnitSettings *unit = &scene->unit;
        const bool do_split = (unit->flag & USER_UNIT_OPT_SPLIT) != 0;
 
@@ -166,6 +169,7 @@ static void depthdropper_depth_sample_pt(bContext *C, DepthDropper *ddr, int mx,
                if (sa->spacetype == SPACE_VIEW3D) {
                        ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
                        if (ar) {
+                               struct Depsgraph *graph = CTX_data_depsgraph(C);
                                View3D *v3d = sa->spacedata.first;
                                RegionView3D *rv3d = ar->regiondata;
                                /* weak, we could pass in some reference point */
@@ -175,6 +179,9 @@ static void depthdropper_depth_sample_pt(bContext *C, DepthDropper *ddr, int mx,
                                    my - ar->winrct.ymin};
                                float co[3];
 
+                               EvaluationContext eval_ctx;
+                               CTX_data_eval_ctx(C, &eval_ctx);
+
                                CTX_wm_area_set(C, sa);
                                CTX_wm_region_set(C, ar);
 
@@ -183,7 +190,7 @@ static void depthdropper_depth_sample_pt(bContext *C, DepthDropper *ddr, int mx,
 
                                view3d_operator_needs_opengl(C);
 
-                               if (ED_view3d_autodist(scene, ar, v3d, mval, co, true, NULL)) {
+                               if (ED_view3d_autodist(&eval_ctx, graph, ar, v3d, mval, co, true, NULL)) {
                                        const float mval_center_fl[2] = {
                                            (float)ar->winx / 2,
                                            (float)ar->winy / 2};