Issue #15491: "layers-mask-apply" insensitive on rasterizable items.

This commit is contained in:
Jehan 2025-12-14 17:54:03 +01:00
parent 1fcdb7243e
commit fbc563eb8b
2 changed files with 12 additions and 7 deletions

View file

@ -773,6 +773,7 @@ layers_actions_update (GimpActionGroup *group,
gboolean can_lock_alpha = FALSE;
gboolean has_rasterizable = FALSE;
gboolean has_rasterized = FALSE;
gboolean has_raster = FALSE;
gboolean text_layer = FALSE;
gboolean vector_layer = FALSE;
gboolean bs_mutable = FALSE; /* At least 1 selected layers' blend space is mutable. */
@ -939,7 +940,9 @@ layers_actions_update (GimpActionGroup *group,
n_text_layers++;
has_rasterizable = has_rasterizable || gimp_item_is_rasterizable (iter->data);
has_rasterized = has_rasterized || gimp_item_is_rasterized (iter->data);
has_rasterized = has_rasterized || gimp_item_is_rasterized (iter->data);
has_raster = (gimp_item_is_rasterized (iter->data) ||
! gimp_item_is_rasterizable (iter->data));
}
if (n_selected_layers == 1)
@ -1100,7 +1103,7 @@ layers_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("layers-mask-add-button", n_selected_layers > 0 && !fs && !ac);
SET_SENSITIVE ("layers-mask-add-last-values", n_selected_layers > 0 && !fs && !ac && have_no_masks);
SET_SENSITIVE ("layers-mask-apply", have_writable && !fs && !ac && have_masks && have_no_groups);
SET_SENSITIVE ("layers-mask-apply", have_writable && !fs && !ac && have_masks && have_no_groups && has_raster);
SET_SENSITIVE ("layers-mask-delete", n_selected_layers > 0 && !fs && !ac && have_masks);
SET_SENSITIVE ("layers-mask-edit", n_selected_layers == 1 && !fs && !ac && have_masks);

View file

@ -1678,9 +1678,10 @@ layers_mask_apply_cmd_callback (GimpAction *action,
mode = (GimpMaskApplyMode) g_variant_get_int32 (value);
for (iter = layers; iter; iter = iter->next)
{
if (gimp_layer_get_mask (iter->data) &&
if (gimp_layer_get_mask (iter->data) &&
(mode != GIMP_MASK_APPLY ||
(! gimp_viewable_get_children (GIMP_VIEWABLE (iter->data)) &&
(! gimp_item_is_rasterizable (iter->data) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (iter->data)) &&
! gimp_item_is_content_locked (GIMP_ITEM (iter->data), NULL))))
break;
}
@ -1713,10 +1714,11 @@ layers_mask_apply_cmd_callback (GimpAction *action,
if (gimp_layer_get_mask (iter->data))
{
if (mode == GIMP_MASK_APPLY &&
(gimp_viewable_get_children (GIMP_VIEWABLE (iter->data)) ||
(gimp_item_is_rasterizable (GIMP_ITEM (iter->data)) ||
gimp_viewable_get_children (GIMP_VIEWABLE (iter->data)) ||
gimp_item_is_content_locked (GIMP_ITEM (iter->data), NULL)))
/* Layer groups cannot apply masks. Neither can
* content-locked layers.
/* Layer groups, rasterizable items and content-locked items
* cannot apply masks.
*/
continue;