Merge branch 'master' into blender2.8
[blender.git] / source / blender / editors / space_view3d / view3d_draw.c
index b44e2da3583d9bff5330b2c1f11b723248fcdce3..5cd36cce31c778e2d26eb56d8a7e6086878ac5e9 100644 (file)
@@ -4,7 +4,7 @@
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. 
+ * of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -18,7 +18,7 @@
  * The Original Code is Copyright (C) 2008 Blender Foundation.
  * All rights reserved.
  *
  * The Original Code is Copyright (C) 2008 Blender Foundation.
  * All rights reserved.
  *
- * 
+ *
  * Contributor(s): Blender Foundation
  *
  * ***** END GPL LICENSE BLOCK *****
  * Contributor(s): Blender Foundation
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -441,14 +441,14 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *ar, View
                return;
        if (v3d->camera->type == OB_CAMERA)
                ca = v3d->camera->data;
                return;
        if (v3d->camera->type == OB_CAMERA)
                ca = v3d->camera->data;
-       
+
        ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &viewborder, false);
        /* the offsets */
        x1 = viewborder.xmin;
        y1 = viewborder.ymin;
        x2 = viewborder.xmax;
        y2 = viewborder.ymax;
        ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &viewborder, false);
        /* the offsets */
        x1 = viewborder.xmin;
        y1 = viewborder.ymin;
        x2 = viewborder.xmax;
        y2 = viewborder.ymax;
-       
+
        glLineWidth(1.0f);
 
        /* apply offsets so the real 3D camera shows through */
        glLineWidth(1.0f);
 
        /* apply offsets so the real 3D camera shows through */
@@ -647,7 +647,7 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *ar, View
 
                        /* draw */
                        immUniformThemeColorShade(TH_VIEW_OVERLAY, 100);
 
                        /* draw */
                        immUniformThemeColorShade(TH_VIEW_OVERLAY, 100);
-                       
+
                        /* TODO Was using UI_draw_roundbox_4fv(false, rect.xmin, rect.ymin, rect.xmax, rect.ymax, 2.0f, color).
                         * We'll probably need a new imm_draw_line_roundbox_dashed dor that - though in practice the
                         * 2.0f round corner effect was nearly not visible anyway... */
                        /* TODO Was using UI_draw_roundbox_4fv(false, rect.xmin, rect.ymin, rect.xmax, rect.ymax, 2.0f, color).
                         * We'll probably need a new imm_draw_line_roundbox_dashed dor that - though in practice the
                         * 2.0f round corner effect was nearly not visible anyway... */
@@ -885,7 +885,7 @@ static void UNUSED_FUNCTION(draw_rotation_guide)(RegionView3D *rv3d)
                sub_v3_v3v3(end, o, scaled_axis);
                immVertex3fv(pos, end);
                immEnd();
                sub_v3_v3v3(end, o, scaled_axis);
                immVertex3fv(pos, end);
                immEnd();
-               
+
                /* -- draw ring around rotation center -- */
                {
 #define     ROT_AXIS_DETAIL 13
                /* -- draw ring around rotation center -- */
                {
 #define     ROT_AXIS_DETAIL 13
@@ -1207,33 +1207,37 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar, const int offset)
                draw_view_axis(rv3d, &rect);
        }
 
                draw_view_axis(rv3d, &rect);
        }
 
-       if ((U.uiflag & USER_SHOW_FPS) && ED_screen_animation_no_scrub(wm)) {
-               ED_scene_draw_fps(scene, &rect);
-       }
-       else if (U.uiflag & USER_SHOW_VIEWPORTNAME) {
-               draw_viewport_name(ar, v3d, &rect);
-       }
+       if ((v3d->overlay.flag & V3D_OVERLAY_HIDE_TEXT) == 0) {
+               if ((U.uiflag & USER_SHOW_FPS) && ED_screen_animation_no_scrub(wm)) {
+                       ED_scene_draw_fps(scene, &rect);
+               }
+               else if (U.uiflag & USER_SHOW_VIEWPORTNAME) {
+                       draw_viewport_name(ar, v3d, &rect);
+               }
 
 
-       if (U.uiflag & USER_DRAWVIEWINFO) {
-               ViewLayer *view_layer = CTX_data_view_layer(C);
-               Object *ob = OBACT(view_layer);
-               draw_selected_name(scene, ob, &rect);
-       }
+               if (U.uiflag & USER_DRAWVIEWINFO) {
+                       ViewLayer *view_layer = CTX_data_view_layer(C);
+                       Object *ob = OBACT(view_layer);
+                       draw_selected_name(scene, ob, &rect);
+               }
 
 #if 0 /* TODO */
 
 #if 0 /* TODO */
-       if (grid_unit) { /* draw below the viewport name */
-               char numstr[32] = "";
+               if (grid_unit) { /* draw below the viewport name */
+                       char numstr[32] = "";
 
 
-               UI_FontThemeColor(BLF_default(), TH_TEXT_HI);
-               if (v3d->grid != 1.0f) {
-                       BLI_snprintf(numstr, sizeof(numstr), "%s x %.4g", grid_unit, v3d->grid);
-               }
+                       UI_FontThemeColor(BLF_default(), TH_TEXT_HI);
+                       if (v3d->grid != 1.0f) {
+                               BLI_snprintf(numstr, sizeof(numstr), "%s x %.4g", grid_unit, v3d->grid);
+                       }
 
 
-               BLF_draw_default_ascii(rect.xmin + U.widget_unit,
-                                      rect.ymax - (USER_SHOW_VIEWPORTNAME ? 2 * U.widget_unit : U.widget_unit), 0.0f,
-                                      numstr[0] ? numstr : grid_unit, sizeof(numstr));
-       }
+                       BLF_draw_default_ascii(
+                               rect.xmin + U.widget_unit,
+                               rect.ymax - (USER_SHOW_VIEWPORTNAME ? 2 * U.widget_unit : U.widget_unit), 0.0f,
+                               numstr[0] ? numstr : grid_unit, sizeof(numstr));
+               }
 #endif
 #endif
+       }
+
        BLF_batch_draw_end();
 }
 
        BLF_batch_draw_end();
 }
 
@@ -1248,7 +1252,7 @@ static void view3d_draw_view(const bContext *C, ARegion *ar)
 RenderEngineType *ED_view3d_engine_type(Scene *scene, int drawtype)
 {
        /*
 RenderEngineType *ED_view3d_engine_type(Scene *scene, int drawtype)
 {
        /*
-        * Tempory viewport draw modes until we have a proper system. 
+        * Tempory viewport draw modes until we have a proper system.
         * all modes are done in the draw manager, except
         * cycles material as it is an external render engine.
         */
         * all modes are done in the draw manager, except
         * cycles material as it is an external render engine.
         */