Fix T58850: NDOF navigation guide not shown
authorCampbell Barton <ideasman42@gmail.com>
Tue, 11 Dec 2018 01:34:37 +0000 (12:34 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 11 Dec 2018 01:35:18 +0000 (12:35 +1100)
source/blender/draw/intern/draw_view.c
source/blender/editors/space_view3d/view3d_draw.c

index 8867c85ac2f51fd72851da9e94c17d0c45383f4d..f56cbd680777134a60ab09f9898f9e678cd6fc7b 100644 (file)
@@ -227,6 +227,9 @@ void DRW_draw_cursor(void)
                                immUnbindProgram();
                        }
 
+                       float original_proj[4][4];
+                       GPU_matrix_projection_get(original_proj);
+                       GPU_matrix_push();
                        ED_region_pixelspace(ar);
                        GPU_matrix_translate_2f(co[0] + 0.5f, co[1] + 0.5f);
                        GPU_matrix_scale_2f(U.widget_unit, U.widget_unit);
@@ -239,6 +242,8 @@ void DRW_draw_cursor(void)
 
                        glDisable(GL_BLEND);
                        glDisable(GL_LINE_SMOOTH);
+                       GPU_matrix_pop();
+                       GPU_matrix_projection_set(original_proj);
                }
        }
 }
index b9db773aaee2ff430cc713c39493432f010ec53c..f6b2c79b88b25342fdf81f7df12ca43376d6a272 100644 (file)
@@ -877,7 +877,7 @@ static void draw_view_axis(RegionView3D *rv3d, const rcti *rect)
 
 #ifdef WITH_INPUT_NDOF
 /* draw center and axis of rotation for ongoing 3D mouse navigation */
-static void UNUSED_FUNCTION(draw_rotation_guide)(RegionView3D *rv3d)
+static void draw_rotation_guide(const RegionView3D *rv3d)
 {
        float o[3];    /* center of rotation */
        float end[3];  /* endpoints for drawing */
@@ -1246,6 +1246,16 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar)
        Scene *scene = CTX_data_scene(C);
        wmWindowManager *wm = CTX_wm_manager(C);
 
+#ifdef WITH_INPUT_NDOF
+       if ((U.ndof_flag & NDOF_SHOW_GUIDE) &&
+           ((rv3d->viewlock & RV3D_LOCKED) == 0) &&
+           (rv3d->persp != RV3D_CAMOB))
+       {
+               /* TODO: draw something else (but not this) during fly mode */
+               draw_rotation_guide(rv3d);
+       }
+#endif
+
        /* correct projection matrix */
        ED_region_pixelspace(ar);