3D View: option to hide object overlays

This hides extra wires and details you may want to disable,
name may be changed.
This commit is contained in:
Campbell Barton
2018-07-10 18:30:45 +02:00
parent 245d0d6bb7
commit 8a3366a494
4 changed files with 36 additions and 1 deletions

View File

@@ -3897,6 +3897,7 @@ class VIEW3D_PT_overlay(Panel):
#sub.prop(overlay, "show_onion_skins")
sub.prop(overlay, "show_face_orientation")
sub.prop(overlay, "show_backface_culling")
sub.prop(overlay, "show_ornaments", text="Ornaments")
sub.prop(overlay, "show_bones", text="Bones")
if shading.type == 'MATERIAL':
sub.prop(overlay, "show_look_dev")

View File

@@ -2131,6 +2131,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
bool do_outlines = (draw_ctx->v3d->flag & V3D_SELECT_OUTLINE) && ((ob->base_flag & BASE_SELECTED) != 0);
bool show_relations = ((draw_ctx->v3d->flag & V3D_HIDE_HELPLINES) == 0);
const bool hide_object_extra = (v3d->overlay.flag & V3D_OVERLAY_HIDE_OBJECT_XTRAS) != 0;
if (do_outlines) {
if ((ob != draw_ctx->object_edit) && !((ob == draw_ctx->obact) && (draw_ctx->object_mode & OB_MODE_ALL_PAINT))) {
@@ -2156,6 +2157,9 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
switch (ob->type) {
case OB_MESH:
{
if (hide_object_extra) {
break;
}
if (ob != draw_ctx->object_edit) {
Mesh *me = ob->data;
if (me->totedge == 0) {
@@ -2188,6 +2192,9 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
case OB_LATTICE:
{
if (ob != draw_ctx->object_edit) {
if (hide_object_extra) {
break;
}
struct Gwn_Batch *geom = DRW_cache_lattice_wire_get(ob, false);
if (theme_id == TH_UNDEFINED) {
theme_id = DRW_object_wire_theme_get(ob, view_layer, NULL);
@@ -2201,6 +2208,9 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
case OB_CURVE:
{
if (ob != draw_ctx->object_edit) {
if (hide_object_extra) {
break;
}
struct Gwn_Batch *geom = DRW_cache_curve_edge_wire_get(ob);
if (theme_id == TH_UNDEFINED) {
theme_id = DRW_object_wire_theme_get(ob, view_layer, NULL);
@@ -2218,22 +2228,40 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
break;
}
case OB_LAMP:
if (hide_object_extra) {
break;
}
DRW_shgroup_lamp(stl, ob, view_layer);
break;
case OB_CAMERA:
DRW_shgroup_camera(stl, ob, view_layer);
if (hide_object_extra) {
break;
}
DRW_shgroup_camera(stl, ob, view_layer);
break;
case OB_EMPTY:
if (hide_object_extra) {
break;
}
DRW_shgroup_empty(stl, psl, ob, view_layer);
break;
case OB_SPEAKER:
if (hide_object_extra) {
break;
}
DRW_shgroup_speaker(stl, ob, view_layer);
break;
case OB_LIGHTPROBE:
if (hide_object_extra) {
break;
}
DRW_shgroup_lightprobe(stl, psl, ob, view_layer);
break;
case OB_ARMATURE:
{
if (v3d->overlay.flag & V3D_OVERLAY_HIDE_BONES) {
break;
}
bArmature *arm = ob->data;
if (arm->edbo == NULL) {
if (DRW_state_is_select() || !DRW_pose_mode_armature(ob, draw_ctx->obact)) {

View File

@@ -387,6 +387,7 @@ enum {
V3D_OVERLAY_HIDE_MOTION_PATHS = (1 << 6),
V3D_OVERLAY_ONION_SKINS = (1 << 7),
V3D_OVERLAY_HIDE_BONES = (1 << 8),
V3D_OVERLAY_HIDE_OBJECT_XTRAS = (1 << 9),
};
/* View3DOverlay->edit_flag */

View File

@@ -2637,6 +2637,11 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
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_ornaments", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_HIDE_OBJECT_XTRAS);
RNA_def_property_ui_text(prop, "Ornaments", "Object details, including empty wire, cameras and other extras");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "show_bones", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_HIDE_BONES);
RNA_def_property_ui_text(prop, "Show Bones", "Display bones");