xcf: Save/load NDE filter clipping setting

752f0fb4 did not fix saving/loading filters
in .xcf files. To do this, a new function to
retrieve the clip setting was added to
gimpdrawablefilters.c, and then used to
save the value in xcf-save.c. The existing
set_clip function was used in xcf-load.c,
just like in 752f0fb4.
This commit is contained in:
Alx Sa 2024-03-31 17:30:00 +00:00
parent 3749b23a6c
commit c17548f01c
5 changed files with 38 additions and 1 deletions

View File

@ -489,6 +489,14 @@ gimp_drawable_filter_get_composite_mode (GimpDrawableFilter *filter)
return filter->composite_mode; return filter->composite_mode;
} }
gboolean
gimp_drawable_filter_get_clip (GimpDrawableFilter *filter)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE_FILTER (filter), FALSE);
return filter->clip;
}
GimpFilterRegion GimpFilterRegion
gimp_drawable_filter_get_region (GimpDrawableFilter *filter) gimp_drawable_filter_get_region (GimpDrawableFilter *filter)
{ {

View File

@ -75,6 +75,7 @@ GimpLayerColorSpace
GimpLayerCompositeMode GimpLayerCompositeMode
gimp_drawable_filter_get_composite_mode gimp_drawable_filter_get_composite_mode
(GimpDrawableFilter *filter); (GimpDrawableFilter *filter);
gboolean gimp_drawable_filter_get_clip (GimpDrawableFilter *filter);
GimpFilterRegion GimpFilterRegion
gimp_drawable_filter_get_region (GimpDrawableFilter *filter); gimp_drawable_filter_get_region (GimpDrawableFilter *filter);

View File

@ -105,6 +105,7 @@ typedef struct
GimpLayerColorSpace blend_space; GimpLayerColorSpace blend_space;
GimpLayerColorSpace composite_space; GimpLayerColorSpace composite_space;
GimpLayerCompositeMode composite_mode; GimpLayerCompositeMode composite_mode;
gboolean clip;
GimpFilterRegion region; GimpFilterRegion region;
gboolean unsupported_operation; gboolean unsupported_operation;
@ -1092,6 +1093,7 @@ xcf_load_add_effects (XcfInfo *info,
data->blend_space, data->blend_space,
data->composite_space, data->composite_space,
data->composite_mode); data->composite_mode);
gimp_drawable_filter_set_clip (filter, data->clip);
gimp_drawable_filter_set_region (filter, data->region); gimp_drawable_filter_set_region (filter, data->region);
gimp_drawable_filter_apply (filter, NULL); gimp_drawable_filter_apply (filter, NULL);
@ -2718,6 +2720,15 @@ set_or_seek_node_property:
} }
break; break;
case PROP_FILTER_CLIP:
{
gboolean clip;
xcf_read_int32 (info, (guint32 *) &clip, 1);
filter->clip = clip;
}
break;
default: default:
#ifdef GIMP_UNSTABLE #ifdef GIMP_UNSTABLE
g_printerr ("unexpected/unknown effect property: %d (skipping)\n", g_printerr ("unexpected/unknown effect property: %d (skipping)\n",

View File

@ -71,7 +71,8 @@ typedef enum
PROP_LOCK_VISIBILITY = 42, PROP_LOCK_VISIBILITY = 42,
PROP_SELECTED_PATH = 43, PROP_SELECTED_PATH = 43,
PROP_FILTER_REGION = 44, PROP_FILTER_REGION = 44,
PROP_FILTER_ARGUMENT = 45 PROP_FILTER_ARGUMENT = 45,
PROP_FILTER_CLIP = 46
} PropType; } PropType;
typedef enum typedef enum

View File

@ -852,6 +852,8 @@ xcf_save_effect_props (XcfInfo *info,
gimp_drawable_filter_get_composite_space (GIMP_DRAWABLE_FILTER (filter))), ;); gimp_drawable_filter_get_composite_space (GIMP_DRAWABLE_FILTER (filter))), ;);
xcf_check_error (xcf_save_prop (info, image, PROP_COMPOSITE_MODE, error, xcf_check_error (xcf_save_prop (info, image, PROP_COMPOSITE_MODE, error,
gimp_drawable_filter_get_composite_mode (GIMP_DRAWABLE_FILTER (filter))), ;); gimp_drawable_filter_get_composite_mode (GIMP_DRAWABLE_FILTER (filter))), ;);
xcf_check_error (xcf_save_prop (info, image, PROP_FILTER_CLIP, error,
gimp_drawable_filter_get_clip (GIMP_DRAWABLE_FILTER (filter))), ;);
xcf_check_error (xcf_save_prop (info, image, PROP_FILTER_REGION, error, xcf_check_error (xcf_save_prop (info, image, PROP_FILTER_REGION, error,
gimp_drawable_filter_get_region (GIMP_DRAWABLE_FILTER (filter))), ;); gimp_drawable_filter_get_region (GIMP_DRAWABLE_FILTER (filter))), ;);
@ -1897,6 +1899,20 @@ xcf_save_prop (XcfInfo *info,
xcf_check_error (xcf_seek_pos (info, base + size, error), va_end (args)); xcf_check_error (xcf_seek_pos (info, base + size, error), va_end (args));
} }
break;
case PROP_FILTER_CLIP:
{
guint32 visible = va_arg (args, guint32);
size = 4;
xcf_write_prop_type_check_error (info, prop_type, va_end (args));
xcf_write_int32_check_error (info, &size, 1, va_end (args));
xcf_write_int32_check_error (info, &visible, 1, va_end (args));
}
break;
} }
va_end (args); va_end (args);