diff options
author | Antonioya <blendergit@gmail.com> | 2018-10-15 19:54:09 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2018-10-15 19:54:23 +0300 |
commit | cf910575b1ac5c292c49bcaf141493a262aaab8c (patch) | |
tree | b0fb3f67d4fb841e85b6fd8f79cfc9666badd4c7 /release | |
parent | 9ecf68e8ae060c8d46a809ca3e6aacf399f23033 (diff) |
Add popover for Annotations in topbar
Part of T57211
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_grease_pencil_common.py | 2 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_toolsystem_toolbar.py | 31 |
2 files changed, 30 insertions, 3 deletions
diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py index af3170d4a22..052652faf1a 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -711,7 +711,7 @@ class AnnotationDataPanel: @staticmethod def draw_header(self, context): - if context.space_data.type != 'VIEW_3D': + if context.space_data.type not in {'VIEW_3D', 'TOPBAR'}: self.layout.prop(context.space_data, "show_annotation", text="") @staticmethod diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index d050015c2b2..2e58e3e0bb4 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -34,7 +34,9 @@ from .space_toolsystem_common import ( from .properties_material_gpencil import ( GPENCIL_UL_matslots, ) - +from .properties_grease_pencil_common import ( + AnnotationDataPanel, +) def generate_from_brushes_ex( context, *, @@ -207,8 +209,26 @@ def _defs_annotate_factory(): gpd = context.scene.grease_pencil else: gpd = context.gpencil_data + if gpd is not None: - layout.prop(gpd.layers, "active_note", text="") + if gpd.layers.active_note is not None: + text = gpd.layers.active_note + maxw = 25 + if len(text) > maxw: + text = text[:maxw - 5] + '..' + text[-3:] + else: + text = "" + + layout.label(text="Annotation:") + gpl = context.active_gpencil_layer + sub = layout.row(align=True) + sub.ui_units_x = 8 + + sub.prop(gpl, "color", text="") + sub.popover( + panel="TOPBAR_PT_annotation_layers", + text=text, + ) tool_settings = context.tool_settings space_type = tool.space_type @@ -2059,11 +2079,18 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): ], } +class TOPBAR_PT_annotation_layers(Panel, AnnotationDataPanel): + bl_space_type = 'VIEW_3D' + bl_region_type = 'HEADER' + bl_label = "Layers" + bl_ui_units_x = 14 + classes = ( IMAGE_PT_tools_active, VIEW3D_PT_tools_active, TOPBAR_PT_gpencil_materials, + TOPBAR_PT_annotation_layers, ) if __name__ == "__main__": # only for live edit. |