Fix #106641: missing Annotation widgets #112688

Merged
Pratik Borhade merged 5 commits from MilanDavidovic/blender:fix-annotation-missing-widgets into main 2024-03-28 12:15:43 +01:00
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 {

Thanks, one more formatting change is detected https://builder.blender.org/admin/#/builders/210/builds/1270 :

-        if context.space_data.type not in {'VIEW_3D', 'TOPBAR', 'SEQUENCE_EDITOR', 'IMAGE_EDITOR', 'NODE_EDITOR', 'PROPERTIES'}:
+        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="")
Thanks, one more formatting change is detected https://builder.blender.org/admin/#/builders/210/builds/1270 : ``` - if context.space_data.type not in {'VIEW_3D', 'TOPBAR', 'SEQUENCE_EDITOR', 'IMAGE_EDITOR', 'NODE_EDITOR', 'PROPERTIES'}: + 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="") ```

Thanks, make format didn't fix that one, I'll fix it now.

Thanks, `make format` didn't fix that one, I'll fix it now.

This formatting change looks odd to me as well. But let's make the change for now :)

This formatting change looks odd to me as well. But let's make the change for now :)
'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",
MilanDavidovic marked this conversation as resolved Outdated

why not to use TOPBAR_PT_annotation_layers here?

why not to use `TOPBAR_PT_annotation_layers` here?

If I remember correctly, TOPBAR_PT_annotation_layers didn't work for Tools tab in Properties when I was first fixing this. That's why I added PROPERTIES_PT_annotation_layers, the only difference being bl_region_type = 'WINDOW' instead of 'HEADER'. But now it works with TOPBAR_PT_annotation_layers when applied to blender-v4.0-release.

Should I change it to TOPBAR_PT_annotation_layers? The name doesn't really reflect the usage context though.

If I remember correctly, `TOPBAR_PT_annotation_layers` didn't work for Tools tab in Properties when I was first fixing this. That's why I added `PROPERTIES_PT_annotation_layers`, the only difference being `bl_region_type = 'WINDOW`' instead of `'HEADER'`. But now it works with `TOPBAR_PT_annotation_layers `when applied to blender-v4.0-release. Should I change it to `TOPBAR_PT_annotation_layers`? The name doesn't really reflect the usage context though.

Yes, I would prefer to use TOPBAR_PT_annotation_layers :)

Yes, I would prefer to use `TOPBAR_PT_annotation_layers` :)

Sure, I'll make the change. :)

Sure, I'll make the change. :)
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;
}
}