forked from bartvdbraak/blender
ab6c7ff2ab
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.
59 lines
1.6 KiB
Python
59 lines
1.6 KiB
Python
# ##### BEGIN GPL LICENSE BLOCK #####
|
|
#
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License
|
|
# as published by the Free Software Foundation; either version 2
|
|
# of the License, or (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software Foundation,
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
#
|
|
# ##### END GPL LICENSE BLOCK #####
|
|
|
|
# <pep8 compliant>
|
|
import bpy
|
|
from bpy.types import Header, Panel
|
|
|
|
|
|
class PROPERTIES_HT_header(Header):
|
|
bl_space_type = 'PROPERTIES'
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
|
|
row = layout.row()
|
|
row.template_header()
|
|
|
|
|
|
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.
|
|
from bpy.utils import register_class
|
|
for cls in classes:
|
|
register_class(cls)
|