diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-18 22:13:22 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-19 07:53:38 +0300 |
commit | 9573bf432c4b06d940b4b38cc455826f47518884 (patch) | |
tree | 6e8d4136abfbbd953423b1b6948ab64f11187eee /source/blender/makesrna | |
parent | 638938e5a8c30c405c3b4e96ab4f78095003958b (diff) |
UI: move top-bar into the spaces header
Currently this is only in the 3D viewport however all spaces
that use the tool-system will have this region added.
D4680 by @brecht with own updates.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_screen.c | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 43 |
2 files changed, 41 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 5913376606b..89996cf3241 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -43,6 +43,7 @@ const EnumPropertyItem rna_enum_region_type_items[] = { {RGN_TYPE_NAV_BAR, "NAVIGATION_BAR", 0, "Navigation Bar", ""}, {RGN_TYPE_EXECUTE, "EXECUTE", 0, "Execute Buttons", ""}, {RGN_TYPE_FOOTER, "FOOTER", 0, "Footer", ""}, + {RGN_TYPE_TOOL_HEADER, "TOOL_HEADER", 0, "Tool Header", ""}, {0, NULL, 0, NULL, NULL}, }; @@ -550,11 +551,6 @@ static void rna_def_screen(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, "rna_Screen_fullscreen_get", NULL); RNA_def_property_ui_text(prop, "Maximize", "An area is maximized, filling this screen"); - prop = RNA_def_property(srna, "show_topbar", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SCREEN_COLLAPSE_TOPBAR); - RNA_def_property_ui_text(prop, "Show Top Bar", "Show top bar with tool settings"); - RNA_def_property_update(prop, 0, "rna_Screen_bar_update"); - prop = RNA_def_property(srna, "show_statusbar", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SCREEN_COLLAPSE_STATUSBAR); RNA_def_property_ui_text(prop, "Show Status Bar", "Show status bar"); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 04032d0863a..984536b6907 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -622,12 +622,44 @@ static bool rna_Space_show_region_header_get(PointerRNA *ptr) static void rna_Space_show_region_header_set(PointerRNA *ptr, bool value) { rna_Space_bool_from_region_flag_set_by_type(ptr, RGN_TYPE_HEADER, RGN_FLAG_HIDDEN, !value); + + /* Special case, never show the tool properties when the header is invisible. */ + bool value_for_tool_header = value; + if (value == true) { + ScrArea *sa = rna_area_from_space(ptr); + ARegion *ar_tool_header = BKE_area_find_region_type(sa, RGN_TYPE_TOOL_HEADER); + if (ar_tool_header != NULL) { + value = !(ar_tool_header->flag & RGN_FLAG_HIDDEN_BY_USER); + } + } + rna_Space_bool_from_region_flag_set_by_type( + ptr, RGN_TYPE_TOOL_HEADER, RGN_FLAG_HIDDEN, !value_for_tool_header); } static void rna_Space_show_region_header_update(bContext *C, PointerRNA *ptr) { rna_Space_bool_from_region_flag_update_by_type(C, ptr, RGN_TYPE_HEADER, RGN_FLAG_HIDDEN); } +/* Tool Header Region. + * + * This depends on the 'RGN_TYPE_TOOL_HEADER' + */ +static bool rna_Space_show_region_tool_header_get(PointerRNA *ptr) +{ + return !rna_Space_bool_from_region_flag_get_by_type( + ptr, RGN_TYPE_TOOL_HEADER, RGN_FLAG_HIDDEN_BY_USER); +} +static void rna_Space_show_region_tool_header_set(PointerRNA *ptr, bool value) +{ + rna_Space_bool_from_region_flag_set_by_type( + ptr, RGN_TYPE_TOOL_HEADER, RGN_FLAG_HIDDEN_BY_USER, !value); + rna_Space_bool_from_region_flag_set_by_type(ptr, RGN_TYPE_TOOL_HEADER, RGN_FLAG_HIDDEN, !value); +} +static void rna_Space_show_region_tool_header_update(bContext *C, PointerRNA *ptr) +{ + rna_Space_bool_from_region_flag_update_by_type(C, ptr, RGN_TYPE_TOOL_HEADER, RGN_FLAG_HIDDEN); +} + /* Tools Region. */ static bool rna_Space_show_region_toolbar_get(PointerRNA *ptr) { @@ -2422,6 +2454,10 @@ static void rna_def_space_generic_show_region_toggles(StructRNA *srna, int regio } \ ((void)0) + if (region_type_mask & (1 << RGN_TYPE_TOOL_HEADER)) { + region_type_mask &= ~(1 << RGN_TYPE_TOOL_HEADER); + DEF_SHOW_REGION_PROPERTY(show_region_tool_header, "Tool Header", ""); + } if (region_type_mask & (1 << RGN_TYPE_HEADER)) { region_type_mask &= ~(1 << RGN_TYPE_HEADER); DEF_SHOW_REGION_PROPERTY(show_region_header, "Header", ""); @@ -3546,8 +3582,9 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_struct_sdna(srna, "View3D"); RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data"); - rna_def_space_generic_show_region_toggles( - srna, (1 << RGN_TYPE_TOOLS) | (1 << RGN_TYPE_UI) | (1 << RGN_TYPE_HUD)); + rna_def_space_generic_show_region_toggles(srna, + ((1 << RGN_TYPE_TOOL_HEADER) | (1 << RGN_TYPE_TOOLS) | + (1 << RGN_TYPE_UI) | (1 << RGN_TYPE_HUD))); prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); @@ -4054,7 +4091,7 @@ static void rna_def_space_image(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Space Image Editor", "Image and UV editor space data"); rna_def_space_generic_show_region_toggles( - srna, (1 << RGN_TYPE_TOOLS) | (1 << RGN_TYPE_UI) | (1 << RGN_TYPE_HUD)); + srna, (1 << RGN_TYPE_TOOL_HEADER) | (1 << RGN_TYPE_TOOLS) | (1 << RGN_TYPE_UI) | (1 << RGN_TYPE_HUD)); /* image */ prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE); |