diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-07-12 10:38:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-07-12 10:39:41 +0300 |
commit | 963da9ff6e1c87bf340b5832f0c1ba2c28cbb338 (patch) | |
tree | a8799418ca14ed2212a49636c8099145fab84fcf /source/blender/makesrna | |
parent | 66087fe127b89390233dde4aee3c61d05a29c36b (diff) |
UI: 4-state icon for view visibility popover
This is a quick way to see if some of the object types in the
scene are hidden or unselected.
Icon design may change.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index c3378a68884..b98ec3b0204 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -905,6 +905,15 @@ static const EnumPropertyItem *rna_SpaceView3D_stereo3d_camera_itemf( return stereo3d_camera_items; } +static int rna_SpaceView3D_icon_from_show_object_viewport_get(PointerRNA *ptr) +{ + const View3D *v3d = (View3D *)ptr->data; + /* Ignore selection values when view is off, intent is to show if visible objects aren't selectable. */ + const int view_value = (v3d->object_type_exclude_viewport != 0); + const int select_value = (v3d->object_type_exclude_select & ~v3d->object_type_exclude_viewport) != 0; + return ICON_VIS_SEL_11 + (view_value << 1) + select_value; +} + static PointerRNA rna_SpaceView3D_shading_get(PointerRNA *ptr) { return rna_pointer_inherit_refine(ptr, &RNA_View3DShading, ptr->data); @@ -3113,6 +3122,12 @@ static void rna_def_space_view3d(BlenderRNA *brna) } } + + /* Heper for drawing the icon. */ + prop = RNA_def_property(srna, "icon_from_show_object_viewport", PROP_INT, PROP_NONE); + RNA_def_property_int_funcs(prop, "rna_SpaceView3D_icon_from_show_object_viewport_get", NULL, NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Visibility Iconm", ""); } /* Nested Structs */ |