Fix #106641: Missing Annotation widgets

Annotation layer widget was missing on the Tool Settings bar and the
side bar for some of the editors, as well as both color and layer
widgets on the Tool tab of the Properties editor.

Also fixed the Tool Settings bar not updating when drawing annotations
on the Image editor viewport, and the Tool panel in Properties editor
not updating when drawing annotations on the 3D scene.

Pull Request: https://projects.blender.org/blender/blender/pulls/112688
This commit is contained in:
Milan Davidović 2024-03-28 12:15:33 +01:00 committed by Pratik Borhade
parent dc243ff06b
commit c056c58493
5 changed files with 36 additions and 13 deletions

View File

@ -417,7 +417,13 @@ class AnnotationDataPanel:
bl_options = {'DEFAULT_CLOSED'}
def draw_header(self, context):
if context.space_data.type not in {'VIEW_3D', 'TOPBAR', 'SEQUENCE_EDITOR'}:
if context.space_data.type not in {
'VIEW_3D',
'TOPBAR',
'SEQUENCE_EDITOR',
'IMAGE_EDITOR',
'NODE_EDITOR',
'PROPERTIES'}:
self.layout.prop(context.space_data, "show_annotation", text="")
def draw(self, context):

View File

@ -171,8 +171,8 @@ class _defs_annotate:
gpl = context.active_annotation_layer
if gpl is not None:
layout.label(text="Annotation:")
if context.space_data.type in {'VIEW_3D', 'SEQUENCE_EDITOR'}:
if context.space_data.type in {'VIEW_3D', 'SEQUENCE_EDITOR', 'IMAGE_EDITOR', 'NODE_EDITOR'}:
layout.label(text="Annotation:")
if region_type == 'TOOL_HEADER':
sub = layout.split(align=True, factor=0.5)
sub.ui_units_x = 6.5
@ -184,7 +184,15 @@ class _defs_annotate:
panel="TOPBAR_PT_annotation_layers",
text=text,
)
elif context.space_data.type == 'PROPERTIES':
row = layout.row(align=True)
row.prop(gpl, "color", text="Annotation")
row.popover(
panel="TOPBAR_PT_annotation_layers",
text=text,
)
else:
layout.label(text="Annotation:")
layout.prop(gpl, "color", text="")
space_type = tool.space_type

View File

@ -123,14 +123,14 @@ bGPdata **ED_annotation_data_get_pointers_direct(ID *screen_id,
SpaceLink *sl = static_cast<SpaceLink *>(area->spacedata.first);
switch (area->spacetype) {
case SPACE_PROPERTIES: /* properties */
case SPACE_INFO: /* header info */
case SPACE_INFO: /* header info */
{
return nullptr;
}
case SPACE_TOPBAR: /* Top-bar */
case SPACE_VIEW3D: /* 3D-View */
case SPACE_TOPBAR: /* Top-bar */
case SPACE_VIEW3D: /* 3D-View */
case SPACE_PROPERTIES: /* properties */
{
if (r_ptr) {
*r_ptr = RNA_id_pointer_create(&scene->id);

View File

@ -812,12 +812,13 @@ static void buttons_area_listener(const wmSpaceTypeListenerParams *params)
}
break;
case NC_GPENCIL:
switch (wmn->data) {
case ND_DATA:
if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED, NA_SELECTED, NA_RENAME)) {
ED_area_tag_redraw(area);
}
break;
if (wmn->data == ND_DATA) {
if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED, NA_SELECTED, NA_RENAME)) {
ED_area_tag_redraw(area);
}
}
else if (wmn->action == NA_EDITED) {
ED_area_tag_redraw(area);
}
break;
case NC_NODE:

View File

@ -1004,6 +1004,14 @@ static void image_header_region_listener(const wmRegionListenerParams *params)
ED_region_tag_redraw(region);
}
break;
case NC_GPENCIL:
if (wmn->data & ND_GPENCIL_EDITMODE) {
ED_region_tag_redraw(region);
}
else if (wmn->action == NA_EDITED) {
ED_region_tag_redraw(region);
}
break;
}
}