3D View: make text overlay optional
authorCampbell Barton <ideasman42@gmail.com>
Fri, 1 Jun 2018 06:26:55 +0000 (08:26 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 1 Jun 2018 06:26:55 +0000 (08:26 +0200)
release/scripts/startup/bl_ui/space_view3d.py
source/blender/draw/engines/eevee/eevee_lookdev.c
source/blender/draw/intern/draw_view.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/makesdna/DNA_view3d_types.h
source/blender/makesrna/intern/rna_space.c

index f9d9c77..e40c8a8 100644 (file)
@@ -3580,6 +3580,7 @@ class VIEW3D_PT_overlay(Panel):
 
         col = layout.column()
         col.active = display_all
+        col.prop(overlay, "show_text", text="Text")
         col.prop(overlay, "show_cursor", text="3D Cursor")
 
         col.prop(view, "show_manipulator", text="Manipulators")
index 0e0bea5..3894cc5 100644 (file)
@@ -86,7 +86,7 @@ void EEVEE_lookdev_draw_background(EEVEE_Data *vedata)
        EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
        EEVEE_EffectsInfo *effects = stl->effects;
        EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_ensure();
-       
+
        const DRWContextState *draw_ctx = DRW_context_state_get();
 
        if (psl->lookdev_pass && LOOK_DEV_OVERLAY_ENABLED(draw_ctx->v3d)) {
index 070a725..4bf2e65 100644 (file)
@@ -62,11 +62,13 @@ void DRW_draw_region_info(void)
 {
        const DRWContextState *draw_ctx = DRW_context_state_get();
        ARegion *ar = draw_ctx->ar;
-       int offset;
+       int offset = 0;
 
        DRW_draw_cursor();
 
-       offset = DRW_draw_region_engine_info_offset();
+       if ((draw_ctx->v3d->overlay.flag & V3D_OVERLAY_HIDE_TEXT) == 0) {
+               offset = DRW_draw_region_engine_info_offset();
+       }
 
        view3d_draw_region_info(draw_ctx->evil_C, ar, offset);
 
@@ -560,7 +562,7 @@ void DRW_draw_grid(void)
 void DRW_draw_background(void)
 {
        const DRWContextState *draw_ctx = DRW_context_state_get();
-       
+
        /* Just to make sure */
        glDepthMask(GL_TRUE);
        glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
index b44e2da..c41a1f4 100644 (file)
@@ -1207,33 +1207,37 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar, const int offset)
                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 (grid_unit) { /* draw below the viewport name */
-               char numstr[32] = "";
+// #if 0 /* TODO */
+               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();
 }
 
index 4868777..7ce19b9 100644 (file)
@@ -358,6 +358,7 @@ enum {
        V3D_OVERLAY_BONE_SELECTION    = (1 << 2),
        V3D_OVERLAY_LOOK_DEV          = (1 << 3),
        V3D_OVERLAY_WIREFRAMES        = (1 << 4),
+       V3D_OVERLAY_HIDE_TEXT         = (1 << 5),
 };
 
 /* View3DOverlay->edit_flag */
index 6b54740..845fe4f 100644 (file)
@@ -2472,6 +2472,11 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Show 3D Cursor", "Display 3D Cursor Overlay");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
+       prop = RNA_def_property(srna, "show_text", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_HIDE_TEXT);
+       RNA_def_property_ui_text(prop, "Show Text", "Display overlay text");
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
        prop = RNA_def_property(srna, "show_face_orientation", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_FACE_ORIENTATION);
        RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);