Commit: 404bacc63980e33957c1ee98f2bd758dac90e951
Author: Jeroen Bakker
Date:   Thu Jul 5 15:39:20 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB404bacc63980e33957c1ee98f2bd758dac90e951

Refactored into a single option

Technical all options are still there for finetuning.

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

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 0c3219ae8e1..1ed33b78706 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -3833,14 +3833,7 @@ class VIEW3D_PT_overlay(Panel):
         sub.prop(overlay, "show_all_objects_origin")
 
         sub = split.column()
-        row = sub.row(align=True)
-        row.prop(overlay, "show_empties", text="", toggle=True)
-        row.prop(overlay, "show_lamps", text="", toggle=True)
-        row.prop(overlay, "show_cameras", text="", toggle=True)
-        row.prop(overlay, "show_armatures", text="", toggle=True)
-        row.prop(overlay, "show_lightprobes", text="", toggle=True)
-        row.prop(overlay, "show_speakers", text="", toggle=True)
-
+        sub.prop(overlay, "show_non_renderable_objects")
         sub.prop(overlay, "show_relationship_lines")
         sub.prop(overlay, "show_motion_paths")
         #sub.prop(overlay, "show_onion_skins")
diff --git a/source/blender/draw/modes/object_mode.c 
b/source/blender/draw/modes/object_mode.c
index b8387a53f22..0a45dd7f123 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -2185,27 +2185,31 @@ static void OBJECT_cache_populate(void *vedata, Object 
*ob)
                        break;
                case OB_LATTICE:
                {
-                       if (ob != draw_ctx->object_edit) {
-                               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);
-                               }
+                       if ((v3d->overlay.hidden_object_types & 
V3D_OVERLAY_HIDE_OTHER) == 0) {
+                               if (ob != draw_ctx->object_edit) {
+                                       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);
+                                       }
 
-                               DRWShadingGroup *shgroup = 
shgroup_theme_id_to_wire_or(stl, theme_id, stl->g_data->wire);
-                               DRW_shgroup_call_object_add(shgroup, geom, ob);
+                                       DRWShadingGroup *shgroup = 
shgroup_theme_id_to_wire_or(stl, theme_id, stl->g_data->wire);
+                                       DRW_shgroup_call_object_add(shgroup, 
geom, ob);
+                               }
                        }
                        break;
                }
 
                case OB_CURVE:
                {
-                       if (ob != draw_ctx->object_edit) {
-                               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);
+                       if ((v3d->overlay.hidden_object_types & 
V3D_OVERLAY_HIDE_OTHER) == 0) {
+                               if (ob != draw_ctx->object_edit) {
+                                       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);
+                                       }
+                                       DRWShadingGroup *shgroup = 
shgroup_theme_id_to_wire_or(stl, theme_id, stl->g_data->wire);
+                                       DRW_shgroup_call_object_add(shgroup, 
geom, ob);
                                }
-                               DRWShadingGroup *shgroup = 
shgroup_theme_id_to_wire_or(stl, theme_id, stl->g_data->wire);
-                               DRW_shgroup_call_object_add(shgroup, geom, ob);
                        }
                        break;
                }
@@ -2271,8 +2275,10 @@ static void OBJECT_cache_populate(void *vedata, Object 
*ob)
                        break;
        }
 
-       if (ob->pd && ob->pd->forcefield) {
-               DRW_shgroup_forcefield(stl, ob, view_layer);
+       if ((v3d->overlay.hidden_object_types & V3D_OVERLAY_HIDE_OTHER) == 0) {
+               if (ob->pd && ob->pd->forcefield) {
+                       DRW_shgroup_forcefield(stl, ob, view_layer);
+               }
        }
 
        /* don't show object extras in set's */
diff --git a/source/blender/makesdna/DNA_view3d_types.h 
b/source/blender/makesdna/DNA_view3d_types.h
index 04edb202ded..c1244e9a0c7 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -392,7 +392,9 @@ enum {
        V3D_OVERLAY_HIDE_SPEAKER      = (1 << OB_SPEAKER),
        V3D_OVERLAY_HIDE_LIGHTPROBE   = (1 << OB_LIGHTPROBE),
        V3D_OVERLAY_HIDE_ARMATURE     = (1 << OB_ARMATURE),
+       V3D_OVERLAY_HIDE_OTHER        = (1 << 14),
 };
+#define V3D_OVERLAY_HIDE_NON_RENDERABLE (V3D_OVERLAY_HIDE_EMPTY | 
V3D_OVERLAY_HIDE_LAMP | V3D_OVERLAY_HIDE_CAMERA | V3D_OVERLAY_HIDE_SPEAKER | 
V3D_OVERLAY_HIDE_LIGHTPROBE | V3D_OVERLAY_HIDE_ARMATURE | 
V3D_OVERLAY_HIDE_OTHER)
 
 /* View3DOverlay->edit_flag */
 enum {
diff --git a/source/blender/makesrna/intern/rna_space.c 
b/source/blender/makesrna/intern/rna_space.c
index 346ca6c8774..249f6b29143 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2608,52 +2608,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_empties", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_negative_sdna(prop, NULL, 
"overlay.hidden_object_types", V3D_OVERLAY_HIDE_EMPTY);
+       prop = RNA_def_property(srna, "show_non_renderable_objects", 
PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, 
"overlay.hidden_object_types", V3D_OVERLAY_HIDE_NON_RENDERABLE);
        RNA_def_property_boolean_default(prop, true);
        RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-       RNA_def_property_ui_text(prop, "Show Empties", "Draw empties in the 
overlay");
-       RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_EMPTY, 0);
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       prop = RNA_def_property(srna, "show_cameras", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_negative_sdna(prop, NULL, 
"overlay.hidden_object_types", V3D_OVERLAY_HIDE_CAMERA);
-       RNA_def_property_boolean_default(prop, true);
-       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-       RNA_def_property_ui_text(prop, "Show Cameras", "Draw cameras in the 
overlay");
-       RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_CAMERA, 0);
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       prop = RNA_def_property(srna, "show_speakers", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_negative_sdna(prop, NULL, 
"overlay.hidden_object_types", V3D_OVERLAY_HIDE_SPEAKER);
-       RNA_def_property_boolean_default(prop, true);
-       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-       RNA_def_property_ui_text(prop, "Show Speakers", "Draw speakers in the 
overlay");
-       RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_SPEAKER, 0);
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       prop = RNA_def_property(srna, "show_lightprobes", PROP_BOOLEAN, 
PROP_NONE);
-       RNA_def_property_boolean_negative_sdna(prop, NULL, 
"overlay.hidden_object_types", V3D_OVERLAY_HIDE_LIGHTPROBE);
-       RNA_def_property_boolean_default(prop, true);
-       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-       RNA_def_property_ui_text(prop, "Show Lightprobes", "Draw lightprobes in 
the overlay");
-       RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_LIGHTPROBE, 0);
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       prop = RNA_def_property(srna, "show_armatures", PROP_BOOLEAN, 
PROP_NONE);
-       RNA_def_property_boolean_negative_sdna(prop, NULL, 
"overlay.hidden_object_types", V3D_OVERLAY_HIDE_ARMATURE);
-       RNA_def_property_boolean_default(prop, true);
-       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-       RNA_def_property_ui_text(prop, "Show Armatures", "Draw armatures in the 
overlay");
-       RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_ARMATURE, 0);
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       prop = RNA_def_property(srna, "show_lamps", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_negative_sdna(prop, NULL, 
"overlay.hidden_object_types", V3D_OVERLAY_HIDE_LAMP);
-       RNA_def_property_boolean_default(prop, true);
-       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-       RNA_def_property_ui_text(prop, "Show Lamps", "Draw lamps in the 
overlay");
-       RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_LAMP, 0);
+       RNA_def_property_ui_text(prop, "Show Non Renderable", "Draw not 
renderable objects in the overlay");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
        prop = RNA_def_property(srna, "show_text", PROP_BOOLEAN, PROP_NONE);

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

Reply via email to