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.
This commit is contained in:
Julian Eisel
2018-10-29 21:34:14 +01:00
parent ce148716c8
commit ab6c7ff2ab
16 changed files with 117 additions and 13 deletions

View File

@@ -18,7 +18,7 @@
# <pep8 compliant>
import bpy
from bpy.types import Header
from bpy.types import Header, Panel
class PROPERTIES_HT_header(Header):
@@ -27,16 +27,29 @@ class PROPERTIES_HT_header(Header):
def draw(self, context):
layout = self.layout
view = context.space_data
row = layout.row()
row.template_header()
row.prop(view, "context", expand=True, icon_only=True)
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
layout.prop_tabs_enum(view, "context", icon_only=True)
classes = (
PROPERTIES_HT_header,
PROPERTIES_PT_navigation_bar,
)
if __name__ == "__main__": # only for live edit.