[Bf-blender-cvs] [cf910575b1a] blender2.8: Add popover for Annotations in topbar

Antonioya noreply at git.blender.org
Mon Oct 15 18:54:29 CEST 2018


Commit: cf910575b1ac5c292c49bcaf141493a262aaab8c
Author: Antonioya
Date:   Mon Oct 15 18:54:09 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBcf910575b1ac5c292c49bcaf141493a262aaab8c

Add popover for Annotations in topbar

Part of T57211

===================================================================

M	release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M	release/scripts/startup/bl_ui/space_toolsystem_toolbar.py

===================================================================

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.



More information about the Bf-blender-cvs mailing list