[Bf-blender-cvs] [3bc41d2f50d] vr_scene_inspection: Force continuous redraws of mirrored 3D Views

Julian Eisel noreply at git.blender.org
Fri Mar 13 13:04:04 CET 2020


Commit: 3bc41d2f50d23911bbb778b4abc48e9b7093070f
Author: Julian Eisel
Date:   Fri Mar 13 13:03:37 2020 +0100
Branches: vr_scene_inspection
https://developer.blender.org/rB3bc41d2f50d23911bbb778b4abc48e9b7093070f

Force continuous redraws of mirrored 3D Views

===================================================================

M	source/blender/editors/include/ED_view3d.h
M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/editors/space_view3d/view3d_view.c
M	source/blender/windowmanager/intern/wm_draw.c

===================================================================

diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index c83edda9fb6..ebdd3e94df9 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -738,6 +738,9 @@ void ED_view3d_local_collections_reset(struct bContext *C, const bool reset_all)
 void ED_view3d_xr_mirror_update(const struct ScrArea *area,
                                 const struct View3D *v3d,
                                 const bool enable);
+bool ED_view3d_is_region_xr_mirror_active(const struct wmWindowManager *wm,
+                                          const struct View3D *v3d,
+                                          const struct ARegion *region);
 #endif
 
 #ifdef __cplusplus
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 01de92517c5..87295573948 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -315,17 +315,6 @@ static void view3d_stereo3d_setup(
 }
 
 #ifdef WITH_XR_OPENXR
-static bool view3d_xr_mirror_active(const wmWindowManager *wm,
-                                    const View3D *v3d,
-                                    const ARegion *region)
-{
-  return (v3d->flag & V3D_XR_SESSION_MIRROR) &&
-         /* The free region (e.g. the camera region in quad-view) is always the last in the list
-            base. We don't want any other to be affected. */
-         !region->next &&  //
-         WM_xr_session_is_running(&wm->xr);
-}
-
 static void view3d_xr_mirror_setup(const wmWindowManager *wm,
                                    Depsgraph *depsgraph,
                                    Scene *scene,
@@ -366,7 +355,7 @@ void ED_view3d_draw_setup_view(const wmWindowManager *wm,
 
 #ifdef WITH_XR_OPENXR
   /* Setup the view matrix. */
-  if (view3d_xr_mirror_active(wm, v3d, region)) {
+  if (ED_view3d_is_region_xr_mirror_active(wm, v3d, region)) {
     view3d_xr_mirror_setup(wm, depsgraph, scene, v3d, region, rect);
   }
   else
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index cb641c55e44..8e7fe1fb145 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -1724,6 +1724,17 @@ void ED_view3d_xr_mirror_update(const ScrArea *area, const View3D *v3d, const bo
   }
 }
 
+bool ED_view3d_is_region_xr_mirror_active(const wmWindowManager *wm,
+                                          const View3D *v3d,
+                                          const ARegion *region)
+{
+  return (v3d->flag & V3D_XR_SESSION_MIRROR) &&
+         /* The free region (e.g. the camera region in quad-view) is always the last in the list
+            base. We don't want any other to be affected. */
+         !region->next &&  //
+         WM_xr_session_is_running(&wm->xr);
+}
+
 #endif
 
 /** \} */
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 03cca32e732..9a62bbb8a04 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -257,6 +257,19 @@ static void wm_region_test_render_do_draw(const Scene *scene,
   }
 }
 
+#ifdef WITH_XR_OPENXR
+static void wm_region_test_xr_do_draw(const wmWindowManager *wm,
+                                      const ScrArea *area,
+                                      ARegion *region)
+{
+  if (area->spacetype == SPACE_VIEW3D && region->regiontype == RGN_TYPE_WINDOW) {
+    if (ED_view3d_is_region_xr_mirror_active(wm, area->spacedata.first, region->regiondata)) {
+      ED_region_tag_redraw_no_rebuild(region);
+    }
+  }
+}
+#endif
+
 static bool wm_region_use_viewport_by_type(short space_type, short region_type)
 {
   return (ELEM(space_type, SPACE_VIEW3D, SPACE_IMAGE) && region_type == RGN_TYPE_WINDOW);
@@ -875,6 +888,7 @@ static void wm_draw_surface(bContext *C, wmSurface *surface)
 /* quick test to prevent changing window drawable */
 static bool wm_draw_update_test_window(Main *bmain, bContext *C, wmWindow *win)
 {
+  const wmWindowManager *wm = CTX_wm_manager(C);
   Scene *scene = WM_window_get_active_scene(win);
   ViewLayer *view_layer = WM_window_get_active_view_layer(win);
   struct Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, true);
@@ -897,6 +911,9 @@ static bool wm_draw_update_test_window(Main *bmain, bContext *C, wmWindow *win)
     for (region = sa->regionbase.first; region; region = region->next) {
       wm_region_test_gizmo_do_draw(C, sa, region, true);
       wm_region_test_render_do_draw(scene, depsgraph, sa, region);
+#ifdef WITH_XR_OPENXR
+      wm_region_test_xr_do_draw(wm, sa, region);
+#endif
 
       if (region->visible && region->do_draw) {
         do_draw = true;



More information about the Bf-blender-cvs mailing list