Commit: 8a3366a494cf2939138a96cb93a2b666a3be77c8
Author: Campbell Barton
Date:   Tue Jul 10 18:30:45 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB8a3366a494cf2939138a96cb93a2b666a3be77c8

3D View: option to hide object overlays

This hides extra wires and details you may want to disable,
name may be changed.

===================================================================

M       release/scripts/startup/bl_ui/space_view3d.py
M       source/blender/draw/modes/object_mode.c
M       source/blender/makesdna/DNA_view3d_types.h
M       source/blender/makesrna/intern/rna_space.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index cf2c9641971..d9f17f70e20 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -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")
diff --git a/source/blender/draw/modes/object_mode.c 
b/source/blender/draw/modes/object_mode.c
index 2ac16906102..0726c3660d5 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -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)) {
diff --git a/source/blender/makesdna/DNA_view3d_types.h 
b/source/blender/makesdna/DNA_view3d_types.h
index 1f0476e9db7..b21d6814289 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -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 */
diff --git a/source/blender/makesrna/intern/rna_space.c 
b/source/blender/makesrna/intern/rna_space.c
index 81efcf3c4dd..752972b0797 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -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");

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to