[Bf-blender-cvs] [9c9081bf834] xr-actions-D9124: Fix annotations not being shown in XR view.

Peter Kim noreply at git.blender.org
Tue Oct 13 14:45:01 CEST 2020


Commit: 9c9081bf834f36b2864717a9650c02604f6d6c68
Author: Peter Kim
Date:   Sun Oct 11 17:20:43 2020 +0900
Branches: xr-actions-D9124
https://developer.blender.org/rB9c9081bf834f36b2864717a9650c02604f6d6c68

Fix annotations not being shown in XR view.

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

M	source/blender/draw/intern/draw_manager.c
M	source/blender/editors/include/ED_view3d_offscreen.h
M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/makesdna/DNA_view3d_types.h
M	source/blender/windowmanager/xr/intern/wm_xr_draw.c

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

diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 3ade3611a6a..2545564e6fe 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1446,7 +1446,7 @@ void DRW_draw_callbacks_post_scene(void)
 
     GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
   }
-  else if ((v3d->flag2 & V3D_XR_SHOW_CONTROLLERS) != 0) {
+  else if ((v3d->flag & V3D_XR_SESSION_SURFACE) != 0) {
     DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
 
     DRW_state_reset();
@@ -1460,12 +1460,13 @@ void DRW_draw_callbacks_post_scene(void)
     if (do_annotations) {
       GPU_depth_test(GPU_DEPTH_NONE);
       ED_annotation_draw_view3d(DEG_get_input_scene(depsgraph), depsgraph, v3d, region, true);
-      GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
     }
 
     /* Controllers. */
-    GPU_depth_test(GPU_DEPTH_ALWAYS);
-    WM_xr_draw_controllers();
+    if ((v3d->flag2 & V3D_XR_SHOW_CONTROLLERS) != 0) {
+      GPU_depth_test(GPU_DEPTH_ALWAYS);
+      WM_xr_draw_controllers();
+    }
 
     GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
   }
diff --git a/source/blender/editors/include/ED_view3d_offscreen.h b/source/blender/editors/include/ED_view3d_offscreen.h
index 2833d205e77..393976aa91f 100644
--- a/source/blender/editors/include/ED_view3d_offscreen.h
+++ b/source/blender/editors/include/ED_view3d_offscreen.h
@@ -60,7 +60,7 @@ void ED_view3d_draw_offscreen(struct Depsgraph *depsgraph,
 void ED_view3d_draw_offscreen_simple(struct Depsgraph *depsgraph,
                                      struct Scene *scene,
                                      struct View3DShading *shading_override,
-                                     int drawtype,
+                                     eDrawType drawtype,
                                      int winx,
                                      int winy,
                                      unsigned int draw_flags,
@@ -68,6 +68,7 @@ void ED_view3d_draw_offscreen_simple(struct Depsgraph *depsgraph,
                                      const float winmat[4][4],
                                      float clip_start,
                                      float clip_end,
+                                     bool is_xr_surface,
                                      bool is_image_render,
                                      bool do_sky,
                                      bool is_persp,
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index e80de3a3f79..364c79a9578 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1749,7 +1749,7 @@ void ED_view3d_draw_offscreen(Depsgraph *depsgraph,
 void ED_view3d_draw_offscreen_simple(Depsgraph *depsgraph,
                                      Scene *scene,
                                      View3DShading *shading_override,
-                                     int drawtype,
+                                     eDrawType drawtype,
                                      int winx,
                                      int winy,
                                      uint draw_flags,
@@ -1757,6 +1757,7 @@ void ED_view3d_draw_offscreen_simple(Depsgraph *depsgraph,
                                      const float winmat[4][4],
                                      float clip_start,
                                      float clip_end,
+                                     bool is_xr_surface,
                                      bool is_image_render,
                                      bool do_sky,
                                      bool is_persp,
@@ -1803,13 +1804,16 @@ void ED_view3d_draw_offscreen_simple(Depsgraph *depsgraph,
       v3d.grid = 1.0f;
       v3d.gridlines = 16;
       v3d.gridsubdiv = 10;
-
-      /* Show grid, disable other overlays (set all available _HIDE_ flags). */
-      v3d.overlay.flag |= V3D_OVERLAY_HIDE_CURSOR | V3D_OVERLAY_HIDE_TEXT |
-                          V3D_OVERLAY_HIDE_MOTION_PATHS | V3D_OVERLAY_HIDE_BONES |
-                          V3D_OVERLAY_HIDE_OBJECT_XTRAS | V3D_OVERLAY_HIDE_OBJECT_ORIGINS;
-      v3d.flag |= V3D_HIDE_HELPLINES;
     }
+    /* Disable other overlays (set all available _HIDE_ flags). */
+    v3d.overlay.flag |= V3D_OVERLAY_HIDE_CURSOR | V3D_OVERLAY_HIDE_TEXT |
+      V3D_OVERLAY_HIDE_MOTION_PATHS | V3D_OVERLAY_HIDE_BONES |
+      V3D_OVERLAY_HIDE_OBJECT_XTRAS | V3D_OVERLAY_HIDE_OBJECT_ORIGINS;
+    v3d.flag |= V3D_HIDE_HELPLINES;
+  }
+
+  if (is_xr_surface) {
+    v3d.flag |= V3D_XR_SESSION_SURFACE;
   }
 
   rv3d.persp = RV3D_PERSP;
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 7d85b7ee418..925b1e508be 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -364,6 +364,7 @@ typedef struct View3D {
 #define V3D_HIDE_HELPLINES (1 << 2)
 #define V3D_INVALID_BACKBUF (1 << 3)
 #define V3D_XR_SESSION_MIRROR (1 << 4)
+#define V3D_XR_SESSION_SURFACE (1 << 5)
 
 #define V3D_FLAG_UNUSED_10 (1 << 10) /* cleared */
 #define V3D_SELECT_OUTLINE (1 << 11)
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_draw.c b/source/blender/windowmanager/xr/intern/wm_xr_draw.c
index 8f4706253e6..7477afb8ca3 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_draw.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_draw.c
@@ -153,6 +153,7 @@ void wm_xr_draw_view(const GHOST_XrDrawViewInfo *draw_view, void *customdata)
                                   winmat,
                                   settings->clip_start,
                                   settings->clip_end,
+                                  true,
                                   false,
                                   true,
                                   true,



More information about the Bf-blender-cvs mailing list