Add popover for Annotations in topbar

Part of T57211
This commit is contained in:
Antonio Vazquez 2018-10-15 18:54:09 +02:00
parent 9ecf68e8ae
commit cf910575b1
Notes: blender-bot 2023-02-14 05:11:49 +01:00
Referenced by issue #57211, Annotation Tool Todo
2 changed files with 30 additions and 3 deletions

View File

@ -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

View File

@ -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.