2023-08-16 00:20:26 +10:00
|
|
|
# SPDX-FileCopyrightText: 2009-2023 Blender Authors
|
2023-06-15 13:09:04 +10:00
|
|
|
#
|
2022-02-11 09:07:11 +11:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
2023-06-15 13:09:04 +10:00
|
|
|
|
UI: Vertical Properties Editor Tabs
Moves the Properties editor context switching to a vertical tabs region.
Design Task: T54951
Differential Revison: D3840
The tabs are regular widgets, unlike the 'old' toolshelf tabs. This means they
give mouse hover feedback, have tooltips, support the right-click menu, etc.
Also, when vertical screen space gets tight, the tabs can be scrolled, they
don't shrink like the toolshelf ones.
The tab region is slightly larger than the header. The tabs are scaled up
accordingly. This makes them nicely readable.
The header is quite empty now. As shown in T54951, we wanted to have a search
button there. This should be added next.
Implementation Notes:
* Added a new region type, RGN_TYPE_NAVIGATION.
* Having the tabs in a separate region allows scrolling of the tab-bar, unlike
the toolshelf tabs. We might want to remove the scrollbars though.
* Added a new region flag RGN_FLAG_PREFSIZE_OR_HIDDEN, to ensure the tab region
is either hidden or has a fixed size.
* Added some additional flags to support fine-tuning the layout in panel and
layout code.
* Bumps subversion.
2018-10-29 21:34:14 +01:00
|
|
|
from bpy.types import Header, Panel
|
2013-06-19 19:37:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class PROPERTIES_HT_header(Header):
|
|
|
|
|
bl_space_type = 'PROPERTIES'
|
|
|
|
|
|
2020-09-15 09:50:14 -05:00
|
|
|
def draw(self, context):
|
2013-06-19 19:37:17 +00:00
|
|
|
layout = self.layout
|
2020-09-15 09:50:14 -05:00
|
|
|
view = context.space_data
|
2020-10-21 17:11:56 +02:00
|
|
|
region = context.region
|
|
|
|
|
ui_scale = context.preferences.system.ui_scale
|
2013-06-19 19:37:17 +00:00
|
|
|
|
2019-04-21 04:49:19 +10:00
|
|
|
layout.template_header()
|
2018-05-31 21:45:26 +02:00
|
|
|
|
2020-09-15 09:50:14 -05:00
|
|
|
layout.separator_spacer()
|
|
|
|
|
|
2020-10-21 17:11:56 +02:00
|
|
|
# The following is an ugly attempt to make the search button center-align better visually.
|
|
|
|
|
# A dummy icon is inserted that has to be scaled as the available width changes.
|
|
|
|
|
content_size_est = 160 * ui_scale
|
|
|
|
|
layout_scale = min(1, max(0, (region.width / content_size_est) - 1))
|
|
|
|
|
if layout_scale > 0:
|
|
|
|
|
row = layout.row()
|
|
|
|
|
row.scale_x = layout_scale
|
|
|
|
|
row.label(icon='BLANK1')
|
|
|
|
|
|
2020-09-15 11:25:49 -05:00
|
|
|
layout.prop(view, "search_filter", icon='VIEWZOOM', text="")
|
|
|
|
|
|
|
|
|
|
layout.separator_spacer()
|
|
|
|
|
|
2020-12-21 14:27:09 -07:00
|
|
|
layout.popover(panel="PROPERTIES_PT_options", text="")
|
|
|
|
|
|
UI: Vertical Properties Editor Tabs
Moves the Properties editor context switching to a vertical tabs region.
Design Task: T54951
Differential Revison: D3840
The tabs are regular widgets, unlike the 'old' toolshelf tabs. This means they
give mouse hover feedback, have tooltips, support the right-click menu, etc.
Also, when vertical screen space gets tight, the tabs can be scrolled, they
don't shrink like the toolshelf ones.
The tab region is slightly larger than the header. The tabs are scaled up
accordingly. This makes them nicely readable.
The header is quite empty now. As shown in T54951, we wanted to have a search
button there. This should be added next.
Implementation Notes:
* Added a new region type, RGN_TYPE_NAVIGATION.
* Having the tabs in a separate region allows scrolling of the tab-bar, unlike
the toolshelf tabs. We might want to remove the scrollbars though.
* Added a new region flag RGN_FLAG_PREFSIZE_OR_HIDDEN, to ensure the tab region
is either hidden or has a fixed size.
* Added some additional flags to support fine-tuning the layout in panel and
layout code.
* Bumps subversion.
2018-10-29 21:34:14 +01:00
|
|
|
|
|
|
|
|
class PROPERTIES_PT_navigation_bar(Panel):
|
|
|
|
|
bl_space_type = 'PROPERTIES'
|
|
|
|
|
bl_region_type = 'NAVIGATION_BAR'
|
|
|
|
|
bl_label = "Navigation Bar"
|
|
|
|
|
bl_options = {'HIDE_HEADER'}
|
|
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
|
|
view = context.space_data
|
|
|
|
|
|
|
|
|
|
layout.scale_x = 1.4
|
|
|
|
|
layout.scale_y = 1.4
|
2020-10-13 13:10:41 -05:00
|
|
|
if view.search_filter:
|
2020-12-16 18:02:40 +11:00
|
|
|
layout.prop_tabs_enum(
|
|
|
|
|
view, "context", data_highlight=view,
|
|
|
|
|
property_highlight="tab_search_results", icon_only=True,
|
|
|
|
|
)
|
2020-10-13 13:10:41 -05:00
|
|
|
else:
|
|
|
|
|
layout.prop_tabs_enum(view, "context", icon_only=True)
|
2013-06-19 19:37:17 +00:00
|
|
|
|
|
|
|
|
|
2020-12-21 14:27:09 -07:00
|
|
|
class PROPERTIES_PT_options(Panel):
|
2021-02-16 09:38:42 -05:00
|
|
|
"""Show options for the properties editor"""
|
2020-12-21 14:27:09 -07:00
|
|
|
bl_space_type = 'PROPERTIES'
|
|
|
|
|
bl_region_type = 'HEADER'
|
2021-02-16 09:38:42 -05:00
|
|
|
bl_label = "Options"
|
2020-12-21 14:27:09 -07:00
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
|
|
space = context.space_data
|
|
|
|
|
|
|
|
|
|
col = layout.column()
|
|
|
|
|
col.label(text="Sync with Outliner")
|
|
|
|
|
col.row().prop(space, "outliner_sync", expand=True)
|
|
|
|
|
|
|
|
|
|
|
2017-03-18 20:03:24 +11:00
|
|
|
classes = (
|
|
|
|
|
PROPERTIES_HT_header,
|
UI: Vertical Properties Editor Tabs
Moves the Properties editor context switching to a vertical tabs region.
Design Task: T54951
Differential Revison: D3840
The tabs are regular widgets, unlike the 'old' toolshelf tabs. This means they
give mouse hover feedback, have tooltips, support the right-click menu, etc.
Also, when vertical screen space gets tight, the tabs can be scrolled, they
don't shrink like the toolshelf ones.
The tab region is slightly larger than the header. The tabs are scaled up
accordingly. This makes them nicely readable.
The header is quite empty now. As shown in T54951, we wanted to have a search
button there. This should be added next.
Implementation Notes:
* Added a new region type, RGN_TYPE_NAVIGATION.
* Having the tabs in a separate region allows scrolling of the tab-bar, unlike
the toolshelf tabs. We might want to remove the scrollbars though.
* Added a new region flag RGN_FLAG_PREFSIZE_OR_HIDDEN, to ensure the tab region
is either hidden or has a fixed size.
* Added some additional flags to support fine-tuning the layout in panel and
layout code.
* Bumps subversion.
2018-10-29 21:34:14 +01:00
|
|
|
PROPERTIES_PT_navigation_bar,
|
2020-12-21 14:27:09 -07:00
|
|
|
PROPERTIES_PT_options,
|
2017-03-18 20:03:24 +11:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": # only for live edit.
|
|
|
|
|
from bpy.utils import register_class
|
|
|
|
|
for cls in classes:
|
|
|
|
|
register_class(cls)
|