3D View: make text overlay optional

This commit is contained in:
2018-06-01 08:26:55 +02:00
parent 63785a889c
commit c87cfcc8de
6 changed files with 41 additions and 28 deletions

View 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")

View 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)) {

View 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);

View 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 (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] = "";
UI_FontThemeColor(BLF_default(), TH_TEXT_HI);
if (v3d->grid != 1.0f) {
BLI_snprintf(numstr, sizeof(numstr), "%s x %.4g", grid_unit, v3d->grid);
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);
}
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));
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] = "";
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));
}
// #endif
}
#endif
BLF_batch_draw_end();
}

View 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 */

View 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);