1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-06 01:12:40 +02:00

Compare commits

...

1 Commits

Author SHA1 Message Date
Jehan
db473c7fc7 app: reload GEGL operation with version management appropriately.
We are adding the infrastructure in both GEGL and GIMP to be able to
reload the expected rendering of a filter while still allowing updating
its arguments.
For this to work, a GEGL operation will have to keep code path for older
versions.
2024-08-19 17:25:41 +02:00
3 changed files with 19 additions and 13 deletions

View File

@@ -1167,6 +1167,7 @@ gimp_filter_tool_commit (GimpFilterTool *filter_tool,
region = gimp_drawable_filter_get_region (filter_tool->filter);
existing_node = gimp_drawable_filter_get_operation (filter_tool->existing_filter);
gegl_node_set_op_version (existing_node, NULL);
gegl_node_get (existing_node,
"operation", &name,
NULL);

View File

@@ -2515,8 +2515,9 @@ xcf_load_effect_props (XcfInfo *info,
xcf_read_int32 (info, (guint32 *) &filter_type, 1);
/* Check if valid property first */
if (! (pspec = gegl_operation_find_property (filter->operation_name,
filter_prop_name)))
if (! (pspec = gegl_operation_find_property_for_version (filter->operation_name,
filter_prop_name,
filter->op_version)))
{
gimp_message (info->gimp, G_OBJECT (info->progress),
GIMP_MESSAGE_WARNING,
@@ -3398,8 +3399,8 @@ xcf_load_effect (XcfInfo *info,
}
if (filter->op_version &&
g_strcmp0 (gegl_operation_get_op_version (filter->operation_name),
filter->op_version) != 0)
! gegl_operation_is_supported_version (filter->operation_name,
filter->op_version))
{
filter->unsupported_operation = TRUE;
@@ -3421,6 +3422,9 @@ xcf_load_effect (XcfInfo *info,
"operation", filter->operation_name,
NULL);
if (filter->op_version)
gegl_node_set_op_version (filter->operation, filter->op_version);
/* read in the effect properties */
if (! xcf_load_effect_props (info, &(*filter)))
goto error;

View File

@@ -835,10 +835,11 @@ xcf_save_effect_props (XcfInfo *info,
GimpFilter *filter,
GError **error)
{
GParamSpec **pspecs;
guint n_pspecs;
GeglNode *node;
gchar *operation;
const gchar **names = NULL;
GParamSpec **pspecs;
guint n_pspecs;
GeglNode *node;
gchar *operation;
xcf_check_error (xcf_save_prop (info, image, PROP_VISIBLE, error,
gimp_filter_get_active (filter)), ;);
@@ -864,7 +865,7 @@ xcf_save_effect_props (XcfInfo *info,
"operation", &operation,
NULL);
pspecs = gegl_operation_list_properties (operation, &n_pspecs);
pspecs = gegl_node_list_properties (node, &names, &n_pspecs);
for (gint i = 0; i < n_pspecs; i++)
{
@@ -873,8 +874,7 @@ xcf_save_effect_props (XcfInfo *info,
FilterPropType filter_type = FILTER_PROP_UNKNOWN;
g_value_init (&value, pspec->value_type);
gegl_node_get_property (node, pspec->name,
&value);
gegl_node_get_property (node, names[i], &value);
switch (G_VALUE_TYPE (&value))
{
@@ -918,7 +918,7 @@ xcf_save_effect_props (XcfInfo *info,
GIMP_MESSAGE_WARNING,
"XCF Warning: argument \"%s\" of filter %s has "
"unsupported type %s. It was discarded.",
pspec->name, operation,
names[i], operation,
g_type_name (G_VALUE_TYPE (&value)));
}
break;
@@ -926,12 +926,13 @@ xcf_save_effect_props (XcfInfo *info,
if (filter_type != FILTER_PROP_UNKNOWN)
xcf_check_error (xcf_save_prop (info, image, PROP_FILTER_ARGUMENT, error,
pspec->name, filter_type, value), ;);
names[i], filter_type, value), ;);
g_value_unset (&value);
}
g_free (operation);
g_free (pspecs);
g_free (names);
xcf_check_error (xcf_save_prop (info, image, PROP_END, error), ;);