diff options
-rw-r--r-- | release/scripts/startup/bl_ui/space_userpref.py | 13 | ||||
-rw-r--r-- | source/blender/editors/include/UI_interface.h | 1 | ||||
-rw-r--r-- | source/blender/editors/space_userpref/space_userpref.c | 7 |
3 files changed, 20 insertions, 1 deletions
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 8f2d4b39f23..9b4f9b49a6b 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -35,6 +35,10 @@ class USERPREF_HT_header(Header): layout.template_header() + layout.separator_spacer() + + layout.operator("wm.save_userpref") + class USERPREF_PT_navigation_bar(Panel): bl_label = "Preferences Navigation" @@ -60,6 +64,15 @@ class USERPREF_PT_save_preferences(Panel): bl_region_type = 'EXECUTE' bl_options = {'HIDE_HEADER'} + @classmethod + def poll(cls, context): + # Hide when header is visible + for region in context.area.regions: + if region.type == 'HEADER' and region.height <= 1: + return True + + return False + def draw(self, _context): layout = self.layout layout.operator_context = 'EXEC_AREA' diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 1454b0c1690..1db42ec0a53 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -226,6 +226,7 @@ enum { #define UI_PANEL_WIDTH 340 #define UI_COMPACT_PANEL_WIDTH 160 #define UI_NAVIGATION_REGION_WIDTH UI_COMPACT_PANEL_WIDTH +#define UI_NARROW_NAVIGATION_REGION_WIDTH 100 #define UI_PANEL_CATEGORY_MARGIN_WIDTH (U.widget_unit * 1.0f) diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c index b7f6b045d4b..efaafb6cdb7 100644 --- a/source/blender/editors/space_userpref/space_userpref.c +++ b/source/blender/editors/space_userpref/space_userpref.c @@ -53,7 +53,7 @@ /* ******************** default callbacks for userpref space ***************** */ -static SpaceLink *userpref_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene)) +static SpaceLink *userpref_new(const ScrArea *area, const Scene *UNUSED(scene)) { ARegion *ar; SpaceUserPref *spref; @@ -76,6 +76,11 @@ static SpaceLink *userpref_new(const ScrArea *UNUSED(area), const Scene *UNUSED( ar->regiontype = RGN_TYPE_NAV_BAR; ar->alignment = RGN_ALIGN_LEFT; + /* Use smaller size when opened in area like properties editor. */ + if (area->winx && area->winx < 3.0f * UI_NAVIGATION_REGION_WIDTH * UI_DPI_FAC) { + ar->sizex = UI_NARROW_NAVIGATION_REGION_WIDTH; + } + /* execution region */ ar = MEM_callocN(sizeof(ARegion), "execution region for userpref"); |